Skip to content

Latest commit

 

History

History
64 lines (58 loc) · 5.2 KB

01_pi_ml.md

File metadata and controls

64 lines (58 loc) · 5.2 KB

Let's set up the Azure Machine Learning Service

We want to build a predictive model. The goal for now is to predict from the collected temperature and humidity data whether or not it is going to rain. In the end we want to display this information on our Sense Hat.

Showing the menue in the Azure portal with the + create button being on the very left

Create the Azure Machine Learning workspace

We will create the workspace using a terminal on our local machine. Please open it.

  1. Create a prefix for yourself consisting of four letters and in LOWERCASE. This should help us to solve any naming issues if you are working on the same subscription as other participants or service names need to be globally or regionally unique.
    Using PowerShell:

    $prefix = "<your prefix>"

    Using bash:

    prefix="<your prefix>"
  2. Let's create a resource group so we can store all services we will provide today - which will have the same lifecycle.

    az group create --name $prefix'iotpirg' --location westeurope

    Feel free to go into the Azure portal and see for yourself that the resource group has been created. Go to portal.azure.com and check under Resource groups: Screenshot of the homepage of the Azure portal, where resource groups is highlighted

  3. Download the extension for az ml

    az extension add -n azure-cli-ml -y
  4. Now we need to create the workspace:

    az ml workspace create -w $prefix'iotml' -g $prefix'iotpirg'

Create a machine learning pipeline

This time we will use the Azure portal to use the Azure Machine Learning Studio for the next steps. Go to 'portal.azure.com'. You might need to switch to an incognito tab since it will make the handeling of you using different tenants easier. Make sure you are using the right subscription.

  1. Navigate to your 'prefixiotpirg' resource group. You will see that a number of services were created. The AML workspace needs a keyvault to store its secrets, a storage for configuration, datasets and models, optionally Application Insights for monitoring and later on compute resources to run our training and model on.
  2. Select the Azure Machine Learning workspace 'prefixiotml'. On the Overview page you will see a blue Launch studio button. Select it. It will forward you to a separate view for the Azure Machine Learning workspace.
    Showing where AutoML can be found in the azure machine learning studio
  3. On the left side you will find the menue point Automated ML. Select it. We will work with the UI today but there are many options to make use of the Azure Machine Learning workspace.
    Showing where AutoML can be found in the azure machine learning studio
  4. Select New Automated ML run.
    Showing where AutoML can be found in the azure machine learning studio
  5. Start the process of creating a new data asset by selecting Create and giving it the Name weather. Leave the description blank. Showing where AutoML can be found in the azure machine learning studio
  6. Choose From web files as a source for your data asset. Showing where AutoML can be found in the azure machine learning studio
  7. Next, insert the data set Web URL https://raw.githubusercontent.com/alschroe/AzureIoTHack/main/data/weatherdata.csv. It will contain three columns, isRain - holding information whether it is raining or not (0 (yes), 1 (no)), temperature - holding the temperature in Celsius and humidity - holding the humidity. Showing where AutoML can be found in the azure machine learning studio
  8. Leave everything as is on the next tabs until you can hit Create.
  9. Now, select the data asset weather - you might need to refresh the data asset overview using the Refresh button. After selecting it, hit Next.
  10. You need to create an experiment and a compute resource on which your model will be trained. Under Experiment name select Create new and give your experiment the name predictRain. The Target column should be isRain (Int). Under Select Azure ML compute cluster hit the + New link. Leave the virtual machine specifications as is, add some name and confirm. It will take some time to create the cluster. After it has been created, select it from the dropdown and hit Next. Showing where AutoML can be found in the azure machine learning studio
  11. The Classification task type should be pre-selected. Go on View additional configuration settings. Behind the category Exit criterion you should make sure to set the Training job time (hours) to 0.5.
    Showing where AutoML can be found in the azure machine learning studio
  12. Leave the next tabs unchanged and hit Finish to start the training. This will take some time, so we will move on to the next step while the model is being trained:

Go to the next steps.