MarcelRobeer / ContrastiveExplanation

Contrastive Explanation (Foil Trees), developed at TNO/Utrecht University
BSD 3-Clause "New" or "Revised" License
44 stars 6 forks source link

Changing output every run #9

Closed Subh1m closed 3 years ago

Subh1m commented 3 years ago

Hi,

When I run the exp.explain_instance_domain(model.predict_proba, sample) , I get different output everytime. After every run, a different column is given as output.

Is there a way I can get constant results?

MarcelRobeer commented 3 years ago

All steps in the process should be seeded by a (numpy) seed, and therefore obtain the same results when re-running. Sometimes predictive models are stochastic (have slightly different outputs each time), but I am unable to determine that for your case in particular. Do you have a minimal working example so I can reproduce this error?

arsine1996 commented 3 years ago

I have the same issue, different results when rerunning, even with the specified seed. But, after some iterations the suggestions start to repeat themselves. Is that some logic behind that it first returns the best output?

Subh1m commented 3 years ago

I found the solution. Just change the parameter generate_data to generate_data=False. You start getting same output for single row. The reason being it will now only look into the training set and not generate neighborhood data.

arsine1996 commented 3 years ago

thank you, it worked.

Subh1m commented 3 years ago

My pleasure.