Last active
June 6, 2024 16:54
-
-
Save tomonori-masui/0f304d74c3cad1e53da61358d869ad1a to your computer and use it in GitHub Desktop.
Comparing custom GBM's RMSE to sklearn's
This file contains hidden or 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
from sklearn.ensemble import GradientBoostingRegressor | |
from sklearn.metrics import mean_squared_error | |
custom_gbm = CustomGradientBoostingRegressor( | |
n_estimators=20, | |
learning_rate=0.1, | |
max_depth=1 | |
) | |
custom_gbm.fit(x, y) | |
custom_gbm_rmse = mean_squared_error(y, custom_gbm.predict(x), squared=False) | |
print(f"Custom GBM RMSE:{custom_gbm_rmse:.15f}") | |
sklearn_gbm = GradientBoostingRegressor( | |
n_estimators=20, | |
learning_rate=0.1, | |
max_depth=1 | |
) | |
sklearn_gbm.fit(x, y) | |
sklearn_gbm_rmse = mean_squared_error(y, sklearn_gbm.predict(x), squared=False) | |
print(f"Scikit-learn GBM RMSE:{sklearn_gbm_rmse:.15f}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment