Getting Started with Azure machine learning (iv) model Publishing as a Web service

Source: Internet
Author: User
Tags http post response code table definition

Connect Azure machine Learning (iii) to create an Azure machine learning experiment, the next step is to really publish the predictive model of Azure machine learning as a Web service. To enable the Web Service publishing task, first run the new Revenue Forecast experiment by clicking the Run as button on the bottom navigation bar. After the experiment has started running, the Publish Web service in the bottom navigation bar, the Publish Web Services button, becomes valid as shown in.

Figure Upcoming Web Service Azure Machine Learning experiment

At this point, clicking the Publish Web service in the bottom navigation bar in design mode, the Publish Web Services button, will appear as shown in the confirmation message.

Figure Publishing a Web service

After a few seconds, the dashboard displays the help links to the API keys and APIs provided by your predictive model Web service, as shown in the Web service.

Figure Azure machine Learning Web Services Dashboard

The Azure Machine Learning Dashboard provides all the information your web needs to invoke a new predictive model. The following are listed in the dashboard page to help you get started:

    • api key is the only security identity passed by each Web service request for authentication.
    • The request/Response API help page link provides information on how to invoke the Azure machine Learning Web service to make predictions for a single input record in the input.
    • API help page for batch processing provides a link to the predictive usage information that invokes the Azure machine Learning Web service to implement one or more input records.
    • downloadable Excel Workbooks ( Download Excel Workbook option allows you to download an Excel workbook that contains the following information about the new Azure machine Learning Web service:
      • Web service URL is the HTTP address that invokes the Web services.
      • ACCESS KEY is the API mentioned earlier key.
      • SCHEMA It's a HTTP url

The Excel workbook also contains macros that call your Azure machine learning Web Service directly from Excel, just enter the appropriate values in the Parameters section of the spreadsheet, and the macro triggers the call to the Azure Machine learning Web service and gets the forecast results. You can also easily add rows and change input parameters in a spreadsheet, and then view the changes in the forecast results.

    • Azure Management Portal ( the Management terminal (Manage endpoints) Link to Azure Management Portal takes you to another Web terminal that manages Web services.

Then we start with the API Help link from the request/Response Web service invocation. The screen shown is the one used by the API.

Figure Request/Response Web Service API call help page

Let's dive into how to use the API:

    • OData - side address - OData is a standardized syntax for querying, updating, and exposing data based on Web protocols (3-42), OData provides HTTP, XML, The ability to access JSON (JavaScript Object Notation) and Atom protocols.

Figure 3-42 OData Web service address for Azure machine learning experiment

    • Request Header – Displays the address of the Web HTTP POST request and the request header information that needs to be populated. The request header contains the requested content information and the accepted data type, based on which the server can return the appropriate data. Note that the Authorizationbearer field is required, and this entry is the API key obtained from the Web service, which is authorized by the validation of the service.

Figure Azure Machine Learning Web Service sample-Request header to send a POST request

    • Request Body -The HTTP request body of an example is shown in the following API request page. Figure 3-44 shows detailed information about the request body.

Figure An example of an HTTP request body data structure

We see that the data structure of the request body sample contains all the data sets of the file except for the revenue data. The revenue data is excluded because we will get our projected revenue data in a way that is called by the Web service.

The input format, data columns, and values required to obtain an effective response from the Azure Machine Learning Web Service are shown in the request body sample. The request body is in JSON format, and the JSON format is the most popular web data Interchange format, which is easy to read and write, and facilitates machine parsing and generation. An example of this request body can provide effective guidance for building a client application to obtain a Web service.

    • Response -The next section describes the response, including information about the HTTP response code returned by the Azure Machine Learning Web service. If the Web service successfully returns information, it should contain HTTP status code 200-OK in the code, and if the call to the Web service is unsuccessful, a Web page containing the rest API error code should be returned to help analyze the type of error and the cause of the error. Figure 3-45 shows the information for the response status code.

Figure 3-45 of the Azure Machine Learning Web Service HTTP Return Status code example

    • Response Headers -This section provides information for the Azure Machine Learning Web service to send to the client. Here, the server sends the response message, which is the JSON-formatted content information, as shown in.

Figure the HTTP response header information returned by the Azure Machine Learning Web Service

    • Response Body- This section contains information about the response messages returned by the Azure Machine Learning Web service. Note that the Azure machine learning Service will return each column of data in (except for revenue data) and the associated data type (numeric or string).

      One thing to note is that the data returned by the Azure Machine Learning Web Service contains two additional fields: the scoring tag and the scoring probability.

      • scoring Tag: This field represents the predicted result of the Azure machine learning model PIN, which is a row of datasets, expressing whether the forecast revenue level is greater than 50K or less than or equal to 50K.
      • scoring Probability: This field represents the numerical probability of the revenue scoring probability.

Represents an example of a response body.

Example of a graph response message: A field that adds two forecast results to the original dataset as the return data

    • Example Response message: This section shows the JSON data format for the response message of the Web service, which includes the full JSON record (curly brace representation), the data table definition (datatabble), a series of columns in the datasheet (ColumnNames), The data type (columntypes) and the returned data values (values) for each column, where the fields in the data values list are separated by commas. An example of the response information returned from the API Web page.

Example of Figure Response message format

    • code Example: This is the most interesting part: The Azure Machine Learning API Web page provides examples of C #, Python, and R language encodings, facilitating the rapid creation of client applications. We can complete the client application that invokes the Azure machine learning Predictive analytics Web service by simply populating the API key values and valid input datasets in the sample code.

Figure calls the code snippet for the Azure Machine Learning sample Web Service

Getting Started with Azure machine learning (iv) model Publishing as a Web service

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.