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
IndexError: list index out of range #745
Comments
I managed to find a solution to the error encountered. Apparently, num_trees is no longer the iterations number, i.e. the line:
causes the problem. For example, if you set the parameter |
Reopening issue for the pull request. |
Hi! Could this be merged? |
it's in my pull request #749 |
Yes, I already cloned your fix, thanks for that! I was wondering whether it could be merged and included in a release |
Doesn't work for me. Shap v'0.31.0', Catboost v'0.18' |
@ibuda This doesn't work either. I clone your repo and checkout to
The error is not about
My catboost version: 0.20.2 |
Hi @rightx2, you're right, the error you're getting has nothing to do with the problem presented in this issue. However, I've seen something similar to the error you're getting.
|
@ibuda merged! (sorry for the unreasonable delay, this issue was in a batch I missed following up on) |
@slundberg I hope to speak from the entire community, we can only imagine how busy your schedule is, and would like to thank you for a great product you've given us! Happy new coming year! |
@slundberg Thanks for your response, but I still get this "list index out of range" error with catboost-0.20.2 and shap-0.34.0. |
Up to my knowledge, this issue is fixed, closing. |
I still have problem with "IndexError: list index out of range" by running of this line with shap-0.34.0 : Here is the full error message: IndexError Traceback (most recent call last) /home/olya/env/lib64/python3.7/site-packages/shap/explainers/deep/init.py in init(self, model, data, session, learning_phase_flags) /home/olya/env/lib64/python3.7/site-packages/shap/explainers/deep/deep_tf.py in init(self, model, data, session, learning_phase_flags) IndexError: list index out of range Do you have any idea, why I'm getting this error or how could I solve this problem ? |
The error we were getting was related to catboost tree explainer, yours is related to deep explainer, and it seems that the layers[-1] causes the error, i.e. there are no layers in your NN. |
Hi @ibuda. Thank you for your fast reply. e = Embedding(vocab_size, 300, weights=[embedding_matrix], input_length=max_words, trainable=False) define modelmodel = Sequential() compile the modelmodel.compile(optimizer='adam', summarize the modelprint(model.summary()) fit the modelmodel.fit(padded_docs_train, y_train, epochs=10, verbose=0) evaluate the modelloss, accuracy = model.evaluate(padded_docs_test, y_test, verbose=0) |
@okunahe I would suggest you open a new issue since this one refers to a different framework. |
I am still facing the error ' list index out of range' . when using SHAP tree explainer for CATBOOST model. Is it really fixed? 1349 self.leaf_child_cnt = [] IndexError: list index out of range |
@ArpitSisodia there is something wrong with the issue you are reporting, as looking at the source code of the error you specified, the line 1352 refers to Please provide some code which we could run to reproduce the error you are getting. |
@ibuda thanks for your dedication. I found the same error using shap and catboost version 0.34.0 and 0.21, respectively. Minimum example: import shap from catboost import Pool iris_dataset = load_iris() x, y = shuffle(x, y) train_set = Pool( model = catboost.CatBoostClassifier( model = model.fit( explainer = shap.TreeExplainer(model) Error message: IndexError Traceback (most recent call last) ~\AppData\Local\Continuum\anaconda3\lib\site-packages\shap\explainers\tree.py in init(self, model, data, model_output, feature_perturbation, **deprecated_options) ~\AppData\Local\Continuum\anaconda3\lib\site-packages\shap\explainers\tree.py in init(self, model, data, data_missing) ~\AppData\Local\Continuum\anaconda3\lib\site-packages\shap\explainers\tree.py in get_trees(self, data, data_missing) IndexError: list index out of range |
Thanks @ibuda and @wagnerjorge , using the example I was able to find and fix the issue :) |
* Correct 1 usage of lodash/filter * Update fairness explanations notebook * Update fairness explanations notebook * Clean up fairness notebook * Fix XGBoost 1.0 issue * Fix shap#1061 for CatBoost cat features * New unit test for CatBoost categorical features * Allow ragged arrays sizes for Catboost shap#745 Co-authored-by: Scott Lundberg <slundberg@users.noreply.github.com>
I am running the following code:
I get the following error:
This error was spotted with Catboost version 0.15.2, I upgraded to the latest version (0.16.4 as of today), but the error persists.
I have Shap version: '0.29.3'
The text was updated successfully, but these errors were encountered: