From 9bdecba75d74c944047a1bcd79a5dfc7ddb05e27 Mon Sep 17 00:00:00 2001 From: Thierry Moudiki Date: Thu, 1 Aug 2024 08:36:42 +0200 Subject: [PATCH] bump v0.1.1 --- examples/classification.py | 10 +++++----- examples/regression.py | 10 +++++----- setup.py | 2 +- unifiedbooster/gbdt_classification.py | 5 +++-- unifiedbooster/gbdt_regression.py | 5 +++-- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/examples/classification.py b/examples/classification.py index 942e938..f0dd043 100644 --- a/examples/classification.py +++ b/examples/classification.py @@ -12,23 +12,23 @@ # Initialize the unified regressor (example with XGBoost) regressor1 = ub.GBDTClassifier(model_type='xgboost') -regressor2 = ub.GBDTClassifier(model_type='catboost') +#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) +#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_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) +#accuracy2 = accuracy_score(y_test, y_pred2) accuracy3 = accuracy_score(y_test, y_pred3) print(f"Classification Accuracy xgboost: {accuracy1:.2f}") -print(f"Classification Accuracy catboost: {accuracy2:.2f}") +#print(f"Classification Accuracy catboost: {accuracy2:.2f}") print(f"Classification Accuracy lightgbm: {accuracy3:.2f}") \ No newline at end of file diff --git a/examples/regression.py b/examples/regression.py index 7bb0827..07c4835 100644 --- a/examples/regression.py +++ b/examples/regression.py @@ -12,23 +12,23 @@ # Initialize the unified regressor (example with XGBoost) regressor1 = ub.GBDTRegressor(model_type='xgboost') -regressor2 = ub.GBDTRegressor(model_type='catboost') +#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) +#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_pred2 = regressor2.predict(X_test) y_pred3 = regressor3.predict(X_test) # Evaluate the model mse1 = mean_squared_error(y_test, y_pred1) -mse2 = mean_squared_error(y_test, y_pred2) +#mse2 = mean_squared_error(y_test, y_pred2) mse3 = mean_squared_error(y_test, y_pred3) print(f"Regression Mean Squared Error xgboost: {mse1:.2f}") -print(f"Regression Mean Squared Error catboost: {mse2:.2f}") +#print(f"Regression Mean Squared Error catboost: {mse2:.2f}") print(f"Regression Mean Squared Error lightgbm: {mse3:.2f}") diff --git a/setup.py b/setup.py index 9a5ee3d..5c23fb9 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ subprocess.check_call(['pip', 'install', 'Cython']) -__version__ = "0.1.0" +__version__ = "0.1.1" here = path.abspath(path.dirname(__file__)) diff --git a/unifiedbooster/gbdt_classification.py b/unifiedbooster/gbdt_classification.py index eeb2d5f..41befe5 100644 --- a/unifiedbooster/gbdt_classification.py +++ b/unifiedbooster/gbdt_classification.py @@ -43,12 +43,13 @@ def __init__(self, model_type='xgboost', **kwargs } elif self.model_type == "lightgbm": + verbose = self.verbosity - 1 if self.verbosity==0 else self.verbosity self.params = { 'num_iterations': self.n_estimators, 'learning_rate': self.learning_rate, 'bagging_fraction': self.subsample, 'max_depth': self.max_depth, - 'verbose': self.verbosity - 1 if self.verbosity==0 else self.verbosity + 'verbose': verbose, **kwargs } elif self.model_type == "catboost": @@ -57,7 +58,7 @@ def __init__(self, model_type='xgboost', 'learning_rate': self.learning_rate, 'rsm': self.subsample, 'depth': self.max_depth, - 'verbose': self.verbosity + 'verbose': self.verbosity, **kwargs } diff --git a/unifiedbooster/gbdt_regression.py b/unifiedbooster/gbdt_regression.py index 1d2d1fc..c450703 100644 --- a/unifiedbooster/gbdt_regression.py +++ b/unifiedbooster/gbdt_regression.py @@ -43,12 +43,13 @@ def __init__(self, model_type='xgboost', **kwargs } elif self.model_type == "lightgbm": + verbose = self.verbosity - 1 if self.verbosity==0 else self.verbosity self.params = { 'num_iterations': self.n_estimators, 'learning_rate': self.learning_rate, 'bagging_fraction': self.subsample, 'max_depth': self.max_depth, - 'verbose': self.verbosity - 1 if self.verbosity==0 else self.verbosity + 'verbose': verbose, **kwargs } elif self.model_type == "catboost": @@ -57,7 +58,7 @@ def __init__(self, model_type='xgboost', 'learning_rate': self.learning_rate, 'rsm': self.subsample, 'depth': self.max_depth, - 'verbose': self.verbosity + 'verbose': self.verbosity, **kwargs }