Skip to content

Commit

Permalink
tweak for when base_score is None
Browse files Browse the repository at this point in the history
  • Loading branch information
oegedijk committed Feb 11, 2023
1 parent bfefde5 commit 69e5552
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions explainerdashboard/explainer_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -1439,9 +1439,9 @@ def get_xgboost_preds_df(xgbmodel, X_row, pos_label=1):
n_classes = len(xgbmodel.classes_)
if n_classes == 2:
if pos_label==1:
base_proba = xgbmodel.get_params()['base_score']
base_proba = xgbmodel.get_params()['base_score'] or 0.5
elif pos_label==0:
base_proba = 1 - xgbmodel.get_params()['base_score']
base_proba = 1 - xgbmodel.get_params()['base_score'] or 0.5
else:
raise ValueError("pos_label should be either 0 or 1!")
n_trees = len(xgbmodel.get_booster().get_dump())
Expand Down

0 comments on commit 69e5552

Please sign in to comment.