Closed vykhand closed 4 years ago
HI!
I am getting this error when running the example:
initialize explainer, fit and generate counterfactual cf = CounterFactualProto(sess, nn, shape, use_kdtree=True, theta=10., max_iterations=1000, feature_range=(x_train.min(axis=0), x_train.max(axis=0)), c_init=1., c_steps=10) TypeError Traceback (most recent call last) in 12 cf = CounterFactualProto(sess, nn, shape, use_kdtree=True, theta=10., max_iterations=1000, 13 feature_range=(x_train.min(axis=0), x_train.max(axis=0)), ---> 14 c_init=1., c_steps=10) 15 cf.fit(x_train) 16 explanation = cf.explain(X)
TypeError Traceback (most recent call last)
/anaconda/envs/azureml_py36/lib/python3.6/site-packages/alibi/explainers/cfproto.py in init(self, predict, shape, kappa, beta, feature_range, gamma, ae_model, enc_model, theta, cat_vars, ohe, use_kdtree, learning_rate_init, max_iterations, c_init, c_steps, eps, clip, update_num_grad, write_dir, sess) 117 else: # black-box model 118 self.model = False --> 119 self.classes = self.predict(np.zeros(shape)).shape[1] 120 121 if is_enc:
TypeError: expected sequence object with len >= 0 or a single integer
keras.version
'2.3.1'
tf.version
'1.15.2'
Hi! Have you updated to the latest version (0.3.2)? There was a change in 0.3.0 so you don't need to pass in the TF session explicitly anymore, it looks like you're using an older version which still has this.
HI!
I am getting this error when running the example:
/anaconda/envs/azureml_py36/lib/python3.6/site-packages/alibi/explainers/cfproto.py in init(self, predict, shape, kappa, beta, feature_range, gamma, ae_model, enc_model, theta, cat_vars, ohe, use_kdtree, learning_rate_init, max_iterations, c_init, c_steps, eps, clip, update_num_grad, write_dir, sess) 117 else: # black-box model 118 self.model = False --> 119 self.classes = self.predict(np.zeros(shape)).shape[1] 120 121 if is_enc:
TypeError: expected sequence object with len >= 0 or a single integer
keras.version
'2.3.1'
tf.version
'1.15.2'