eli5
eli5 copied to clipboard
IndexError: tuple index out of range despite having trained forest
Everything is in this gist: https://gist.github.com/QuantumDamage/4d256e9a4f02b91f332105c105b5e457
I'm just training forest and trying to see features importance with eli5.
@QuantumDamage thanks for providing the gist! So the error is
eli5.explain_weights(estimator = forest)
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-21-596faaed9271> in <module>()
----> 1 eli5.explain_weights(estimator = forest)
lib/python3.6/site-packages/singledispatch.py in wrapper(*args, **kw)
208
209 def wrapper(*args, **kw):
--> 210 return dispatch(args[0].__class__)(*args, **kw)
211
212 registry[object] = func
IndexError: tuple index out of range
I think that eli5.explain_weights(forest)
will work correctly. The reason why is that we are using the type of the first argument to decide which implementation of explain_weights
to use, but singledispatch library gets confused if the first argument is passed as a keyword argument instead. Ideally we'd like to word around this issue (or provide a better error message, but most likely it's easier to work around this).
It appears that a better error message was added from Python 3.6 onward: https://bugs.python.org/issue33967 @lopuhin