Click here to Skip to main content
15,946,342 members
Articles / Artificial Intelligence / ML.Net

Introduction to Machine Learning and ML.NET - Part 1

Rate me:
Please Sign up or sign in to vote.
4.56/5 (7 votes)
16 Sep 2019CPOL13 min read 20.9K   24   4
Introduction to Machine Learning and ML.NET (Machine Learning.NET)

Introduction

Nowadays, Machine Learning is getting more popular and is been using in wide industry 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 Algorithm, it will be easier for us to select the appropriate Machine learning task and Model to develop our Machine learning application. In this chapter, we will start with:

  1. Introduction to Machine Learning
  2. Introduction to Machine Learning Types and Algorithm
  3. Why Machine Learning Is Getting More Popular
  4. Introduction to Microsoft ML.NET
  5. Features of ML.NET

Introduction to Machine Learning

Machine Learning is an application, which is a part of Artificial Intelligence (AI), Machine Learning uses 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 provide us the system predicted results. In Machine Learning for training and predicting results, we need to provide lots of data. In Machine Learning 2, magical words are mostly used they are ref:

  • 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 kids by showing the object, we can say a parent is teaching the infant for the first time by showing an apple and they will repeatedly tell the infant that this is an apple and an apple will be red in color, the shape of the apple will be like this, here the apple is the data for the kid and kid's brain is trained as the Apple will be red in color and Apple will look like this and Apple will be available in different kind of shapes and color. Once the infant brain is trained with the object, whenever an infant sees the apple object, immediately she/he will tell that it is an Apple.

Image 1

Same like training the infant for the first time by showing the object, we do train the machine with lot of data to predict and return the result for us. For training the machine, we need lots of data. By providing lot of related data to the machine, the machines will be well trained and good to predict 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 image and we can see different kinds of number 2s have been created with different fonts and also used by hand drawing. All these number 2s will be given to the machines by data and trained the machines to predict the result.

Image 2

Again, you all will be wondering about training and how we can train the machines, for this in Machine learning, we have Machine learning Task and Algorithms, as we already know as for Machine learning, we have no need to write any program explicitly, as we will be using the machine learning algorithm to predict the results. Now we will see about few Machine Learning types 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.

Image 3

Introduction to Machine Learning Types and Algorithm

In Machine learning, Types and Algorithms 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 aricle is focused to use the Machine learning for the Supervised Learning Type and Unsupervised Learning, we will be seeing in detail about 2 major types of Machine Learning as:

  • Supervised Learning
  • Unsupervised Learning

We will be seeing Supervised and Unsupervised Machine learning types and Algorithm with examples.

Image 4

From the above diagram, we can see few of the Machine learning Types and algorithms with examples as in which kind of application each Machine learning types and algorithm can be used. In this article, we will be using Supervised Learning with Regression and Classification model and Unsupervised type with Clustering model. Now let’s see in detail about each Machine learning type and algorithm.

Supervised Learning

In Supervised learning, the computer will get the labelled 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.

Image 5

In the above image, we can understand the housing information for three different types of house as Single house, Villa type and Apartment type with number of room information, this is all not the exact price of the house in the particular city, it’s all sample housing type and prices for easy understanding 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, Number 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 user search. When we search for the house, we will be giving the input as the City Name, Area Name, Number of Rooms we need, Which type of house we preferred and what budget we are looking for the house, Here, the budget is the key keyword for our search and the output we will be looking in our search will be as the house rent of the searched result. Here, for the Machine learning Supervised Type and regression model, we will be giving the house rent as the labelled input. We train the machine with all the inputs and labelled input. After training, the Machine will predict the result using the regression algorithm and produce the predicted result for us as the house rent.

If a user searches for a house rent with 3 rooms, Apartment type house in Maura city and in Annanagar area, with all the data given to the machine, the machine will predict the result and display the approximate output as 15000. In Machine Learning, we need to give 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 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. 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 city and want to find the cluster of our product in this case, we can use the Unsupervised Learning using clustering model.

Why Machine Learning Is Getting More Popular?

