Skip to content

Commit a2ae0fe

Browse files
committed
add a warning about xgboost version support
1 parent cd3f5b6 commit a2ae0fe

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

eli5/xgboost.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
from functools import partial
21
import re
2+
import warnings
3+
from functools import partial
34
from typing import Any, Optional, Pattern, Union
45

56
import numpy as np
67
import scipy.sparse as sp
8+
import xgboost
79
from xgboost import (
810
XGBClassifier,
911
XGBRegressor,
@@ -147,6 +149,11 @@ def explain_prediction_xgboost(
147149
changes from parent to child.
148150
Weights of all features sum to the output score of the estimator.
149151
"""
152+
if not xgboost.__version__.startswith(('0.', '1.')):
153+
warnings.warn(
154+
'This explanation might be incoorrect, '
155+
'only xgboost < 2.0.0 is known to work correctly')
156+
150157
booster, is_regression = _check_booster_args(xgb, is_regression)
151158
xgb_feature_names = _get_booster_feature_names(booster)
152159
vec, feature_names = handle_vec(

0 commit comments

Comments
 (0)