Closed abhipannala closed 3 years ago
Having the same issue. Predict does not work when trying to predict Testset, with predict Train there is no problem. RedHat 7.8 JupyterLab 2.1.0 interpret v0.2.1 and 0.2.0
IndexError Traceback (most recent call last)
Hi @abhipannala and @timbr99 ,
Thank you for reporting this! Would you mind sharing the shape of your X_test objects (X_test.shape
)? We typically see this IndexError when X_test contains a single instance and is 1-dimensional (i.e. X_test.shape == (10,)
as opposed to X_test.shape == (1, 10)
).
If X_test happens to be a 1-dimensional numpy array, you can transform it to our expected 2-dimensional format by calling X_test.reshape(1, -1)
.
Thanks! -InterpretML Team
Thank you so much for your reply @interpret-ml!
My X_test.shape is (51, 8418) and y_test is (51,1). My X_train.shape is (261, 8418) and y_train.shape is (261,1).
As already statet the problem does not persist when using the predict function on the X_train dataframe. Also tried using NumPy Arrays instead of DataFrame. There are only categorial values in the train and test set, the split was done once with train_test_split and once manually. I do not have this problem when using other data (tried winequality from kaggle).
If you have any ideas on what I could be doing wrong any help is greatly appriciated.
I have the same issue as @timbr99.
I will add that I've tried to train with X_train to predict X_test dataSet and also the reverse X_test to predict X_train dataset. Both will predict fine on the dataset being trained on and fails otherwise.
Hi @dataninjia, @timbr99, and @abhipannala,
We think this might be occurring because X_test contains a categorical value that doesn't exist in X_train. Can you check to see if this would explain the error in your cases? Our next release will contain a fix for this. In the meantime, if you'd like an early version of the fix, you can obtain it with:
pip install -I --no-deps --no-cache-dir https://interpret.blob.core.windows.net/pywheel/57ef36525f7a180af405d647f90835f509a088b7/interpret-0.2.1-py3-none-any.whl
Thanks for reporting this!
-InterpretML team
Hi @interpret-ml, sorry for the late answer. Unfortunatly this didn't fix it for me - same error. I checked all columns from X_train are in X_test and vice versa.
Hi timbr99 -- Sorry the above didn't resolve the issue that you reported. Due to a change in our packaging, the pip install command above didn't work as expected. We have a fix for the issue in our develop branch, which will be pushed to pypi in our next release.
-InterpretML team
Hi @dataninjia, @timbr99, and @abhipannala --
Our latest release should fix this issue. Thank you for reporting this to us!
-InterpretML team
@interpret-ml: I am also getting the same issue. And I don't have any string variable in my dataset. Btw, how EBM considers a variable which has only {0} in training and {1,0} in testing
I'm using: Ubuntu 18.04.2 LTS JupyterLab v1.04
When I try to use the .predict() method for the ExplainableBoostingRegressor() object. I run into an IndexError:
IndexError Traceback (most recent call last)