Created
February 2, 2022 06:32
-
-
Save tomonori-masui/c93338f51da153f71bf5d1a1ad1843ba to your computer and use it in GitHub Desktop.
Comparing custom GBM's log-loss 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 GradientBoostingClassifier | |
from sklearn.metrics import log_loss | |
custom_gbm = CustomGradientBoostingClassifier( | |
n_estimators=20, | |
learning_rate=0.1, | |
max_depth=1 | |
) | |
custom_gbm.fit(x, y) | |
custom_gbm_log_loss = log_loss(y, custom_gbm.predict_proba(x)) | |
print(f"Custom GBM Log-Loss:{custom_gbm_log_loss:.15f}") | |
sklearn_gbm = GradientBoostingClassifier( | |
n_estimators=20, | |
learning_rate=0.1, | |
max_depth=1 | |
) | |
sklearn_gbm.fit(x, y) | |
sklearn_gbm_log_loss = log_loss(y, sklearn_gbm.predict_proba(x)) | |
print(f"Scikit-learn GBM Log-Loss:{sklearn_gbm_log_loss:.15f}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment