0

I have just started working on Azure Data bricks.

I am facing some error while running a already created Python NoteBook.

Here is the code:

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')

Getting this error:

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

Cluster Runtime is :6.5 (includes Apache Spark 2.4.5, Scala 2.11)

AddyProg
  • 2,960
  • 13
  • 59
  • 110
  • After trying this also on an **Azure Databricks notebook**, *after installing mmlspark (the default version)*, I also have the same issue: [![enter image description here](https://i.stack.imgur.com/TgC3J.png)](https://i.stack.imgur.com/TgC3J.png) It seems to be related to the version of mmlspark (0.01...), and the documentation does not help much to see it at a glance... I also tried to install a more recent version of this in Azure Databricks without success. I think this is an issue more related to stackoverflow by the way :) – German C M Aug 12 '20 at 17:13
  • This question is better suited for Stackoverflow, if should be closed but since you added a bounty we are unable to cast close votes. Anyway, [documentation](https://mmlspark.blob.core.windows.net/docs/1.0.0-rc1/pyspark/_modules/mmlspark/lime/TabularLIME.html) indicates you should use `lime.TabularLIME.TabularLIME` as answered by Brian Spiering – Pedro Henrique Monforte Aug 12 '20 at 21:04

1 Answers1

2

The namespace is incorrect. The correct namespace is mmlspark.lime.TabularLIME.TabularLIME

from mmlspark.lime.TabularLIME import TabularLIME
Brian Spiering
  • 1,002
  • 1
  • 9
  • 18