Skip to content

Commit

Permalink
bump v0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
thierrymoudiki committed Aug 1, 2024
1 parent 20aeab7 commit 9bdecba
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 15 deletions.
10 changes: 5 additions & 5 deletions examples/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
10 changes: 5 additions & 5 deletions examples/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

subprocess.check_call(['pip', 'install', 'Cython'])

__version__ = "0.1.0"
__version__ = "0.1.1"

here = path.abspath(path.dirname(__file__))

Expand Down
5 changes: 3 additions & 2 deletions unifiedbooster/gbdt_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand All @@ -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
}

Expand Down
5 changes: 3 additions & 2 deletions unifiedbooster/gbdt_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand All @@ -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
}

Expand Down

0 comments on commit 9bdecba

Please sign in to comment.