Skip to main content

A fast boosting implementation using Rust and Python

Project description

Genbooster

A fast gradient boosting implementation using Rust and Python. Any base learner can be used.

1 - Installation

pip install genbooster

2 - Usage

2.1 - Regression

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_diabetes
from sklearn.linear_model import Ridge, RidgeCV
from sklearn.tree import ExtraTreeRegressor
from sklearn.model_selection import train_test_split
from genbooster.genbooster import BoosterRegressor
from sklearn.metrics import mean_squared_error
from tqdm import tqdm

# Load diabetes dataset
X, y = load_diabetes(return_X_y=True)
y = y.astype(np.float64)

# Split data
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, 
                                                    random_state=42)

results = []

for estimator in tqdm(all_estimators(type_filter='regressor')):
    try:
        regr = BoosterRegressor(base_estimator=estimator[1]())
        regr.fit(X_train, y_train)
        print(estimator[0])
        results.append((estimator[0], np.sqrt(mean_squared_error(y_test, regr.predict(X_test)))))
    except Exception as e:
        print(e)
        continue

results = pd.DataFrame(results, columns=['Estimator', 'RMSE']).sort_values(by='RMSE')
print(results)

2.2 - Classification

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.genbooster import BoosterClassifier
from sklearn.metrics import mean_squared_error
from tqdm import tqdm
from sklearn.utils.discovery import all_estimators


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(), 
                        n_hidden_features=10)
clf.fit(X_train, y_train)
preds = clf.predict(X_test)
print(np.mean(preds == y_test))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

genbooster-0.1.1-cp311-cp311-win_amd64.whl (185.7 kB view details)

Uploaded CPython 3.11Windows x86-64

