0

我想将 LIME 应用于包含 10000 行(实例)的数据集。我运行下面的代码,但不幸的是,它真的很慢。我怎样才能更快地做到这一点?

num_explain = xtest.shape[0]
importances = { i: 0.0 for i in range(xtrain.shape[1]) }
w = []

for i in range(num_explain):
    instance = xtest.iloc[i,:]
    exp = lime_explainer.explain_instance(instance, model.best_estimator_.predict_proba, num_features=15)
    weights = exp.local_exp
    weight = [weights[1][m][1] for m in range(len(weights[1]))]
    w.append(weight)
4

0 回答 0