This package contains an implementation of Boosted Configuration (*neural*) Networks (BCNs). How do BCNs work? By creating ensembles (boosting in a supervised way) of single-layered feedforward (neural) Networks. Interested in learning more about BCNs? You can read:
- https://www.researchgate.net/publication/380760578_Boosted_Configuration_neural_Networks_for_supervised_classification
- https://thierrymoudiki.github.io/blog/2022/07/21/r/misc/boosted-configuration-networks
- https://thierrymoudiki.github.io/blog/2022/10/05/python/explainableml/interpretation-and-PI-for-BCN.
It's worth mentioning that this Python package is built on top of the R package, thanks
to rpy2
.
- the development version:
pip install -U git+https://github.com/Techtonique/bcn_python.git
- the stable version:
pip install BCN
As of 08/12/2022, the package's interface contains two classes: BCNClassifier
and BCNRegressor
. If you're familiar with scikit-learn, then using the package
will be straightforward (you can use fit
, predict
, cross_val_score
,
GridSearchCV
, etc.), as demo'ed in the following example. Otherwise, it's
relatively easy to grasp.
BCN for Classification:
import BCN as bcn # this line takes a long time to run, ONLY the first time it's run import numpy as np from sklearn.datasets import load_breast_cancer from sklearn.model_selection import train_test_split from sklearn import metrics dataset = load_breast_cancer() X = dataset.data y = dataset.target # split data into training test and test set X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=123) clf = bcn.BCNClassifier(**{'B': 237, 'activation': 'sigmoid', 'col_sample': 0.9628819950928769, 'lam': 0.6163764764960539, 'nu': 0.6683372199442862, 'r': 0.9199609524470921, 'tol': 4.8550370180201114e-06}) clf.fit(X_train, y_train) preds = clf.predict(X_test) print(np.mean(y_test == preds)) print(metrics.classification_report(preds, y_test))
BCN for Regression
BCN for Regression works exactly the same way as BCN for Classification. You just need to use a continuous response
y
as input (no integers in the response).
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.