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.
We will create the workspace using a terminal on our local machine. Please open it.
-
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>"
-
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:
-
Download the extension for az ml
az extension add -n azure-cli-ml -y
-
Now we need to create the workspace:
az ml workspace create -w $prefix'iotml' -g $prefix'iotpirg'
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.
- 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.
- 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.
- 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.
- Select New Automated ML run.
- Start the process of creating a new data asset by selecting Create and giving it the Name weather. Leave the description blank.
- Choose From web files as a source for your data asset.
- 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.
- Leave everything as is on the next tabs until you can hit Create.
- Now, select the data asset weather - you might need to refresh the data asset overview using the Refresh button. After selecting it, hit Next.
- 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.
- 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.
- 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.