genbooster-0.1.1-cp311-cp311-manylinux_2_34_x86_64.whl (332.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

genbooster-0.1.1-cp311-cp311-macosx_10_12_x86_64.whl (294.1 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

genbooster-0.1.1-cp310-cp310-win_amd64.whl (185.6 kB view details)

Uploaded CPython 3.10Windows x86-64

genbooster-0.1.1-cp310-cp310-manylinux_2_34_x86_64.whl (332.4 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

genbooster-0.1.1-cp310-cp310-macosx_10_12_x86_64.whl (294.1 kB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

genbooster-0.1.1-cp39-cp39-win_amd64.whl (186.2 kB view details)

Uploaded CPython 3.9Windows x86-64

genbooster-0.1.1-cp39-cp39-manylinux_2_34_x86_64.whl (333.1 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.34+ x86-64

genbooster-0.1.1-cp39-cp39-macosx_10_12_x86_64.whl (294.9 kB view details)

Uploaded CPython 3.9macOS 10.12+ x86-64

genbooster-0.1.1-cp38-cp38-win_amd64.whl (185.6 kB view details)

Uploaded CPython 3.8Windows x86-64

genbooster-0.1.1-cp38-cp38-manylinux_2_34_x86_64.whl (332.6 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.34+ x86-64

genbooster-0.1.1-cp38-cp38-macosx_10_12_x86_64.whl (295.0 kB view details)

Uploaded CPython 3.8macOS 10.12+ x86-64

File details

Details for the file genbooster-0.1.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: genbooster-0.1.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 185.7 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for genbooster-0.1.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 ef85fa067208cde63509091d6a5d962b993d5e47fa09c66382455148043c9ea8
MD5 600626b59c0ac2902e6bfc8de7bada7f
BLAKE2b-256 6e135a40e4ebd30c02ea9f81fe53ab5bcddb12a0b9b90f52ce93566193df31a4

See more details on using hashes here.

File details

Details for the file genbooster-0.1.1-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for genbooster-0.1.1-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 8b75d8a51ba3b5e5ff2340649428b66b234dd954b31a5d998d1bbe71ba2d7c67
MD5 57fb871459df0716864584c8a9539447
BLAKE2b-256 c4aa4f09dbcb8d667837ad944e1c73da5f7f2184bccdcf9282f4355907967b33

See more details on using hashes here.

File details

Details for the file genbooster-0.1.1-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for genbooster-0.1.1-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8b774569fe2707e9b5e8629dcd43299bb236c89c39f4cead32580c4721a74562
MD5 9f50ed1d7d069636441456cd3c29184d
BLAKE2b-256 d49cc02f52805672c5a5caa4a2e53c1ff02c98409a99e905d07dd3ef9531883d

See more details on using hashes here.

File details

Details for the file genbooster-0.1.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: genbooster-0.1.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 185.6 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for genbooster-0.1.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a75950681813ef30b9f64687d5c306e8ca96b3557d814ecb30fe9993ffa5e265
MD5 3ef9fa0507296e9f51f8a8a1b8198568
BLAKE2b-256 f8abafa3cda017c3a7b253662e1e1d9fbfa13bd09fd6cdb2503256cba882fdf4

See more details on using hashes here.

File details

Details for the file genbooster-0.1.1-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for genbooster-0.1.1-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 f49e642b7409a99d076a07a8daf35e363266ca2c2d8a74297b1a78b109f65ab6
MD5 c945dc4a14c582990bebd7e5b94c0208
BLAKE2b-256 abe7cfd80f16e10c0800a95489898be8cd67d0c2c85271b1cf3df99c914620e9

See more details on using hashes here.

File details

Details for the file genbooster-0.1.1-cp310-cp310-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for genbooster-0.1.1-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 01ec10ee7fe1e6154a3ff203f5f880a428b5c63905f79c0fb61cdda3de803cda
MD5 1129ef41668499b34f436967c9435116
BLAKE2b-256 5a79e20145e73bc8e4de11ca23fa11680d305afab4a1895d84929b45d7dfaf00

See more details on using hashes here.

File details

Details for the file genbooster-0.1.1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: genbooster-0.1.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 186.2 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for genbooster-0.1.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 10518f565905750df49b88b0060ec9d7f7496d8e64011660e4679a7c33417bdb
MD5 0aa3d2387e804e72b04346b107f625b1
BLAKE2b-256 754c816bcfaeed6f76bc9f6296367ac5fe6b403e86b80eb8dac18ec4d9dd1e3c

See more details on using hashes here.

File details

Details for the file genbooster-0.1.1-cp39-cp39-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for genbooster-0.1.1-cp39-cp39-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 872b96242fb8f919579b070ab6c3089ef9abd2e1569e3570ec2f5dcd7ae9a69f
MD5 291021597da63f3d4a56c48aedc15450
BLAKE2b-256 eaacf01da82c60dead264f16780ee67356bdd5f2e0bab2495a3ccb55b4c2cf13

See more details on using hashes here.

File details

Details for the file genbooster-0.1.1-cp39-cp39-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for genbooster-0.1.1-cp39-cp39-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0a5ff5c5eb908adf0aeeb8a279f8f79eedb10749ac9338d1163f84718302d43b
MD5 249d564dacbe8c1a26902ea63b209b3b
BLAKE2b-256 7c1c1bd5fa467eb8f80c3a71401dfacba3fc9e6cebf915300e83166aa8d7abed

See more details on using hashes here.

File details

Details for the file genbooster-0.1.1-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: genbooster-0.1.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 185.6 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for genbooster-0.1.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 2ab3e02c367972d76b7c70be741a7c245042f40eb7bfec44e538c7c75a915ec2
MD5 e7a35749538e043815136661e95d5e97
BLAKE2b-256 692a284b1bad37a27769b939adf366a62ae6ebce454878098bfa69aedfea36e7

See more details on using hashes here.

File details

Details for the file genbooster-0.1.1-cp38-cp38-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for genbooster-0.1.1-cp38-cp38-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 1a5dea9ef21206e96dcc8c164d727bbb3b7e35c4b9bb89f4250eb27785174eb0
MD5 4774f0020954728f0b8144e92d5e4829
BLAKE2b-256 25f74efad9f32b62aae8a315e9c912536d27687f235a0e2998d9bb54e4a07138

See more details on using hashes here.

File details

Details for the file genbooster-0.1.1-cp38-cp38-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for genbooster-0.1.1-cp38-cp38-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4e450e17d3f8e3c747d4051ccab3fda0def118500fa7bd254fa781fd84797c98
MD5 e345a334a9b937f730cabf85dfe51fc1
BLAKE2b-256 efd2f3d059bf15ca557680dc2824eb9cf5a778e782878831eff493d2708bdc91

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page