Tutorial: Deploy a machine learning model with the visual interface

To give others a chance to use the predictive model developed in part one of the tutorial, you can deploy it as an Azure web service. So far, you've been experimenting with training your model. Now, it's time to generate new predictions based on user input. In this part of the tutorial, you:

  • Prepare a model for deployment
  • Deploy a web service
  • Test a web service
  • Manage a web service
  • Consume the web service

Prerequisites

Complete part one of the tutorial to learn how to train and score a machine learning model in the visual interface.

Prepare for deployment

Before you deploy your experiment as a web service, you first have to convert your training experiment into a predictive experiment.

  1. Select Create Predictive Experiment* at the bottom of the experiment canvas.

    Animated gif showing the automatic conversion of a training experiment to a predictive experiment

    When you select Create Predictive Experiment, several things happen:

    • The trained model is stored as a Trained Model module in the module palette. You can find it under Trained Models.
    • Modules that were used for training are removed; specifically:
      • Train Model
      • Split Data
      • Evaluate Model
    • The saved trained model is added back into the experiment.
    • Web service input and Web service output modules are added. These modules identify where the user data will enter the model, and where data is returned.

    The training experiment is still saved under the new tabs at the top of the experiment canvas.

  2. Run the experiment.

  3. Select the output of the Score Model module and select View Results to verify the model is still working. You can see the original data is displayed, along with the predicted price ("Scored Labels").

Your experiment should now look like this:

Screenshot showing the expected configuration of the experiment after preparing it for deployment

Deploy the web service

  1. Select Deploy Web Service below the canvas.

  2. Select the Compute Target that you'd like to run your web service.

    Currently, the visual interface only supports deployment to Azure Kubernetes Service (AKS) compute targets. You can choose from available AKS compute targets in your machine learning service workspace or configure a new AKS environment using the steps in the dialogue that appears.

    Screenshot showing a possible configuration for a new compute target

  3. Select Deploy Web Service. You'll see the following notification when deployment completes. Deployment may take a few minutes.

    Screenshot showing the confirmation message for a successful deployment.

Test the web service

You can test and manage your visual interface web services by navigating to the Web Services tab.

  1. Go to the web service section. You'll see the web service you deployed with the name Tutorial - Predict Automobile Price[Predictive Exp].

    Screenshot showing the web service tab with the recently created web service highlighted

  2. Select the web service name to view additional details.

  3. Select Test.

    Screenshot showing the web service testing page

  4. Input testing data or use the autofilled sample data and select Test.

    The test request is submitted to the web service and the results are shown on page. Although a price value is generated for the input data, it is not used to generate the prediction value.

Consume the web service

Users can now send API requests to your Azure web service and receive results to predict the price of their new automobiles.

Request/Response - The user sends one or more rows of automobile data to the service by using an HTTP protocol. The service responds with one or more sets of results.

You can find sample REST calls in the Consume tab of the web service details page.

Screenshot showing a sample REST call that users can find in the Consume tab

Navigate to the API Doc tab, to find more API details.

Manage models and deployments

The models and web service deployments you create in the visual interface can also be managed from the Azure Machine Learning workspace.

  1. Open your workspace in the Azure portal.

  2. In your workspace, select Models. Then select the experiment you created.

    Screenshot showing how to navigate to experiments in the Azure portal

    On this page, you'll see additional details about the model.

  3. Select Deployments, it will list any web services that use the model. Select the web service name, it will go to web service detail page. In this page, you can get more detailed information of the web service.

    Screenshot detailed run report

You can also find these models and deployments in the Models and Endpoints sections of your workspace landing page (preview).

Clean up resources

Important

You can use the resources that you created as prerequisites for other Azure Machine Learning service tutorials and how-to articles.

Delete everything

If you don't plan to use anything that you created, delete the entire resource group so you don't incur any charges:

  1. In the Azure portal, select Resource groups on the left side of the window.

    Delete resource group in the Azure portal

  2. In the list, select the resource group that you created.

  3. On the right side of the window, select the ellipsis button (...).

  4. Select Delete resource group.

Deleting the resource group also deletes all resources that you created in the visual interface.

Delete only the compute target

The compute target that you created here automatically autoscales to zero nodes when it's not being used. This is to minimize charges. If you want to delete the compute target, take these steps:

  1. In the Azure portal, open your workspace.

    Delete the compute target

  2. In the Compute section of your workspace, select the resource.

  3. Select Delete.

Delete individual assets

In the visual interface where you created your experiment, delete individual assets by selecting them and then selecting the Delete button.

Delete experiments

Next steps

In this tutorial, you learned the key steps in creating, deploying, and consuming a machine learning model in the visual interface. To learn more about how you can use the visual interface to solve other types of problems, see out our other sample experiments.