Skip to content

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