Machine Learning in the Cloud with Azure Machine Learning

February 2019

Lecture 1: Introduction to Azure Machine Learning

Classification - Predicting a discrete category

Regression - Predicting a value

Anomaly detection - Identifying unusual data. e.g. fraud data.

Clustering - Grouping similar data together


25 different machine learning algorithms on azure

Azure Machine Learning Algorithms


Azure Machine Learning Studio

Drag and drop interface.

https://studio.azureml.net

+ New -> Blank Experiment -> Saved Datasets -> Samples

Open CV - Open source Computer Vision

Predict doctor show or no-show status

Course materials here: https://tetranoodle.com/course-materials-azure-ml/

+ New -> Dataset -> From local file

Saved Datasets -> My datasets -> Drag file to experiment page -> Right click -> Visualize -> Click on column to see stats -> Hover over histogram to see stats of each bin.

Type 'meta data' in search box. Drag and drop 'Edit Metadata'. Click on circle in bottom and dataset and drag to Edit Metadata box to connect them. -> Click on 'Launch column selector (to the right). Bring in all columns to the right except for AppointmentRegistration.

Drag another 'Edit Metadata' box below and join it. Categorical -> Make categorical -> Launch Column Selector. Select columns to turn into categorical. Fields -> Features

Drag another 'Edit Metadata' box below and join it -> Launch Column Selector. Choose numeric columns. Categorical -> Make non-categorical. Fields -> Features

Drag another 'Edit Metadata' box below and join it -> Launch Column Selector. Choose label columns -> Fields -> Label

Click run button and the bottom. Right click last Edit Metadata -> Results dataset -> visualize

Search 'split' -> Drag and drop 'split data' -> Change 'Fraction of rows in the fir...' to 0.7 (70%)

Search 'train model' -> Drag and drop 'train model'. Drag and drop another 'train model' then connect one dataset to each training model

Machine Learning -> Initialize Model -> Classification -> Drag and drop 'Two-class Decision Forest' as well as 'Two-class Decision Jungle'. Connect these to the Train Models.'

Search 'score' and drag and drop two 'score model' to the canvas. Connect the model to these as well as the test data from 'Split Data'

Search 'evaluate' -> Drag and drop 'Evaluate Model' then connect 'Score Model' to 'Evaluate Model'

Click on 'Train model' then 'Launch Column Selector' -> 'Status'

Click 'Run' button

You can click on the model and adjust parameters on the right

Right click evaluate model and click 'vizualize'. You can click 'ROC', 'PRECISION/RECALL' OR 'LIFT' to see those curves. Click on blue or red box to see the results from those tables.

Setup Web API

Click on Second model -> Set Up Web Service -> Predictive Web Service

Run (model again)

Deploy Web Service

You can download the Excel template which has the API key embedded in it and will allow you to run the API in that

Test -> Choose values -> Ok. Then shows values at bottom e.g. Show-Up and percent confidence

Click on Request/Response and it will show the JSON file as well as the python code to access the API

Predicting house prices

New -> Blank Experiment

New -> Dataset -> From local file

Saved Datasets -> My Datasets

Click on the one at the bottom of the box -> Visualize

Search 'Edit Metadata' -> Drag and drop 'Edit Metadata' -> Connect -> Launch column selector -> Keep all columns except for Id

Drag and drop 'Edit Metadata' -> Connect -> Launch column selector -> Choose categoircal featues 'ok' -> categorical: make categorical.

Drag and drop 'Edit Metadata' -> Connect -> categorical: make non-categorical, Fields: Features

Drag and drop 'Edit Metadata' -> Connect -> Do date-time fields.

Drag and drop 'Split data' -> Connect -> Fraction...: 0.7

Drag and drop 'Train Model' -> Connect -> Choose 'SalePrice' as the thing to predict

Drag and drop 'Bayesian Linear Regression' -> Connect to Train Model

Drag and drop 'Score Model' -> Connect from Train Model and Split Data

Run click 'Score Model' -> Visualize

Deploy a web application with Azure ML

portal.azure.com

+ Create a resource

Type 'Azure ML Request-Response Service Web App' in search box -> create -> Type in an 'App name' -> Type in a 'Resource Group' e.g. appnameRG

Open experiment in ML Studio and go to the Web Service tab -> Request-Response -> Grab the URL next to POST

In Azure you can select 'App Service plan/Location' and choose a location e.g. where you end-users reside.

Click on the 'create' button at the bottom.

You can go to 'Resource groups' or 'App Services' to see the app

Click on the 'App' and click 'Browse'