cancel
Showing results for 
Search instead for 
Did you mean: 
Machine Learning
Dive into the world of machine learning on the Databricks platform. Explore discussions on algorithms, model training, deployment, and more. Connect with ML enthusiasts and experts.
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

3 REPLIES 3

Debayan
Databricks Employee
Databricks Employee

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.

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now