Predict the weather of Tokyo using Azure Machine Learning
This is first on this topic regarding Azure Machine Learning.
Without taking accuracy into consideration, I have never would have thought of trying to develop a weather forecasting system. With Azure Machine Learning, you can do it with ease.
Anyway, let me show you the results first.
Below is the past actual weather from Yahoo Japan on May 14 2016. The result is sunny.
And here is what I have been predicted by Azure Machine Learing (hereafter AzureML)
As you can see, it has predicted that with 60.94% probability that it will be sunny.
Let’s try another date. The result for May 10 2016 was cloudy.
and Azure ML predicted with 78.13% probability of being cloudy.
The weather for May 11 2016 was cloudy,
but predicted sunny in Azure ML… Close!
Anyway, it does show that it will not be always be correct, I do think it is amazing that you can create your own weather predictions.
How it works
This prediction is based from the Japanese Met office with weather data of Tokyo from 1989 through to April 2016.
They provide the website to download the data as CSV but only 2 years at a time… Took a while to get them all…
Anyway, you can download the csv from here instead for what I used.
Based on this data, Azure Machine Learning was trained with highest temperature, lowest temperature, humidity and precipitation amount.
How to create it
First start up Azure Machine Learning Studio.
Click on “New”
And select “Dataset”
Here, choose the downloaded weather data. Let’s name it Tokyo Weather
Now we are prepared with data. Click on “New” and choose “Experiment”
Click on “Saved Dateset” at the left, and choose “Tokyo Weather”. You will see that “Tokyo Weather” is shown as you drag and drop.
Next, we’ll choose the columns as we don’ t need all of it.
Click on “Select Columns in Dataset” inside “Data Transformation”, “Manipulation” category.
The columns aren’t selected yet so click on “Launch column selector”.
Next, split the data so that one set is used to train the model, and other to score it.
To do so, add “Split Data” inside “Data Transformation”, “Sample and Split” category.
If you click on “Split Data”, you can change the fraction of rows to be assigned for training later on. By default it’s 0.5, but let’s change this to 0.7 since higher this number, more data will be used for training the model. Remainder will be used for scoring.
You can see that there are two circles in the buttom of Split Data. Left is the data with 0.7 of the rows assigned, and right is the remaining 0.3 of the rows.
Next, from “Initialize Model”, “Classification”, select “Multiclass Decision Forest”. This is the model we will use for prediction.
Next, connect the model to “Train Model”. By doing so, the data from Split data is now trained with “Multiclass Decision Forest” model.
Train Model has a red notification. This is because nothing has been selected on what columns to predict on.
Click on “Launch column selector”
And choose the column to predict.
Now link “Train Model” with “Score Model”. “Score Model” actually scores each set of data with a prediction along with variances.
Next, link “Evaluate Model” with “Score Model”
This will calculate the accuracy and other statistics on the results compared with prediction.
Click on “RUN” at the bottom of the screen.
Once run, the boxes at each step will have a green tick mark.
This is already machine learnt.You can right-click on “Score Model” and choose “Visualize”
You see that each of the rows now have a new set of columns with scored probabilities.
The actual results from CSV is still on the left, and the predictions are in the column “Scored Labels”
Next, lets check for accuracy. Right click on “Evaluate Model” and click “Visualize”
“Confusion Matrix” allows you to compare in a matrix format on how accurate each category was predicted.
Lets look at sunny day. There is 83.5% accuracy that Sunny was predicted and remaining 16.3% was predicted cloudy. 0.2% predicted as rainy.
It looks like foggy days are the hardest for the AzureML to categorize.
Next we will deploy the web service.
By doing so will allow you to see the prediction results from other websites and applications.
Click on the “Deploy Web Service”
Run the experiment again, and now we are ready to publish so click on publish.
Once published, you will see that API keys and other information on how to connect etc is shown. This time we will use the Excel 2013 link.
Click on “Excel 2013 or later”. A prompt is shown but dont worry.
Now lets open up the Excel. You may receive a security notice, but just continue editing.
You will now see the “Azure Machine Learning” addon.
Click on “Tokyo Weather [Predictive Exp.]”.
Click on “Use sample data”
There will be five rows with another row for the header but just make it two rows for the sake of simplicity.
Next, choose the input cells which is actually the sample rows we just setup.
Now choose wherever you want the output.
Click on “Predict” and you’re done!
Leave a Reply