Introduction To Machine Learning And ML.NET - Part One

In this article, you will learn about Machine Learning and ML.NET.

Introduction to Machine Learning and ML.NET

 
Nowadays, Machine Learning is getting more popular and is used in a wide range of industries, as well as in our day to day life.  In this article, we will be learning how to develop Machine learning Applications using Microsoft ML.NET (Machine Learning .NET).  If we have a basic knowledge of Machine learning, Machine Learning Types, and Algorithms, it will be easier for us to select appropriate Machine learning tasks and models, to develop our machine learning application.  For this, in this chapter, we will start with:
  1. Introductions to Machine Learning
  2. Introduction to Machine Learning Types and Algorithm
  3. Why Machine Learning getting more popular
  4. Introduction to Microsoft ML.NET
  5. Features of ML.NET

Introductions to Machine Learning

 
Machine Learning is an application, which is a part of Artificial Intelligence (AI).  Machine Learning uses the algorithm and statistical techniques to train the systems, by themselves, without using any explicit programs.  Machine Learning is used to train the systems automatically, by themselves, and provides us  with the system predicted results.  In Machine Learning, for training and predicting results, we need to provide lots of data.  In Machine Learning, two magical words are mostly used, they are"
  • Training
  • Data
To understand about training and data, let’s see our real life example.  When a new baby is born, parents, teachers, and neighbors will start teaching the child by showing it an object.  We can say a parent is teaching the infant, for the first time, by showing an Apple.  They will repeatedly tell the infant that this is an apple and apples will be red in color, and that the shape of the apple will be like this.  Here, the apple is the data for the kid and the kids brain is trained that the Apple will be red in color and the Apple will  look like this and Apple will be available in different kind of shapes and color.  Once the infant's brain is trained with the object, whenever an infant sees the apple object immediately they will know it is an Apple.
 
Introduction To Machine Learning And ML.NET
 
Same as training the infant for the first time by showing the object, we do train the machine with a lot of data to predict and return the result for us.  For training the machine, we need lots of data.  By providing a lot of related data to the machine, the machines will be well trained and good at predicting the accurate results for us.  We can see the below image as an example for the data.  here, for example, let’s consider we train the machines to predict the number and display the result.  Here, we have used the data as an image and we can see different kinds of no. 2. They have been created with different font and also used by hand drawing.  All thi number 2's will be given to the machines by data and train the machines to predict the result.
 
Introduction To Machine Learning And ML.NET
 
Again, you all will be wondering about training and how can we train the machines?  For this, in Machine learning we have Machine learning Task and Algorithms,  As we already know, for Machine learning we do not need to write any program explicitly, as we will be using the machine learning algorithm to predict the results. Now, we will see a few Machine Learning type and Algorithms.
 
Machine Learning Process
 
In the below image we can see the Machine learning process has been explained, as first we give the data to the system and then we select the appropriate Machine Learning Model to train the system.  After the training is completed, the machine is ready to predict the results and show the output to the outside world.
 
Introduction To Machine Learning And ML.NET
 

Introduction to Machine Learning Types and Algorithm

 
In Machine learning, Types and Algorithm are very important.  If we want to develop a Machine learning application, then we should understand what are Machine learning Types and which type and algorithm should be selected for our applications to train and predict the results.  This article is focused on using the Machine learning for the Supervised Learning Type and Unsupervised Learning.  We will be using, in detail, 2 major types of Machine Learning 
  • Supervised Learning
  • Unsupervised Learning
We will be seeing Supervised and Unsupervised Machine learning types and Algorithm, with example.
 
Introduction To Machine Learning And ML.NET
 
From the above diagram we can see a few of the Machine learning Types and algorithm, with examples, as in which kind of application each Machine learning types and algorithm can be used.  In this article we will using Supervised Learning with Regression and Classification model and Unsupervised type with Clustering model.  Now, let’s see in detail of each Machine learning type and algorithm.
 
Supervised Learning
 
In the Supervised learning, the computer will get the labeled input and the desired output.  First, we will see an example for using the Regression model for the Housing price prediction per city, for this we will be giving all the house details for the particular City with City Name, Area Name, House Type, Floor details, No. of Rooms and House Rent.
 
