Skip to content

Commit

Permalink
Use numpy function to compute AUC score
Browse files Browse the repository at this point in the history
  • Loading branch information
nzw0301 committed Jul 24, 2024
1 parent e0a698a commit a231306
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lightgbm/lightgbm_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import lightgbm as lgb
import sklearn.datasets
import sklearn.metrics
from sklearn.model_selection import train_test_split


Expand Down Expand Up @@ -43,7 +44,8 @@ def objective(trial):
pruning_callback = optuna.integration.LightGBMPruningCallback(trial, "auc")
gbm = lgb.train(param, dtrain, valid_sets=[dvalid], callbacks=[pruning_callback])

return gbm.best_score["valid_0"]["auc"]
preds = gbm.predict(valid_x)
return sklearn.metrics.roc_auc_score(valid_y, preds)


if __name__ == "__main__":
Expand Down

0 comments on commit a231306

Please sign in to comment.