Open divyat09 opened 5 years ago
Hi Divyat, One obvious error I can see in your call is that you have set gamma to 100 when I presume you do not have an autoencoder that you have supplied. In such a case gamma should be 0.
Also note that a PN may not be always possible to find especially if the input is in the interior of the class distribution. You can of course play with the parameters to try to find one (viz. reduce kappa, increase iterations etc.)
@divyat09 In addition to what @sadhamanus pointed, here are some details about code line 77 which might help you debug your example:
self._wbmodel._nb_classes should return the number of output classes in your trained model. For example, for mnist example, it returns 10. target_label should return the output class corresponding to the data instance you are trying to explain. For example, in mnist example, if we try to explain an image instance that is classified by the model as digit "3", then target_label would be set to 3. So effectively, target variable would be a [1,10] array for mnist.
Are you training a Keras model on your dataset? Just verify in your example if "self._wbmodel._nb_classes" is returns the correct number of output classes for your model or throws an error.
@sadhamanus
I am using auto-encoder, I have trained an auto-encoder in Keras and pass it correctly to the PN API. Also, just to experiment, I set gamma=0 but still got the same error.
@vijay-arya I tested the output of "explainer._wbmodel._nb_classes" and the output is "1". I believe its incorrect since I am solving a binary classification problem. Yes, I am using Keras to train models. Also, are the target labels in range [1, num_total_labels] or [0, num_total_labels-1]? The Keras model which is being explained using CEM actually has labels as 0 and 1.
@divyat09 Can you try creating a model that has 2 output classes, something along the lines of the following example: https://nbviewer.jupyter.org/github/IBM/AIX360/blob/master/examples/tutorials/HELOC.ipynb#c2 In case you've added a softmax, please also remove that as CEM requires logits as output.
I am using CEMExplainer to generate explanations for my dataset of the following shape: (91,3)
However, I face the following error:
IndexError Traceback (most recent call last)