Important features list is randomly changing
GichanLee opened this issue · comments
repore commented
Hello, @marcotcr. I'm so glad to use your anchor. it is a really great work.
but I wanna ask something is not clear to me.
If I repetitively execute AnchorTabularExplainer like below codes, I get different important features list randomly.
rf_explainer_anchor = anchor_tabular.AnchorTabularExplainer(
['True', 'False'],
list(X_train.columns),
X_train.values,
{})
np.random.seed(1)
for i in range(0, 10):
rf_anchor_importance = list()
rf_exp_anchor = rf_explainer_anchor.explain_instance(X_test.values[0],
rf_clf.predict,
threshold=0.95)
rf_anchor_importance.append(rf_exp_anchor.exp_map['feature'])
print(rf_anchor_importance)
[[4, 18, 17]]
[[1, 18, 17]]
[[5, 18, 17]]
[[0, 18, 17]]
[[11, 18, 17]]
[[0, 18, 17]]
[[6, 18, 17]]
[[3, 10, 0]]
[[0, 18, 17]]
[[0, 18, 17]]
(I figured out that 'rf_clf' is fixed and np.random.seed(1) is working)
Did I use it wrongly? or is it working as intended?
If I was using it wrongly, how can I get fixed anchor?
I wanna get most important features ranked by the probabilities.
repore commented