Skip to main content

ABC-LR is a classification method that combines the Artificial Bee Colony algorithm with a logistic regression classification model.

Project description

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

ABC-LR is an innovative binary classification technique that leverages the Artificial Bee Colony (ABC) algorithm, substituting the traditional Gradient Descent approach for training weights in the Logistic Regression model. This method primarily aims to minimize the cost function's value through the ABC algorithm. Renowned for its dual capacity for local and global solution space exploration, the ABC algorithm significantly enhances this classification method.

Our research indicates that ABC-LR outperforms the standard Logistic Regression (LR) method in terms of classification accuracy. This is particularly notable in managing complex and high-dimensional datasets.

However, it's important to note that the ABC-LR method may exhibit increased runtime, especially with complex data. To address this, we offer both CPU and GPU parallelized versions of the ABC-LR classification method, ensuring substantial runtime efficiency gains.

ABC-LR is developed in Python3 and undergoes regular testing on Python versions 3.7 and 3.10, ensuring consistent performance and compatibility.

Installation

Install ABC-LR via PyPI:

pip install abcLR

Or alternatively, clone the environment:

git clone https://github.com/kagandedeturk/ABC-LR.git

CPU Version Usage

import numpy as np
parallelType = np
from abcLR import ABC_LR_Model
from sklearn.datasets import load_breast_cancer
X, y = load_breast_cancer(return_X_y=True)

lb = -16
ub = 16
evaluationNumber = 20000
# 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}")
acc, F1, prediction, confMatrix = model.score(X, y)
print(f"Accuracy: {acc}\nF1-Score: {F1}\nConfusion Matrix: {confMatrix}")

GPU Version Usage

import cupy as cp
parallelType = cp
from abcLR import ABC_LR_Model
from sklearn.datasets import load_breast_cancer
X, y = load_breast_cancer(return_X_y=True)

X = parallelType.array(X)
y = parallelType.array(y)

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}")
acc, F1, prediction, confMatrix = model.score(X, y)
print(f"Accuracy: {acc}\nF1-Score: {F1}\nConfusion Matrix: {confMatrix}")

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.

Miscellaneous

abcLR has been developed by Dr. Bilge Kagan Dedeturk, an Assistant Professor in the Department of Software Engineering at Erciyes University. For any queries or further information, Dr. Dedeturk can be contacted at kagandedeturk@gmail.com or bilgededeturk@erciyes.edu.tr.

Reporting Issues

Encountered a bug? Your contributions to refining abcLR are invaluable. Please report any issues you find at our GitHub repository: abcLR Issues.

Citation

Are you incorporating abcLR into your research? We'd be honored. Please refer to the following studies in your citations to acknowledge the use of abcLR:

@article{DEDETURK2020106229,
    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},
    author = {Bilge Kagan Dedeturk and Bahriye Akay}
}

@Inbook{Dedeturk2021,
    author = {Dedeturk, Bilge Kagan and Akay, Bahriye and Karaboga, Dervis},
    editor = {Carbas, Serdar and Toktas, Abdurrahim and Ustun, Deniz},
    title = {Artificial Bee Colony Algorithm and Its Application to Content Filtering in Digital Communication},
    bookTitle = {Nature-Inspired Metaheuristic Algorithms for Engineering Optimization Applications},
    year = {2021},
    publisher = {Springer Singapore},
    address = {Singapore},
    pages = {337--355},
    doi = {10.1007/978-981-33-6773-9_15}
}

@article{KOLUKISA2024103808,
    title = {An efficient network intrusion detection approach based on logistic regression model and parallel artificial bee colony algorithm},
    journal = {Computer Standards & Interfaces},
    volume = {89},
    pages = {103808},
    year = {2024},
    issn = {0920-5489},
    doi = {https://doi.org/10.1016/j.csi.2023.103808},
    author = {Burak Kolukisa and Bilge Kagan Dedeturk and Hilal Hacilar and Vehbi Cagri Gungor}
}

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

Project details


Download files

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

Source Distribution

abcLR-1.0.1.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

abcLR-1.0.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: abcLR-1.0.1.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for abcLR-1.0.1.tar.gz
Algorithm Hash digest
SHA256 44d8512436ff149dbc3461f7710820804b688cbf7c0d7bb07e8734c2912f0903
MD5 6e4f4cd3ecc44daa61c03df0e8957cb4
BLAKE2b-256 792d1ff34d8fa21bba8ed11220a3a4865f4754da49866b63a6fa6d098b38c366

See more details on using hashes here.

File details

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

File metadata

  • Download URL: abcLR-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for abcLR-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 836d1e69df3e1964f91176ea362606c35bc58d85ce4d3a1b1d926fcfa06d7668
MD5 a950f2c25d2986c8cb08033da1bb93f5
BLAKE2b-256 68e10c650227473e1728af7f847a95c79cc4699daf01aa750c7a137dd2061fb9

See more details on using hashes here.

Supported by

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