-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3369fa1
commit ae5fb95
Showing
10 changed files
with
438 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
downloads/ | ||
#eggs/ | ||
#.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
#*.egg-info/ | ||
.installed.cfg | ||
#*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# dotenv | ||
.env | ||
|
||
# virtualenv | ||
.venv | ||
venv/ | ||
ENV/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
|
||
# IDE settings | ||
.vscode/ | ||
.Rproj.user | ||
site/ | ||
|
||
# Apple files | ||
.DS_Store | ||
|
||
# R files | ||
*.Rhistory | ||
|
||
# Others | ||
unifiedbooster-docs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Copyright <2024> <T. Moudiki> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,91 @@ | ||
# unifiedbooster | ||
|
||
![PyPI](https://img.shields.io/pypi/v/unifiedbooster) [![PyPI - License](https://img.shields.io/pypi/l/unifiedbooster)](https://github.com/thierrymoudiki/unifiedbooster/blob/master/LICENSE) [![Downloads](https://pepy.tech/badge/unifiedbooster)](https://pepy.tech/project/unifiedbooster) | ||
[![Documentation](https://img.shields.io/badge/documentation-is_here-green)](https://techtonique.github.io/unifiedbooster/) | ||
|
||
## Examples | ||
|
||
### classification | ||
|
||
```python | ||
import unifiedbooster as ub | ||
from sklearn.datasets import load_iris, load_breast_cancer, load_wine | ||
from sklearn.model_selection import train_test_split | ||
from sklearn.metrics import accuracy_score | ||
|
||
datasets = [load_iris(), load_breast_cancer(), load_wine()] | ||
|
||
for dataset in datasets: | ||
|
||
X, y = dataset.data, dataset.target | ||
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42) | ||
|
||
# Initialize the unified regressor (example with XGBoost) | ||
regressor1 = ub.GBDTClassifier(model_type='xgboost') | ||
regressor2 = ub.GBDTClassifier(model_type='catboost') | ||
regressor3 = ub.GBDTClassifier(model_type='lightgbm') | ||
|
||
# Fit the model | ||
regressor1.fit(X_train, y_train) | ||
regressor2.fit(X_train, y_train) | ||
regressor3.fit(X_train, y_train) | ||
|
||
# Predict on the test set | ||
y_pred1 = regressor1.predict(X_test) | ||
y_pred2 = regressor2.predict(X_test) | ||
y_pred3 = regressor3.predict(X_test) | ||
|
||
# Evaluate the model | ||
accuracy1 = accuracy_score(y_test, y_pred1) | ||
accuracy2 = accuracy_score(y_test, y_pred2) | ||
accuracy3 = accuracy_score(y_test, y_pred3) | ||
print("-------------------------") | ||
print(f"Classification Accuracy xgboost: {accuracy1:.2f}") | ||
print(f"Classification Accuracy catboost: {accuracy2:.2f}") | ||
print(f"Classification Accuracy lightgbm: {accuracy3:.2f}") | ||
``` | ||
|
||
### regression | ||
|
||
```python | ||
import numpy as np | ||
import unifiedbooster as ub | ||
from sklearn.datasets import fetch_california_housing, load_diabetes | ||
from sklearn.model_selection import train_test_split | ||
from sklearn.metrics import mean_squared_error | ||
|
||
|
||
datasets = [fetch_california_housing(), load_diabetes()] | ||
|
||
for dataset in datasets: | ||
|
||
# Load dataset | ||
X, y = dataset.data, dataset.target | ||
|
||
# Split dataset into training and testing sets | ||
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42) | ||
|
||
# Initialize the unified regressor (example with XGBoost) | ||
regressor1 = ub.GBDTRegressor(model_type='xgboost') | ||
regressor2 = ub.GBDTRegressor(model_type='catboost') | ||
regressor3 = ub.GBDTRegressor(model_type='lightgbm') | ||
|
||
# Fit the model | ||
regressor1.fit(X_train, y_train) | ||
regressor2.fit(X_train, y_train) | ||
regressor3.fit(X_train, y_train) | ||
|
||
# Predict on the test set | ||
y_pred1 = regressor1.predict(X_test) | ||
y_pred2 = regressor2.predict(X_test) | ||
y_pred3 = regressor3.predict(X_test) | ||
|
||
# Evaluate the model | ||
mse1 = np.sqrt(mean_squared_error(y_test, y_pred1)) | ||
mse2 = np.sqrt(mean_squared_error(y_test, y_pred2)) | ||
mse3 = np.sqrt(mean_squared_error(y_test, y_pred3)) | ||
print("-------------------------") | ||
print(f"Regression Root Mean Squared Error xgboost: {mse1:.2f}") | ||
print(f"Regression Root Mean Squared Error catboost: {mse2:.2f}") | ||
print(f"Regression Root Mean Squared Error lightgbm: {mse3:.2f}") | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from .gbdt import GBDT | ||
from .gbdt_classification import GBDTClassifier | ||
from .gbdt_regression import GBDTRegressor | ||
|
||
__all__ = ["GBDTClassifier", "GBDTRegressor"] | ||
__all__ = ["GBDT", "GBDTClassifier", "GBDTRegressor"] |
Oops, something went wrong.