cancel
Showing results for 
Search instead for 
Did you mean: 
Machine Learning
cancel
Showing results for 
Search instead for 
Did you mean: 

How to avoid an error when using the automl python api on a classification problem

brendanmckenna
New Contributor III

I am working through a basic example to get familiar with databricks automl. When I run classify, I hit an mlflow error. How can I avoid this error?

My code:

summary = databricks.automl.classify(train_df, target_col='new_cases', data_dir='dbfs:/automl/india_covid_automl', timeout_minutes=30)

The resulting error:

CellExecutionError: An error occurred while executing the following cell:
------------------
import mlflow
import os
 
mlflow.mlflow.set_tracking_uri("databricks")
os.environ["DATABRICKS_HOST"] = "https://oregon.cloud.databricks.com"
os.environ["DATABRICKS_TOKEN"] = "[REDACTED]"
 
%matplotlib inline
------------------
 
[0;31m---------------------------------------------------------------------------[0m
[0;31mAttributeError[0m                            Traceback (most recent call last)
[0;32m[0m in [0;36m[0;34m()[0m
[1;32m      2[0m [0;32mimport[0m [0mos[0m[0;34m[0m[0;34m[0m[0m
[1;32m      3[0m [0;34m[0m[0m
[0;32m----> 4[0;31m [0mmlflow[0m[0;34m.[0m[0mmlflow[0m[0;34m.[0m[0mset_tracking_uri[0m[0;34m([0m[0;34m"databricks"[0m[0;34m)[0m[0;34m[0m[0;34m[0m[0m
[0m[1;32m      5[0m [0mos[0m[0;34m.[0m[0menviron[0m[0;34m[[0m[0;34m"DATABRICKS_HOST"[0m[0;34m][0m [0;34m=[0m [0;34m"https://oregon.cloud.databricks.com"[0m[0;34m[0m[0;34m[0m[0m
[1;32m      6[0m [0mos[0m[0;34m.[0m[0menviron[0m[0;34m[[0m[0;34m"DATABRICKS_TOKEN"[0m[0;34m][0m [0;34m=[0m [0;34m"[REDACTED]"[0m[0;34m[0m[0;34m[0m[0m
 
[0;31mAttributeError[0m: module 'mlflow' has no attribute 'mlflow'
AttributeError: module 'mlflow' has no attribute 'mlflow'
---------------------------------------------------------------------------
CellExecutionError                        Traceback (most recent call last)
<command-3357122079230110> in <cell line: 2>()
      1 mlflow.set_tracking_uri("databricks")
----> 2 summary = databricks.automl.classify(train_df, target_col='new_cases', data_dir='dbfs:/automl/india_covid_automl', timeout_minutes=30)
 
/local_disk0/.ephemeral_nfs/envs/pythonEnv-fad1e6db-7cab-40e9-b890-7eb4c6767ee5/lib/python3.9/site-packages/databricks/automl/__init__.py in classify(dataset, target_col, data_dir, timeout_minutes, max_trials)
     28     :return: Structured summary object with info about trials.
     29     """
---> 30     return Classifier(context_type=ContextType.DATABRICKS).fit(
     31         dataset, target_col, data_dir, timeout_minutes=timeout_minutes, max_trials=max_trials)
 
/local_disk0/.ephemeral_nfs/envs/pythonEnv-fad1e6db-7cab-40e9-b890-7eb4c6767ee5/lib/python3.9/site-packages/databricks/automl/classifier.py in fit(self, dataset, target_col, data_dir, max_trials, parallelism, timeout_minutes, experiment)
    124 
    125         try:
--> 126             return self._fit_impl(dataset, target_col, data_dir, max_trials, parallelism, timeout,
    127                                   experiment)
    128         finally:

1 ACCEPTED SOLUTION

Accepted Solutions

brendanmckenna
New Contributor III

I had (accidentally) manually installed a very early version of databricks automl. Once I upgraded the error resolved.

View solution in original post

4 REPLIES 4

Debayan
Esteemed Contributor III
Esteemed Contributor III

Hi @Brendan McKenna​ , The error is not clear. Could you please provide the error code? Is it run in a notebook ?

It's run in a notebook. I resolved it by upgrading the automl version. It looks like it was because I had an early automl version installed (0.1.dev0)

brendanmckenna
New Contributor III

I had (accidentally) manually installed a very early version of databricks automl. Once I upgraded the error resolved.

Kaniz
Community Manager
Community Manager

Hi @Brendan McKenna​ , We haven’t heard from you since the last response from @Debayan Mukherjee​. Or else, If you have any solution, please share it with the community, as it can be helpful to others.

Also, Please don't forget to click on the "Select As Best" button whenever the information provided helps resolve your question.

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.