Overview of ML.NET

November 30, 2020

ML.Net is an open source and cross-platform framework created by Microsoft that utilizes Machine Learning to give the user the ability to effortlessly manipulate data in their own volition. Using the available model creation, data can be transformed into a prediction in seconds. ML.NET runs on Windows, Linux, and macOS using .NET Core, or Windows using .NET Framework. 64 bit is supported on all platforms. 32 bit is supported on Windows, except for TensorFlow, LightGBM, and ONNX-related functionality. You can learn more here.

Get started

Download the latest version of Visual Studio here. Visual Studio Community edition is free. If you already have Visual Studio installed, you might need to update to the latest version.

Open the Visual Studio Installer. If you already have Visual Studio installed, navigate to the right of the installation, click More and then Modify.

Now you have the installation window in front of you. At your right, click the Individual Components dropdown and check the ML.NET Model Builder (Preview) checkbox. If this is a fresh install of Visual Studio, now is the time to install every component you like.

When you are done, click Modify or Install at the bottom right. Wait for everithing to install and open Visual Studio. Create a New Project and select Console App (.NET Framework).

Create the new project and name it whatever you like. Navigate ti the Solution Explorer, right click on your project, Add and click Machine Learning.

Now you are ready to start developing with Machine Learning on .NET framework.

Let’s do an example!

These are all the scenarios you can choose from. Learn more about the ML.NET Model Builder here.

Select the Text classification scenario.

Select your Local CPU environment as your training environment. This means that all the training will happen locally on your computer.

Now it is time to input your data. There are many datasets you can use from these samples. For now we will use this one. Copy it to your computer and save is as .tsv. In the Input field select File and give the .tsv file you just created. For the Column to predict field select the Label column.

Now its time to start training. The longer you train your model, the better are the results. by default it trains for 600 seconds (10 minutes). You can change the training time if you like. When you are ready, click Start training and wait for training to finish.

This is what you will see after the training is complete.

Here you can evaluate your model. It is populated by the first row as default. You can erase that and enter the comment you want evaluated in the comment field.

My comment was “hello” and the model predicted that is a non toxic comment with 95% accuracy, which is correct!

Next you need to Consume the model. This intergrades the model to your solution, so you can continue with your project.

Click Add to solution and you are done!


ML.NET provides many differnet ways to implement Machine Learning to your project. Apart from the many different scenarios it also is extensible to consume other frameworks like TensorFlow, ONNX and Infer.NET to give you access to even more machine learning scenarios, like image classification, object detection and more. Let us take a look!

Binary Classification

Like in the example above, sentiment analysis returns weather a sentiment has a positive or negative intention. This is a from of binary classification, which can also be used to:

  • predict if an insurance claim is valid or not.
  • predict if a plane will be delayed or will arrive on time.
  • predict if a face ID (photo) belongs to the owner of a device.


Clustering splits data into groups. Each cluster includes records that share some common attributes. You can find a customer segmentation example here. It is classifying customers into categories with similar profile and interests using the K-Means algorithm.

Anomaly Detection

Detects anomalies and spikes in large datasets. Ingesting sales of a product is useful when building a business strategy and this provides a much better understanding of the given data. Here is a sample of Spike Detection and Change Point Detection of Product Sales.

Matrix Factorization

Matrix factorization is usually used for product recomendation in online shops. It consumes the sales data and it can recommend products that are bought together to the customer based upon their purchase order history. Here is a sample applying this to Amazon.

Object Detection

Object detection helps you recognize what objects are inside a given image and informs you about their position in that certain image. You can have a look at a sample here.


Scores the images to help us do image classification. Gives a prediction to what an image is represinting. Here is a sample that applies image classification.

Price Prediction

Predicts price of an item or a service based on various collected data. In this sample it predicts taxi fares based on trip time, distance, passinger count and more.

Sales Forecasting

Helps you find the futures sales of a certain product using a regression algorithm based on a past sales dataset. Here is a sales forecasting sample using FastTreeTweedie Regression algorithm and Single Spectrum Analysis (SSA) time series for forecasting.

About Me

Hi, my name is Demetris Bakas and I am a software engineer that loves to write code and be creative. I always find new technologies intriguing and I like to work with other people and be a part of a team. My goal is to develop software that people will find useful and will aid them in their everyday lives.
For any questions feel free to contact me at social media using the links below.