You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I call the function explain_prediction_lightgbm on my lightgbm booster model, eli5.lightgbm.explain_prediction_lightgbm(model1, doc=example, feature_names=list(example.index))
where model1 is <class 'lightgbm.basic.Booster'> ,
example is <class 'pandas.core.series.Series'>,
and list(example.index) is a list of string of the data feature names
I encounter the following error:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-27-199da8311346> in <module>()
----> 1 eli5.lightgbm.explain_prediction_lightgbm(model1, doc=example, feature_names=list(example.index))
/opt/xxx/software/anaconda3/lib/python3.6/site-packages/eli5/lightgbm.py in explain_prediction_lightgbm(lgb, doc, vec, top, top_targets, target_names, targets, feature_names, feature_re, feature_filter, vectorized)
109 """
110
--> 111 vec, feature_names = handle_vec(lgb, doc, vec, vectorized, feature_names)
112 if feature_names.bias_name is None:
113 # LightGBM estimators do not have an intercept, but here we interpret
/opt/xxx/software/anaconda3/lib/python3.6/site-packages/eli5/sklearn/utils.py in handle_vec(clf, doc, vec, vectorized, feature_names, num_features)
260 vec, feature_names, coef_scale=None, with_coef_scale=False)
261 feature_names = get_feature_names(
--> 262 clf, vec, feature_names=feature_names, num_features=num_features)
263 return vec, feature_names
264
/opt/xxx/software/anaconda3/lib/python3.6/site-packages/eli5/sklearn/utils.py in get_feature_names(clf, vec, bias_name, feature_names, num_features, estimator_feature_names)
93 return FeatureNames(estimator_feature_names, bias_name=bias_name)
94
---> 95 num_features = num_features or get_num_features(clf)
96 if isinstance(feature_names, FeatureNames):
97 if feature_names.n_features != num_features:
/opt/xxx/software/anaconda3/lib/python3.6/site-packages/eli5/sklearn/utils.py in get_num_features(estimator)
211 else:
212 raise ValueError("Can't figure out feature vector size for %s" %
--> 213 estimator)
214
215
ValueError: Can't figure out feature vector size for <lightgbm.basic.Booster object at 0x7fa5115826a0>
The text was updated successfully, but these errors were encountered:
When I call the function
explain_prediction_lightgbm
on my lightgbm booster model,eli5.lightgbm.explain_prediction_lightgbm(model1, doc=example, feature_names=list(example.index))
where model1 is
<class 'lightgbm.basic.Booster'>
,example is
<class 'pandas.core.series.Series'>
,and
list(example.index)
is a list of string of the data feature namesI encounter the following error:
The text was updated successfully, but these errors were encountered: