Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix leaf_ids type error #269

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

haribaskar
Copy link

fixed TypeError: object of type 'numpy.int32' has no len()

File "C:\Users\username\test.py", line 20, in churn_factor_xgb
    prediction_text = explain_prediction(model,X_test.iloc[i])
  File "C:\ProgramData\Anaconda3\lib\site-packages\singledispatch.py", line 210, in wrapper
    return dispatch(args[0].__class__)(*args, **kw)
  File "C:\ProgramData\Anaconda3\lib\site-packages\eli5\xgboost.py", line 196, in explain_prediction_xgboost
    booster, dmatrix, n_targets, feature_names, xgb_feature_names)
  File "C:\ProgramData\Anaconda3\lib\site-packages\eli5\xgboost.py", line 247, in _prediction_feature_weights
    assert len(tree_dumps) == len(leaf_ids)
TypeError: object of type 'numpy.int32' has no len()

fixed 
assert len(tree_dumps) == len(leaf_ids)
TypeError: object of type 'numpy.int32' has no len()
@lopuhin
Copy link
Contributor

lopuhin commented May 28, 2018

Hi, thanks for the pull request, but it looks like the fix is not quite correct, xgboost tests are failing. It would be great if you could also add a test for this issue, or tell how to reproduce it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants