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 .
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.
 Kaggle: https://www.kaggle.com/francksylla/titanic-machine-learning-from-disaster/data