Introduction To Machine Learning And ML.NET
 
In the above image, we can understand the housing information for three different types of house.  A Single house, Villa type, and Apartment type with no of room information.  These are not the exact price of the house, in the particular city, it’s all sample housing types and prices, for easy understand of the concepts.  As from the above image, we can easily understand the current housing price for the particular area in that city.  All this information of City Name, Area Name, House Type, Floor details, No. of Rooms and House Rent information for all the houses, in that city, will be given as the input to the machine to predict the housing rent for the user search.  When we search for the house we will be giving the input as the City Name, Area Name ,No. of Rooms we need, which type of house we prefer and what budget we are looking for in the house.  Here, the budget is the key keyword for our search and the output we will be looking at in our search will be the house rent, of the searched result.  Here, the Machine learning Supervised Type and regression model we will be giving the house rent as the labeled input.  We train the machine with all the inputs and labeled input.  After, training Machine will predict the result using the regression algorithm and produce the predicted result for us, as the house rent.
 
If a user search for a house rent with 3 rooms, Apartment type house in Madurai city and in Annanagar area, with all the data given to the machine the machine will predict the result and machine will display the approximate output as 15000.  In Machine Learning, we need to give a lot of data.
 
In Supervised learning, one more model will be used as the Classification model.  Classification model will be used for Mail spam detection and for sentiment predictions.
 
Unsupervised Learning
 
In the Unsupervised Learning, the computer will get the input without the desired output.  The main aim of this model is to find the structure, in the inputs.
 
In Unsupervised learning, we have the Clustering model.  The Clustering model can be used to find the Cluster of the Customer segmentation of our products.  We can say, an example as Customer Segmentation for our product sales.  Let’s consider we have “ABC”, XYZ” and “123” as three different products and the products we do sales in the four major city in Delhi, Mumbai, Kolkata and in Chennai.  We group all the sales history of our three products, for the four cities, and want to find the cluster of our product, in this case we can use the Unsupervised Learning using clustering model.
 

Why is Machine Learning getting more popular?

 
Nowadays, Machine learning is widely used in our day to day life, in lots of industries, in research fields, In Science, and so on.  Machine Learning is also used to automate the systems example, like the Mail spam detection and fraud detection.  Machine Learning is used in our day today life.  The Facebook news feed, is an example, we can see on our Facebook wall the news feeds related to our frequently or recently visited friends post.  Facebook is using machine learning concept for the news feed.  Machine learning is also used in many industries today like Manufacturing, Healthcare, Financial services, Travel, Retail, and more.  Machine learning is also used to make driverless cars (i.e. self-driving cars).  In self-driving cars, Sensors are used to identify the objects coming closer, on all the four sides.  Depending on the objects the car speed will be controlled and also using the navigation the self-driving cars will reach the destination.  In the navigation, all the information will be stored as traffic place and present traffic signal.  For the Self-driving car, Machine learning concepts Reinforcement learning type will be used.  Machine learning is also widely used in research and medical fields.  For example,  to predict the viral failure in AIDS, Parkinson disease progression prediction, Smart Farming, Bio Technology for Drug development, medical therapy, and it is also used in cosmological maps and much more.
 
In the future, the Machine learning will be used widely in all the fields and it will be getting more popular then today.
 
We have seen how and why the Machine learning is getting more popular and Microsoft also has introduced a new Framework called as ML.NET in the march month during Build 2018.ML.NET stands for the Machine Learning.Net, which is used to develop the Machine Learning applications using .Net.  We will be seeing more detail about ML.NET in our upcoming chapters.
 

