Metadata-Version: 2.4
Name: genbooster
Version: 0.5.1
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Rust
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Requires-Dist: nnetsauce
Requires-Dist: numpy >=1.20.0
Requires-Dist: pandas
Requires-Dist: scikit-learn >=1.0.0
License-File: LICENSE
Summary: A fast boosting implementation using Rust and Python
Author-email: "T. Moudiki" <thierry.moudiki@gmail.com>
Requires-Python: >=3.7
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Repository, https://github.com/yourusername/genbooster

# 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](https://www.researchgate.net/publication/386212136_Scalable_Gradient_Boosting_using_Randomized_Neural_Networks).

![PyPI](https://img.shields.io/pypi/v/genbooster) 
[![Downloads](https://pepy.tech/badge/genbooster)](https://pepy.tech/project/genbooster) 
[![Documentation](https://img.shields.io/badge/documentation-is_here-green)](https://techtonique.github.io/genbooster/)

## 1 - Installation

From PyPI:
```bash
pip install genbooster
```
From GitHub:
```bash
pip install git+https://github.com/Techtonique/genbooster.git
```

I might be required to install Rust and Cargo first: 

Command line:
```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
```

Python:
```python
import os
os.environ['PATH'] = f"/root/.cargo/bin:{os.environ['PATH']}"
```

Command line:
```bash
echo $PATH
rustc --version
cargo --version
```

## 2 - Usage

### 2.1 - Boosting

```python
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)

```python
clf = RandomBagClassifier(base_estimator=ExtraTreeRegressor())
clf.fit(X_train, y_train)
preds = clf.predict(X_test)
print(np.mean(preds == y_test))
```


