top of page

Introduction to ML.NET

  • Writer: Deniz Ekiz
    Deniz Ekiz
  • Nov 3, 2022
  • 2 min read

Updated: Jan 5, 2023


ree

What is ML.NET ?

It is a .NET-based, open source machine learning framework that allows us to train, compile, save and run models for different types of machine learning problems by integrating the saved models into our application. It can be run on different platforms such as Windows, Linux and MacOS.



ree

ML.NET Context

MLContext is the structure that allows us to create components that are used to perform operations such as feature specification, training, prediction, model evaluation.


With MLContext;

  • Data can be loaded, converted,

  • Machine learning algorithm can be selected,

  • Models can be trained, saved and reused.

Data Upload

By loading the data to be analyzed;assigned to an IDataView object.Different format data like Csv, Txt, Json and Databases can be assigned to IDataView object.


The model to be developed for the classification problem;separating data for training and testing;are assigned to an IDataView object.


ree


Data Transformation

The data to be analyzed must be converted into an appropriate format before training.

  • Removing missing or incorrectly formatted data,

  • Transforming the data using features suitable for the desired output,

operations like these are handled by the MLContext's Transforms property.


ree


Decide the Algorithm

The machine learning algorithm(Classification, Clustering, Regression etc.) that is most suitable for the type of problem is determined.


The algorithm is selected using the Trainers structure in the MLContext.

ree

ree


Train the Model

The model whose inputs are determined; is the stage of obtaining the outputs by training.


The Fit() method is used for this operation. It takes the training dataset as a variable. The trained model is obtained as output.

ree

Evaluation of the Model

The model created with the data reserved for training is evaluated with the data reserved for the test.


For this process, Evaluate() method is used in MLContext. It takes the test dataset as a variable.The output is a metrics object containing the accuracy rates.

ree

ree


Saving and Loading the Model

The models that have been trained and have achieved the expected results in the tests can be saved and used without the need for retraining.


In this way, it is possible to integrate models into different applications.

ree

ree


 
 
 

Comments


bottom of page