Nowadays, Machine learning is widely used in our day to day life, in lots of industries, in research fields, in science, etc. Machine Learning is also used to automate the systems example like we can say the Mail spam detection and fraud detection. Machine Learning in our day today life, we can say the Facebook news feed as an example, we can see in our Facebook wall as we will be seeing all the news feed related to our frequently or recently visiting friends post. Facebook is using machine learning concept for the news feed. Machine learning is also used in wide industries today like Manufacturing, Healthcare, Financial services, Travel, Retail, etc. 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 in all the four sides depending on the objects the car speed will be controlled and also using the navigation the self-driving cars will be 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 now widely used in research and medical field example like to predict the viral failure in AIDS, Parkinson disease progression prediction, Smart Farming, Bio Technology for Drug development, medical therapy, used in cosmological maps, etc.

In the future, Machine learning will be used widely in all the fields and it will be getting more popular than it is today.

We have seen how and why the Machine learning is getting more popular nowadays and Microsoft also has introduced a new Framework called as ML.NET in the month of March 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 details about ML.NET in our upcoming chapters.

Introduction to Microsoft ML.NET

Microsoft introduced ML.NET (Machine Learning.NET) during Build 2018 (March). The current version of ML.NET is ML.NET preview 1.4 which was released in 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's 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 developed 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 supports to load and train data from Relational databases like SQL Server, Oracle, MySQL, etc. The latest version of ML.NET was also established to develop easy custom ML using AutoML.

Presently, Microsoft has released the preview version of the ML.NET and Microsoft keeps on adding more features to the ML.NET framework, the present version of ML.NET is ML.NET 1.4 .

Before getting started with the ML.NET, let's 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 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, etc.)), Binary, IEnumerable, etc.
  • Train: We need to select the right algorithm to train the model depending on our needs, 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 you 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 integrated with our other .NET applications.

Image 6

The above picture explains the flow of process which will be used to develop 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 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.
  • ML.NET is cross-platform and an open source framework.
  • ML.NET can be developed 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.
  • ML.NET supports to develop Machine Learning apps for web, mobile, desktop, gaming and IOT.
  • ML.NET saves the trained model as a binary file and it can be integrated into any other DotNet applications.
  • ML.NET is now in preview version and Microsoft is frequently adding many new features and also planned to add the Deep Learning with TensorFlow and CNTK.
  • ML.NET preview version 0.2 introduced the new Machine learning Clustering Tasks.
  • ML.NET preview version 0.5 added a TensorFlow model scoring transform.
  • ML.NET preview version 0.6 added the 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.
  • ML.NET preview version 0.7 supports in experimental Python bindings for ML.NET called NimbusML.
  • ML.NET preview version 0.7 enabled anomaly detection scenarios.
  • ML.NET preview version 0.9 was added with few of ML.NET API improvements.
  • ML.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
  • ML.NET 1.1 has been released with improved support for In-Memory Image type in IDataView also added a new algorithm Anomaly Detection algorithm.
  • ML.NET 1.2 has released with support to integrate ML.NET models in web or serverless apps with Microsoft.Extensions.ML integration package
  • ML.NET preview version 1.4 Database loader which made it easy to train using the relational database.

Reference Links

Points of Interest

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

History

  • 2019/09/14: Initial release

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Team Leader
India India
Microsoft MVP | Code Project MVP | CSharp Corner MVP | Author | Blogger and always happy to Share what he knows to others. MyBlog

My Interview on Microsoft TechNet Wiki Ninja Link

Comments and Discussions

 
QuestionHow do you consume this in .Net 4.5 application? Pin
krravi17-Feb-20 10:13
krravi17-Feb-20 10:13 
Praise5 * Pin
Twiggy Ramirezz30-Sep-19 16:26
Twiggy Ramirezz30-Sep-19 16:26 
QuestionML.Net is awesome but is missing some important key features Pin
Mario M.16-Sep-19 19:57
Mario M.16-Sep-19 19:57 
Questionbook ? Pin
Mark7Quest16-Sep-19 1:18
Mark7Quest16-Sep-19 1:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.