Package: cacp
Free software: MIT licenseDocumentation:https://cacp.readthedocs.ioGUI Preview:https://cacp.czmil.comArticle:https://doi.org/10.1016/j.softx.2022.101134DescriptionCACP is made for comparing newly developed classification algorithms (both traditional and incremental) in Python with other commonly used classifiers to evaluate classification performance, reproducibility, and statistical reliability. CACP simplifies the entire classifier evaluation process.InstallationTo install cacp, run this command in your terminal:pip install cacpPython 3.10 or greater required to download latest version of CACP. In order to install older version that supports Python 3.8 or greater, run this command in your terminal:pip install cacp==0.3.1UsageJupyter Notebook on Kaggle:https://www.kaggle.com/sc4444/cacp-example-usageSimple UsageAn example usage of this library is included in the package:https://github.com/sylwekczmil/cacp/tree/main/cacp_examples_simple.fromsklearn.ensembleimportRandomForestClassifierfromsklearn.neighborsimportKNeighborsClassifierfromsklearn.svmimportSVCfromsklearn.treeimportDecisionTreeClassifierfromcacpimportrun_experiment,ClassificationDataset# select datasetsexperimental_datasets=[ClassificationDataset('iris'),ClassificationDataset('wisconsin'),ClassificationDataset('pima'),ClassificationDataset('wdbc'),]# select classifiersexperimental_classifiers=[('SVC',lambdan_inputs,n_classes:SVC()),('DT',lambdan_inputs,n_classes:DecisionTreeClassifier(max_depth=5)),('RF',lambdan_inputs,n_classes:RandomForestClassifier(max_depth=5,n_estimators=10,max_features=1)),('KNN',lambdan_inputs,n_classes:KNeighborsClassifier(3)),]# trigger experiment runrun_experiment(experimental_datasets,experimental_classifiers,results_directory='./example_result')Advanced UsageAn advanced example usage of this library is included in the package:https://github.com/sylwekczmil/cacp/tree/main/cacp_examples.fromsklearn.neighborsimportKNeighborsClassifierfromskmultiflow.lazyimportKNNClassifierfromskmultiflow.metaimportLearnPPNSEClassifierfromcacpimportall_datasets,run_experiment,ClassificationDatasetfromcacp_examples.classifiersimportCLASSIFIERSfromcacp_examples.example_custom_classifiers.xgboostimportXGBoost# you can specify datasets by name, all of them will be automatically downloadedexperimental_datasets_example=[ClassificationDataset('iris'),ClassificationDataset('wisconsin'),ClassificationDataset('pima'),ClassificationDataset('sonar'),ClassificationDataset('wdbc'),]# or use all datasetsexperimental_datasets=all_datasets()# same for classifiers, you can specify list of classifiersexperimental_classifiers_example=[('KNN_3',lambdan_inputs,n_classes:KNeighborsClassifier(3)),# you can define classifiers multiple times with different parameters('KNN_5',lambdan_inputs,n_classes:KNeighborsClassifier(5)),# you can use classifiers from any lib that# supports fit/predict methods eg. scikit-learn/scikit-multiflow('KNNI',lambdan_inputs,n_classes:KNNClassifier(n_neighbors=3)),# you can also use wrapped algorithms from other libs or custom implementations('XGB',lambdan_inputs,n_classes:XGBoost()),('LPPNSEC',lambdan_inputs,n_classes:LearnPPNSEClassifier())]# or you can use predefined onesexperimental_classifiers=CLASSIFIERS# this is how you trigger experiment runrun_experiment(experimental_datasets,experimental_classifiers,results_directory='./example_result')Defining custom classifier wrapper:https://github.com/sylwekczmil/cacp/tree/main/cacp_examples/example_custom_classifiers/xgboost.py.Defining custom dataset:https://github.com/sylwekczmil/cacp/tree/main/cacp_examples/example_custom_datasets/random_dataset.pyDefining local dataset:https://github.com/sylwekczmil/cacp/tree/main/cacp_examples/example_custom_datasets/local_dataset.pyIncremental Algorithms UsageAn example usage of this library for incremental classifiers is included in the package:https://github.com/sylwekczmil/cacp/tree/main/cacp_examples_incremental.importriverfromriver.forestimportARFClassifierfromriver.naive_bayesimportGaussianNBfromriver.neighborsimportKNNClassifierfromriver.treeimportHoeffdingTreeClassifierfromcacpimportrun_incremental_experiment,ClassificationDatasetif__name__=='__main__':# select datasetsexperimental_datasets=[ClassificationDataset('iris'),ClassificationDataset('wisconsin'),# you can use datasets from riverriver.datasets.Phishing(),river.datasets.Bananas(),]# select incremental classifiersexperimental_classifiers=[('ARF',lambdan_inputs,n_classes:ARFClassifier()),('HAT',lambdan_inputs,n_classes:HoeffdingTreeClassifier()),('KNN',lambdan_inputs,n_classes:KNNClassifier()),('GNB',lambdan_inputs,n_classes:GaussianNB()),]# trigger experiment runrun_incremental_experiment(experimental_datasets,experimental_classifiers,results_directory='./example_result')Graphical user interface (GUI)PIPAfter installation, run this command in your terminal:cacpYou should get message like this:CACP stared on http://127.0.0.1:8050/Make sure that your scripts directory is in the PATH.
Example gui executable file on Windows can be found under:C:/Users/<USER>/AppData/Local/Programs/Python/Python<PYTHON_VERSION>/Scripts/cacp.exe.DockerYou can also run CACP GUI with docker:docker run -p 8050:8050 --name cacp sylwekczmil/cacpCACP will be available at:http://127.0.0.1:8050/CACP GUI PreviewSample preview of the CACP GUI is available at:https://cacp.czmil.com.