Skip to content

Commit

Permalink
chore(xgboost): update arguments
Browse files Browse the repository at this point in the history
Recent versions of xgboost have moved some arguments from the fit method to the
constructor.
  • Loading branch information
probberechts committed Jun 22, 2024
1 parent d71649f commit 828a220
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions socceraction/vaep/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,17 @@ def _fit_xgboost(
raise ImportError("xgboost is not installed.")
# Default settings
if tree_params is None:
tree_params = {"n_estimators": 100, "max_depth": 3}
tree_params = {
"n_estimators": 100,
"max_depth": 3,
"eval_metric": "auc",
"early_stopping_rounds": 10,
"enable_categorical": True,
}
if fit_params is None:
fit_params = {"eval_metric": "auc", "verbose": True}
fit_params = {"verbose": True}
if eval_set is not None:
val_params = {"early_stopping_rounds": 10, "eval_set": eval_set}
val_params = {"eval_set": eval_set}
fit_params = {**fit_params, **val_params}
# Train the model
model = xgboost.XGBClassifier(**tree_params)
Expand Down

0 comments on commit 828a220

Please sign in to comment.