Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Azure by (5.8k points)

I've been working recently on deploying a machine learning model as a web service. I used Azure Machine Learning Studio for creating my own Workspace ID and Authorization Token. Then, I trained LogisticRegressionCV model from sklearn.linear_model locally on my machine (using python 2.7.13) and with the usage of below code snippet I wanted to publish my model as web service:

from azureml import services

@services.publish('workspaceID','authorization_token')

@services.types(var_1= float, var_2= float)

@services.returns(int)

def predicting(var_1, var_2):

    input = np.array([var_1, var_2].reshape(1,-1)

return model.predict_proba(input)[0][1]

where the input variable is a list with data to be scored and the model variable contains trained classifier. Then after defining the above function, I want to make a prediction on the sample input vector:

predicting.service(1.21, 1.34)

However, the following error occurs:

RuntimeError: Error 0085: The following error occurred during script 

evaluation, please view the output log for more information:

And the most important message in log is:

AttributeError: 'module' object has no attribute 'LogisticRegressionCV'

The error is strange to me because when I was using normal sklearn.linear_model.LogisticRegression everything was fine. I was able to make predictions sending POST requests to created endpoint, so I guess sklearn worked correctly. After changing to LogisticRegressionCV it does not.

Therefore I wanted to update the sklearn on my workspace.

Do you have any ideas on how to do it? Or even more general question: how to install any python module on azure machine learning studio in a way to use predict functions of any model I developed locally?

1 Answer

0 votes
by (9.6k points)

1. Via virtualenv, create a python project and active it.

2. Install all the packages necessary using pip

3. Package all files under the path Lib\site-packages as a zip file

4. Upload the zip file on your AML Workspace as dataset

5. Follow this document for further process

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.1k users

Browse Categories

...