A fast boosting implementation using Rust and Python
Project description
Genbooster
A gradient boosting and bagging (RandomBagClassifier, similar to RandomForestClassifier) implementation using Rust and Python. Any base learner can be employed. Base learners input features are engineered using a randomized artificial neural network layer.
For more details, see also https://www.researchgate.net/publication/386212136_Scalable_Gradient_Boosting_using_Randomized_Neural_Networks.
1 - Installation
From PyPI:
pip install genbooster
From GitHub:
pip install git+https://github.com/Techtonique/genbooster.git
I might be required to install Rust and Cargo first:
Command line:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
Python:
import os
os.environ['PATH'] = f"/root/.cargo/bin:{os.environ['PATH']}"
Command line:
echo $PATH
rustc --version
cargo --version
2 - Usage
2.1 - Boosting
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from sklearn.utils.discovery import all_estimators
from sklearn.datasets import load_iris, load_breast_cancer, load_wine
from sklearn.linear_model import Ridge, RidgeCV
from sklearn.tree import ExtraTreeRegressor
from sklearn.model_selection import train_test_split
from genbooster.genboosterclassifier import BoosterClassifier
from genbooster.randombagclassifier import RandomBagClassifier
X, y = load_iris(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
clf = BoosterClassifier(base_estimator=ExtraTreeRegressor())
clf.fit(X_train, y_train)
preds = clf.predict(X_test)
print(np.mean(preds == y_test))
2.2 - Bagging (RandomBagClassifier, similar to RandomForestClassifier)
clf = RandomBagClassifier(base_estimator=ExtraTreeRegressor())
clf.fit(X_train, y_train)
preds = clf.predict(X_test)
print(np.mean(preds == y_test))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file genbooster-0.6.1-cp310-cp310-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: genbooster-0.6.1-cp310-cp310-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 424.7 kB
- Tags: CPython 3.10, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fabf112ab12c12eecb2c4d99da64e7fffb8c10395a762fbdd71fbf7cc2cc0a5c
|
|
| MD5 |
badba538b3c0482c53194c93f369b925
|
|
| BLAKE2b-256 |
c7be00fb2cfd6dfc166ed23b3d4093555201fab823524fe345081210daf7bea3
|