0

我刚刚开始研究 Azure 数据块。

运行已创建的 Python NoteBook 时遇到一些错误。

这是代码:

import mmlspark
from mmlspark import *

lime = TabularLIME()\
  .setModel(randomForestModel)\
  .setPredictionCol("predict")\
  .setOutputCol("weights")\
  .setInputCol("feat")
lime_model = lime.fit(eng_train_pipe)
lime_model.save('dbfs:/mnt/aimodels/rf-eng-lag-lime')

收到此错误:

NameError                                 Traceback (most recent call last)
<command-2244283784192060> in <module>
      2 from mmlspark import *
      3 
----> 4 lime = TabularLIME()\
      5   .setModel(rfModel)\
      6   .setPredictionCol("prediction")\

NameError: name 'TabularLIME' is not defined

集群运行时:6.5(包括 Apache Spark 2.4.5、Scala 2.11)

4

1 回答 1

2

命名空间不正确。正确的命名空间是mmlspark.lime.TabularLIME.TabularLIME

from mmlspark.lime.TabularLIME import TabularLIME
于 2020-08-12T14:12:51.410 回答