Skip to main content

ARTIFICIAL BEE COLONY ALGORITHM WITH LOGISTIC REGRESSION (ABC-LR)

ABC-LR is a binary classification method in which the ABC algorithm is used instead of the Gradient Descent algorithm to train the weights in the Logistic Regression classification model. The purpose of the ABC algorithm in the ABC-LR method is to minimize the value of the cost function. The ABC algorithm is a very popular metaheuristic method that can search for solutions both locally and globally in the solution space. In addition, it has been shown in the study that the ABC-LR classification method achieves superior classification success compared to the LR classification method.

Although the ABC-LR classification method can handle complex and high-dimensional data, its runtime can be high. Therefore, CPU and GPU parallelized versions of the ABC-LR classification method are presented here, and significant improvements in runtime can be achieved.

ABC-LR is written in Python3 and continuously tested with Python 3.7 and 3.10.

Installation

Install ABC-LR via PyPI:

pip install abcLR

CPU Version Usage

import numpy as np
parallelType = np
from sklearn.datasets import load_breast_cancer
X, y = load_breast_cancer(return_X_y=True)
y = y.reshape(-1,1)

lb = -16
ub = 16
evaluationNumber = 80000
# FVS = trainData.shape[1]
limit = 50
P = 60
MR = 0.3
L2 = 0

model = ABC_LR_Model(lb=lb, ub=ub, evaluationNumber=evaluationNumber, limit=limit, P=P, MR=MR, L2=L2, parallelType=parallelType)
#start_time = dt.datetime.now()
model.fit(X, y)
#print(f"Run time: {dt.datetime.now()-start_time}")
print(f"Result: {model.score(X, y)}")

GPU Version Usage

import cupy as cp
parallelType = cp

from sklearn.datasets import load_breast_cancer
X, y = load_breast_cancer(return_X_y=True)

X = parallelType.array(X)
y = parallelType.array(y.reshape(-1,1))

lb = -16
ub = 16
evaluationNumber = 80000
# FVS = trainData.shape[1]
limit = 50
P = 60
MR = 0.3
L2 = 0

model = ABC_LR_Model(lb=lb, ub=ub, evaluationNumber=evaluationNumber, limit=limit, P=P, MR=MR, L2=L2, parallelType=parallelType)
#start_time = dt.datetime.now()
model.fit(X, y)
#print(f"Run time: {dt.datetime.now()-start_time}")
print(f"Result: {model.score(X, y)}")

License

This program is free software: you can redistribute it and/or modify it under the terms of the 3-clause BSD license (please see the LICENSE file).

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

You should have received a copy of the 3-clause BSD license along with this program (see LICENSE file). If not, see here.

Citation

If you use ABC-LR in one of your research projects, please cite us:

@article{DEDETURK2020,
title = {Spam filtering using a logistic regression model trained by an artificial bee colony algorithm},
journal = {Applied Soft Computing},
volume = {91},
pages = {106229},
year = {2020},
issn = {1568-4946},
doi = {https://doi.org/10.1016/j.asoc.2020.106229},
url = {https://www.sciencedirect.com/science/article/pii/S1568494620301691},
author = {Bilge Kagan Dedeturk and Bahriye Akay},
}

Copyright (c) 2022, Bilge Kagan Dedeturk (kagandedeturk@gmail.com)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

abcLR-0.0.1.tar.gz (91.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

abcLR-0.0.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file abcLR-0.0.1.tar.gz.

File metadata

  • Download URL: abcLR-0.0.1.tar.gz
  • Upload date:
  • Size: 91.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.1

File hashes

Hashes for abcLR-0.0.1.tar.gz
Algorithm Hash digest
SHA256 235722c8059303c5e64e0bc192f33aa6965c0f1c6b1c2ab604fbd61a522f1450
MD5 76b9f32415c24d45c0c0490c73f8c0b1
BLAKE2b-256 71ce8ddd4352a0870deddb615619ad7c3d9a137f116eb64509e8df48764e12f6

See more details on using hashes here.

File details

Details for the file abcLR-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: abcLR-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.1

File hashes

Hashes for abcLR-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c93af4a927dcd53bee9b4819024b6e67de683fbac9123da0da025aa5021860d8
MD5 b281c5adfd66ce44a307fb65e6f7eb9e
BLAKE2b-256 1d40906dbccfe10035935259692ead798a6b789d333283075fbe27658cbf2410

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page