Applies to: Microsoft Learning Server 9.2.1
Learn how to deploy an Python model as a web service with Machine Learning Server. Data scientists work locally in their preferred Python IDE and favorite version control tools to build scripts and models. Using the azureml-model-management-sdk Python package that ships with Machine Learning Server, you can develop, test, and ultimately deploy these Python analytics as web services in your production environment.
In Machine Learning Server, a web service is a model and/or code that has been deployed and hosted in the server. Each web service is uniquely defined by a
version. When consumed, the service consists of the code execution on a compute node. Learn more about web services.
You can use the functions in the azureml-model-management-sdk Python library to manage the web service's lifecycle from a Python script. A set of RESTful APIs are also available to provide direct programmatic access to a service's lifecycle.
After you have completed the prerequisites, this task takes approximately 10 minutes to complete.
Before you begin this QuickStart, have the following ready:
- Machine Learning Server with Python that's configured to operationalize models. Try an Azure Resource Management template to quickly configure a server for operationalization.
- The connection details (host, username, password) to that server instance from your administrator.
- Familiarity with Python. Here's a video tutorial.
- Familiarity with Jupyter notebooks. Learn how to load sample Python notebooks.
The example for this quickstart is stored in a Jupyter notebook. This notebook format allows you to not only see the code alongside detailed explanations, but also allows you to try out the code.
This example walks through the deployment of a Python model as a web service hosted in Machine Learning Server. We will build a simple linear model using the rx_lin_mod function from the revoscalepy package installed with Machine Learning Server or locally on Windows machine. This package requires a connection to Machine Learning Server.
The notebook example walks you through how to:
Create and run a linear model locally
Authenticate with Machine Learning Server from your Python script
Publish the model as a Python web service to Machine Learning Server
Examine, test, and consume the service in the same session
Delete the service
You can try it yourself with the notebook.
After it has been deployed, the web service can be:
Integrated into an application by an application developer using the Swagger-based .JSON file produced when the web service was published.
This section provides a quick summary of useful links for data scientists looking to operationalize their analytics with Machine Learning Server.
- About Operationalization
- What are web services
- Functions in azureml-model-management-sdk package
- Connecting to Machine Learning Server in Python
- Working with web services in Python
- How to consume web services in Python synchronously (request/response)
- How to consume web services in Python asynchronously (batch)
- How to integrate web services and authentication into your application
- Get started for administrators
- User Forum