Azure Machine Learning - Classification Predictive Analysis Using Iris Dataset

Machine Learning (ML) and Artificial Intelligence (AI) are the most difficult domains in terms of developing and implementing. There are a lot of pre and post processes involved while implementing a machine learning based solution to solve even the simplest problem.

In general, machine learning implementation involves the following steps.

  1. Preparation of dataset samples.
  2. Analysis of dataset samples.
  3. Training the system with dataset samples.
  4. Evaluating the resultant dataset outcome to measure the accuracy of the solution.

The above four steps seem very simple in theory, however, when you try to implement these, a lot of resources and limitations catch your attention to achieve the desired outcome. This is, however, the part where we are simply trying to implement our solution to achieve the desired accuracy and we have not even yet touched the application part of what our solution is capable of offering.

In other words, machine learning solutions, in general, take almost 90% of our efforts and focus to improve our solution's accuracy, while the remaining 10% may or may not work towards application implementation. So, Machine Learning domain is a resource as well as time-consuming though very satisfying, since both, machine learning and artificial intelligence, are the only domains that are capable of solving problems beyond our imagination.

Taking these revolutionary domains in account, Microsoft introduced Microsoft Azure platform and took away most of the development and implementation headache associated with these, leaving researchers, developers, and enterprises focus on the main goal rather than be exhaustive over hows of the implementation processes.

So, in today's tutorial, I shall be demonstrating the classical classification predictive analysis problem using iris dataset in Microsoft Azure Machine Learning Studio. I will be focusing on the simplicity that Microsoft Azure Machine Learning Studio has offered while implementing my solution in few minutes with a few clicks. There is not a single line of code involved here and just like that, in a few clicks, my entire solution for classification predictive analysis problem will be implemented.

I will be posting a separate tutorial which will focus on the application development of this machine learning model based on Iris dataset. So, stay tuned.

As I have mentioned that I am using Iris dataset, you can download it via its official repository at UCI Machine Learning Repository or from the attachment in this tutorial. I would suggest downloading Iris data from this tutorial as I have made a few changes in the original Iris dataset i.e. introducing a new numeric column that represents the types of Iris classes.

Following are some prerequisites before you proceed further in this tutorial.

Prerequisite

  1. Knowledge of Iris dataset.
  2. Basic understanding of machine learning concept.

Let's begin the fun.

1) Create an account at Microsoft Azure Machine Learning Studio if you do not already have.

2) Click on Datasets >> New, as shown in the snippet.

3) Now, upload the Iris dataset as provided in this tutorial.

You will see that your Iris dataset is now in the Microsoft Azure Machine Learning Studio.

4) Click on Experiments >> New.

5) Now, click on "Blank Experiment" as shown below.

6) Rename your Experiment window to "Iris Dataset Azure ML".

7) Creating machine learning model in Microsoft Azure Machine Learning Studio is just a matter of clicks. So, type Iris on the left side "search experiment items" search box.

In the above snippet, you will see that Iris dataset is also provided by Microsoft Azure Machine Learning Studio as well, which contains only two classes, while classic Iris dataset contains three classes.

8) Drag the "iris.csv" dataset into your Experiment window as shown below.

9) Right-click on the "iris.csv" module on the Experiment window and then, click "Visualize" as shown below.

You will be able to see your dataset inside the Microsoft Azure Machine Learning Studio.

10) Now, type "split" in the search box and drag the "Split Data" module into your Experiment window. Also, connect the "iris.csv" module with the "Split Data" module by simply dragging; then set the "Fraction of rows in the first output dataset" value to "0.75".

We have used the "Split Data" module to separate our training data from our test data in the provided dataset, so, we can measure the accuracy of our Machine learning model, i.e., we take 75% data as training data and remaining 25% data will be treated as test data.

11) Now, let's add the machine learning algorithm to our Experiment. So, type "multiclass" in the search box and drag "Multiclass Neural Network" module into your Experiment window and leave the properties in the Property window as it is.

You can experiment with any multiclass classification module as provided in Microsoft Azure Machine Learning Studio or you can import your own multiclass algorithm into the Microsoft Azure Machine Learning Studio.

12) Now, type "train model" in the search box and drag the "Train Model" module into the Experiment window. Connect the "Multiclass Neural Network" module and "Split Data" module with the "Train Model" module by simply dragging, as shown below.

You will notice an error symbol on the "Train Model" module as shown in the above snippet. This is because we have not told our training model to train on which feature (column) of our dataset which is our predictive feature (column). So, click on the "Launch column selector" and then choose "class-type" column.

13) Now, click on "Run" to see whether our Experiment has any error or not so far.

You will see a green tick icon on each module, which signifies that there is no error.

14) Now, type the "score model" in the search box and drag the "Score Model" module in the Experiment window and connect the "Train Model" module and "Split Data" module to the "Score Model".

Remember that in step 10, I have mentioned that we use "Split Data" module to separate our training data and experimental data in order to measure the accuracy of our machine learning model. So, for this reason, I have connected "Train Model" module which contains 75% data as trained from our "Split Data" module as we have configured it and direct "Split Data" module which contains the remaining 25% untrained test data with the "Score Model" module which will show us the accuracy of our machine learning model.

15) Let's run the Experiment again.

16) Now, right-click the "Score Model" module and then click "Visualize".

So, in the above snippet, you will see that "Scored Labels" column, which is actually the predictive column, matched identically with the original column "class-type" of our dataset. This proves that our machine learning model is quite accurate. The probability of each class is also mentioned per instant of each sample. Also, observe here that our resultant rows are 37 in number because we have chosen 25% of our data as test data. Our dataset contains 150 total rows, which means that 37 rows will be test samples while the remaining will be the training data.

This is the beauty of Microsoft Azure Machine Learning Studio that I can simply create my machine learning model on the go and then so easily use test data from the given dataset instead of going into the hustle of first putting effort into developing & implementing my machine learning model and then worry about the test data to measure the accuracy of my machine learning model.

17) Now, type "eval" in the search box and drag the "Evaluate Model" module into the Experiment window, then connect the "Score Model" module with "Evaluate Model" module, and click the "Run" button. Then, right-click the "Evaluate Model" module and click "Visualize".

"Evaluate Model" module is to observe the statistics of our machine learning model. You can use any "Evaluate Model" module as provided by the Microsoft Azure Machine Learning Studio.

Conclusion

In this tutorial, we learned how to create a machine learning model in Microsoft Azure Machine Learning Studio, how to import our own dataset into Microsoft Azure Machine Learning Studio, different machine learning modules of Microsoft Azure Machine Learning Studio, how to measure the accuracy of our machine learning model, how to generate the evaluation statistics that our model produces, and also, how to use train data and test data from the provided dataset.

Up Next
    Ebook Download
    View all
    Learn
    View all