python - LimeTabularExplainer 类型错误 : unhashable type: 'slice'

标签 python

我正在尝试使用 LIME 包来解释预测模型。运行以下代码时看到错误:

# Create the LIME Explainer
explainer = lime.lime_tabular.LimeTabularExplainer(X_train_undersample feature_names = feature_names,class_names=['0','1'], kernel_width=3)

错误:

TypeError: unhashable type: 'slice'

这可能是什么问题?

最佳答案

如果您的 x_train 是一个 DataFrame,请尝试像这样传递它:

x_train_undersample.as_matrix()

关于python - LimeTabularExplainer 类型错误 : unhashable type: 'slice' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49422381/

相关文章:

python - 在 python 中,如果我将变量分配给方法,这意味着什么?

python - 我可以在 matplotlib 中指定文本框的右下角吗?

python - 是否可以覆盖 "self"以指向 python 中 self.method 中的另一个对象?

python - 从 pandas dataframe 到 xlwings 的 excel?

python - 在python中定义一个新的数字基数(新的字符集)

python - 使用tensorflow和TFBertForNextSentencePrediction在特定语料库上进一步训练bert

python - 如何删除 Python 三重引号多行字符串的额外缩进?

python - Python 中简单线性函数的优化

python - 更新 PySimpleGUI 中的单选按钮

python - 如何终止正在运行的 iPython 进程