Skip to main content

CSA-ABC-LR is a classification method that combines The CSA and The ABC algorithm with a logistic regression classification model

Project description

CLONAL SELECTION ALGORITHM AND ARTIFICIAL BEE COLONY ALGORITHM WITH LOGISTIC REGRESSION (CSA-ABC-LR)

CSA-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 CSA-ABC algorithm in the CSA-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 CSA-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 csa_abc_lr

Or alternatively, clone the environment:

git clone https://github.com/kagandedeturk/CSA-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)
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 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.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.

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

csa_abcLR-1.0.1.tar.gz (6.4 kB view hashes)

Uploaded Source

Built Distribution

csa_abcLR-1.0.1-py3-none-any.whl (6.6 kB view hashes)

Uploaded Python 3

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