Skip to content
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

ProtoDash: local variable 'newinnerProduct' referenced before assignment #90

Closed
laramdemajo opened this issue May 21, 2020 · 8 comments
Closed

Comments

@laramdemajo
Copy link

laramdemajo commented May 21, 2020

I am using the HELOC Dataset and trying to explain a single test instance using prototypes from my training subset using below code:

explainer = ProtodashExplainer()
(W, S, _) = explainer.explain(dfTrain.to_numpy(), dfTest.iloc[0:1,:].to_numpy(), m=2)

However, I am getting below error:
Screen Shot 2020-05-22 at 01 58 42

Is this intentional? Please help.

Thank you

@laramdemajo laramdemajo changed the title ProtoDash: local variable 'newinnerProduct' referenced before assignments ProtoDash: local variable 'newinnerProduct' referenced before assignment May 22, 2020
@laramdemajo
Copy link
Author

Hi I would really appreciate some feedback please. I am using this library for my disseration and currently stuck due to this issue. Your help will be very much appreciated.

@ArpitSisodia
Copy link

I doubt you can use prototype for single instance. It is a way of sampling the data. Does it make sense to sample single instance ?

@laramdemajo
Copy link
Author

It should be possible, because IBM's Arya et al. state in their paper that ProtoDash can be used to explain a single test sample using samples from the train set (https://arxiv.org/pdf/1909.03012.pdf).

ProtoDash [26]: Selects diverse and representative samples that summarize a dataset or explain a test instance. Non-negative importance weights are also learned for each of the selected samples.

@sadhamanus
Copy link
Contributor

So you can explain a single instance but the dataset you use to explain it has to have multiple instances. You cannot have both X and Y have cardinality 1.

@laramdemajo
Copy link
Author

Of course, in fact in my code dfTrain contains 7403 instances as shown below:
Screen Shot 2020-05-27 at 15 50 30

@sadhamanus
Copy link
Contributor

sadhamanus commented May 27, 2020

So then try swapping the arguments. The thing to be explained is to come first. Also check they have the same dimensionality. If this doesnt work try looking at usage in the example tutorial notebooks.

@laramdemajo
Copy link
Author

Many thanks for your help. Swapping the arguments did the trick.

I followed the below comments in the PDASH.py file of this library so maybe you need to change the explanation there to avoid anyone doing the same mistake.

Screen Shot 2020-05-27 at 16 18 28

@sadhamanus
Copy link
Contributor

Awesome! Thanks.

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

No branches or pull requests

3 participants