Azure ML Part 10, Create Web service from Models

In previous posts, I have explained how to create a machine learning scenario using Azure ML components.

One of the main advantages of using Azure ML is the ability to create a web service from it. That means the created model can be used in other services via an API URL and Password.

In this post, I will show how to create an API for a predictive model.

In this post, we are going to use Titanic dataset for the aim of creating a web service.

we have a dataset about Titanic, that has information such as passenger class, age, gender and people survived or not. Also, there is some other information such as passenger name and ID exists which we do not need them at this stage.

To access the Titanic Dataset, you can find it in all machine learning weblog and website such as Kaggle [1].

Import the dataset and create the below model in Azure ML Studio Experiment.

As you can see in the above picture, there is a need to select only Survived, Age, Sex, and PClass from all column list and for train model just Survived Column.

 

after creating the model, you need to run it, then click on the Predictive Web Service to access the web service. Next, (as you can see in the below picture, two different tabs exists one for experiment and the other one for Predictive experiment. and we have two extra nodes one for the input web service and another one for the output webservice.

run the experiment, however, there is a need to change the input and output of the web services.

Input Web service needs to get the input from users that is Age, Gender, and their PClass. for the output is the same, end users just need to see the prediction results which is Score and Score Probabilities. 

As a result, we need to change the model before creating the web service, remove the connection between input web service and connect it to the input of the Score model, then customized the select column node and remove the Survived column from the list (because for the input of the web service, user just need to provide age, gender, and passenger class, not the survived condition)

Next, you need to modify the connection for the output as well, so delete the current connection between the output node and, then add a new Column Selector node which selects only Score and Score Probability. Then connect the input of the output web service to it (as shown in the below picture). Then run again the experiment and click on the deploy web service at the bottom of the page

Now, a new page will show that provide some detail information about the web service.

In the new page you able to see the API code, the request and response link that shows how to set up web service and also the Test button to see how web service work.

click on the Test and see the result

as you can see in the above picture, you need to provide some information and at the bottom of the page the result will show up.

In the next step, you able to analyze the data in Excel by clicking on the Excel 2013 or later. By clicking a new Excel file with sample data will be download, enable the file and then click on the web service name 

 

select the Use Sample Data, then under the input 1, choose the data range, then identify the output range click on the Got it, Auto-predict and then Predict option to see the results.

 

[1] Kaggle: https://www.kaggle.com/francksylla/titanic-machine-learning-from-disaster/data

 

 

Leila Etaati on LinkedinLeila Etaati on TwitterLeila Etaati on Youtube
Leila Etaati
Trainer, Consultant, Mentor
Leila is the first Microsoft AI MVP in New Zealand and Australia, She has Ph.D. in Information System from the University Of Auckland. She is the Co-director and data scientist in RADACAD Company with more than 100 clients in around the world. She is the co-organizer of Microsoft Business Intelligence and Power BI Use group (meetup) in Auckland with more than 1200 members, She is the co-organizer of three main conferences in Auckland: SQL Saturday Auckland (2015 till now) with more than 400 registrations, Difinity (2017 till now) with more than 200 registrations and Global AI Bootcamp 2018. She is a Data Scientist, BI Consultant, Trainer, and Speaker. She is a well-known International Speakers to many conferences such as Microsoft ignite, SQL pass, Data Platform Summit, SQL Saturday, Power BI world Tour and so forth in Europe, USA, Asia, Australia, and New Zealand. She has over ten years’ experience working with databases and software systems. She was involved in many large-scale projects for big-sized companies. She also AI and Data Platform Microsoft MVP. Leila is an active Technical Microsoft AI blogger for RADACAD.

Leave a Reply