How to use a model trained by Azure AutoML

Rob Mizany 101 Reputation points
2021-03-04T01:46:00.083+00:00

Hi,
I've trained a classification model using Azure AutoML. In the "Output" folder of the best model page I can see these files:
![![74035-image.png]1]1

1- How should I use this model to predict new observations. I want to do this on Azure Machine Learning Studio, so no need to deploy it as a web service or take it to a local computer as a pickle file.

2- I saw a few examples where people downloading their model as a PKL file and loading and running it to get predictions. I tried it by using the following code:

import pickle  
Pkl_Filename = "testPickle.pkl"  
with open(Pkl_Filename, 'rb') as file:    
    Pickled_LR_Model = pickle.load(file)  
Pickled_LR_Model  

and got the below error:

ModuleNotFoundError Traceback (most recent call last)
<ipython-input-14-1e47995f2929> in <module>
2 Pkl_Filename = "testPickle.pkl"
3 with open(Pkl_Filename, 'rb') as file:
----> 4 Pickled_LR_Model = pickle.load(file)
5
6 Pickled_LR_Model

ModuleNotFoundError: No module named 'azureml.automl.runtime._ml_engine.featurizer_suggestion'

Also used the joblib library to load the model and got the same error. Please help me with detailed step-by-step instructions (including scripts) if it is possible. I'm new to Azure Machine Learning Studio.

Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
2,579 questions
{count} votes

Accepted answer
  1. Rob Mizany 101 Reputation points
    2021-03-10T20:16:29.617+00:00

    I fixed this problem by creating a new compute instance and using it to load the pickle file. Sounds strange but it seems this error happens due to a mismatch between the azureml sdk on the jupyter instance and on the compute instance.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. GiftA-MSFT 11,151 Reputation points
    2021-03-04T22:04:35.927+00:00

    Hi, it is possible to unpickle a model.pkl file, but you need to do so in a conda environment that is compatible with the runtime env where the pickle was created. Try installing the full automl package: pip install azureml-automl-runtime to see if it helps resolve the issue.