anchor icon indicating copy to clipboard operation
anchor copied to clipboard

'AnchorTabularExplainer' object has no attribute 'validation'

Open ArpitSisodia opened this issue 4 years ago • 4 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'

ArpitSisodia avatar May 21 '20 14:05 ArpitSisodia

Experiencing the same issue.

Screen Shot 2020-05-22 at 00 39 26 Screen Shot 2020-05-22 at 00 44 17

laramdemajo avatar May 21 '20 22:05 laramdemajo

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.

marcotcr avatar May 22 '20 21:05 marcotcr

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

laramdemajo avatar May 22 '20 22:05 laramdemajo

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

laramdemajo avatar May 26 '20 17:05 laramdemajo