marcotcr / anchor

Code for "High-Precision Model-Agnostic Explanations" paper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'AnchorTabularExplainer' object has no attribute 'validation'

ArpitSisodia opened this issue · comments

exp = explainer.explain_instance(numpy_test, catBoostModel.predict, threshold=0.95).

/opt/anaconda3/lib/python3.7/site-packages/anchor/anchor_tabular.py in sample_from_train(self, conditions_eq, conditions_neq, conditions_geq, conditions_leq, num_samples, validation)
98 bla
99 """
--> 100 train = self.train if not validation else self.validation
101 d_train = self.d_train if not validation else self.d_validation
102 idx = np.random.choice(range(train.shape[0]), num_samples,

AttributeError: 'AnchorTabularExplainer' object has no attribute 'validation'

Experiencing the same issue.

Screen Shot 2020-05-22 at 00 39 26

Screen Shot 2020-05-22 at 00 44 17

Can you check your package version? Those lines of code should not be in there in 0.0.1.0, which is what is on pypi and in the master of this repo.

When I run pip install anchor_exp, v0.0.0.6 is installed. After running pip install --upgrade anchor_exp I did get v0.0.1.0.

However with this new version I am now getting a new error which I was not getting before for the below code:
explainer = anchor_tabular.AnchorTabularExplainer(['Bad', 'Good'], dfTrain.columns, dfTrain)

Screen Shot 2020-05-23 at 00 18 40

Screen Shot 2020-05-23 at 00 18 50

Screen Shot 2020-05-23 at 00 18 57

The above issue was happening since my data was a DataFrame. After changing it to a numpy array, all worked correctly. Thanks.