Introduction to Microsoft ML.NET

 
Microsoft interduce ML.NET (Machine Learning.NET) during Build 2018(March).  The current version of ML.NET is ML.NET preview 1.4 which was released September 2019. Machine Learning.Net is a framework which is a cross-platform and open source.  Yes, now it’s easy to develop our own Machine Learning application or develop custom modules, using Machine Learning framework.  For all the .NET lovers, it is great news, as we can use C# or F# code to develop Machine Learning, using the ML.NET.ML.NET is open source and can be develop and run on Windows, Linux and macOS.  We can develop custom machine learning models using ML.NET for Console, desktop, web, mobile, gaming and for the IOT.M L.NET also supports to extend and work with TensorFlow, Accord.NET and CNTK.  The latest release of ML.NET also support to load and train data from Relational database, like SQL Server, Oracle, MySQL and etc.. The latest version of ML.NET also was established to develop easy custom ML using AutoML.
 
Before getting started with the ML.NET, lets understand the basic concept of the ML.NET which needs to be used to develop our Machine learning applications.
 
Load Data
 
For the perfect prediction of results, we need to give a lot of data to train the model.  In ML.Net we can give the data for both train and test by Text (CSV/TSV, Relational Database (Now support SQL Server, Oracle, MySQL and etc.)), Binary, IEnumerable and etc.
 
Train
 
We need to select the right algorithm to train the model. depending on our need, we need to pick the correct algorithm to train and predict the results.
 
Evaluate
 
Select the Machine learning type for our model training and prediction.  If you need to work with segment then you can select the Clustering model, if you need to find the price of stock prediction you can select the Regression and if you need to find the sentiment analysis then can select the Classification model.
 
Predicted Results
 
Based on the train and test data with trained model the final prediction will be displayed using the ML.NET application.  Trained model will be saved as the binary format which can also be integrate with our other .NET applications.
 
Introduction To Machine Learning And ML.NET
 
The above picture explains the flow of process, which we will be used to develop of our machine learning applications, using the ML.NET.  Next, we will see more in detail about ML.NET components
 

Features of ML.NET

 
Now let’s see some of the uses and features of the Microsoft ML.NET.
  • All the DotNet lovers can write their code for Machine Learning using ML.NET
  • You can use C# or F# to code with ML.NET
  • NET is cross-platform and open source framework.
  • NET can be develop and run on Windows, Linux and macOS
  • Extensively used across Microsoft Windows, Bing, Azure and also Extensible to other frameworks like TensorFlow, CNTK and Accord.NET.
  • NET supports to develop Machine Learning apps for web, mobile, desktop, gaming and IOT.
  • NET saves the trained model as a binary file and it can be integrated into any other DotNet applications.
  • NET is now in preview version and Microsoft frequently adding many new features and also planned to add the Deep Learning with TensorFlow and CNTK
  • NET preview version 0.2 introduced the new Machine learning Clustering Tasks.
  • NET preview version 0.5 Added a TensorFlow model scoring transform
  • NET preview version 0.6 added ability to score pre-trained ONNX models.
  • Now from the ML.NET 0.7 version it supports both x86 and x64.ML.NET is in preview version now and Microsoft is frequently updating the version by adding more features to ML.NET. The Previous versions of ML.NET 0.7 only support to develop for x64 but from the new ML.NET 0.7 version supports to develop for both x86 and x64.
  • NET preview version 0.7 supports in experimental Python bindings for ML.NET called NimbusML.
  • NET preview version 0.7 enabled anomaly detection scenarios.
  • NET preview version 0.9 was added with few of ML.NET API improvements.
  • NET 1.0 has been added with Automated machine learning (AutoML) and introduced some more new tools like ML.NET CLI and ML.NET Model Builder
  • NET 1.1 has been released with improved support for In-Memory Image type in IDataView also added a new algorithm Anomaly Detection algorithm.
  • NET 1.2 has released with support to integrate ML.NET models in web or serverless apps with Microsoft.Extensions.ML integration package
  • NET preview version 1.4 Database loader which made easy to train using the relational database.

Conclusion

 
ML.NET preview 1.4 is the current released vision of today (Sep 2019).  Microsoft keeps updating ML.Net by, adding more features ,so always check for the latest update and wait till the complete ML.NET version is published.  In our next part, we will learn more on woking with ML.NET for each model and Algorithm with the latest release version and features.  Hope you all understand what Machine Learning and ML.NET is, from this part 1.  In our next part, we will be looking deeply into Getting started with ML.NET.