We are excited to announce the release of ML.NET 1.0 today. ML.NET is a free, cross-platform and open source machine learning framework designed to bring the power of machine learning (ML) into .NET applications.
https://github.com/dotnet/machinelearning
Get Started: http://dot.net/ml
ML.NET allows you to train, build and ship custom machine learning models using C# or F# for scenarios such as sentiment analysis, issue classification, forecasting, recommendations and more. You can check out these common scenarios and tasks at our ML.NET samples repo.
ML.NET was originally developed within Microsoft Research, and evolved into a significant framework used by many Microsoft products such as Windows Defender, Microsoft Office (Powerpoint design ideas, Excel Chart recommendations), Azure Machine Learning, PowerBI key influencers to name a few!
Since its launch ML.NET is being used by many organizations like SigParser (Spam Email Detection), William Mullens (Legal Issue Classification) and Evolution Software (Moisture Level Detection for Hazelnuts). You can follow the journey of these and many other organisations using ML.NET at our ML.NET customer showcase. These users tell us that the ease of use of ML.NET, ability to reuse their .NET skills and keeping their tech stack entirely in .NET are primary drivers for their use of ML.NET.
Along with the ML.NET 1.0 release we are also adding new preview features like the power of Automated machine learning (AutoML) and new tools like ML.NET CLI and ML.NET Model Builder which means adding machine learning models to your applications is now only a right click away!
The remainder of this post focuses on these new experiences.
- ML.NET Core Components
- Automated Machine Learning Preview
- ML.NET Model Builder Preview
- ML.NET CLI Preview
- Getting Started with ML.NET
- Road Ahead
- You helped build it
ML.NET Core Components
ML.NET is aimed at providing the end-end workflow for consuming ML into .NET apps across various steps of machine learning (pre-processing, feature engineering, modeling, evaluation and operationalization). ML.NET 1.0 provides the following key components:
- Data Representation
- Fundamental ML data pipeline data-types such as IDataView – the fundamental data pipeline type
- Readers to support reading data from delimited text files or IEnumerable of objects
- Support for machine learning tasks:
- Binary Classification
- Multi-Class classification
- Regression
- Ranking
- Anomaly Detection
- Clustering
- Recommendation (preview)
- Data Transformation and featurization
- Text
- Categories
- Feature Selection
- Normalization and missing value handling
- Image featurization
- Time Series (preview)
- Support for ONNX and TensorFlow model integration (preview)
- Other
- Model understanding and explainability
- User-defined custom transformations
- Schema operations
- Support for dataset manipulation and cross-validation
Automated Machine Learning Preview
Getting started with machine learning today involves a steep learning curve. When building custom machine learning models, you have to figure out which machine learning task to pick for your scenario (i.e. classification or regression?), transform your data into a format that ML algorithms can understand (e.g. textual data -> numeric vectors), and fine tune these ML algorithms to provide best performance. If you are new to ML each of these steps can be quite daunting!
Automated Machine Learning makes your journey with ML simpler by automatically figuring out how to transform your input data and selecting the best performing ML algorithm with the right settings allowing you to build best-in-class custom ML models easily.
AutoML support in ML.NET is in preview and we currently support Regression (used for scenarios like Price Prediction) and Classification (used for scenarios like Sentiment Analysis, Document Classification, Spam Detection etc.) ML tasks.
You can try out the AutoML experience in ML.NET in three form factors using ML.NET Model Builder, ML.NET CLI or by using the AutoML API directly (samples can be found here).
For users who are new to Machine Learning we recommend starting with the ML.NET Model Builder in Visual Studio and the ML.NET CLI on any platform. The AutoML API is also very handy for scenarios where you want to build models on the fly.
Model Builder Preview
In order to simplify the journey of .NET developers to build ML Models, we are today also excited to announce ML.NET Model Builder. With ML.NET Model builder adding machine learning to your apps is only a right-click away!
Model Builder is a simple UI tool for developers which uses AutoML to build best in class ML models using the dataset you provide. In addition to this, Model Builder also generates model training and model consumption code for the best performing model allowing you to quickly add ML to your existing application.
Learn more about the ML.NET Model Builder
Model Builder is currently in preview and we would love for you to try it out and tell us what you think!
ML.NET CLI Preview
The ML.NET CLI (command-line interface) is another new tool we are introducing today!
ML.NET CLI is a dotnet tool which allows for generating ML.NET Models using AutoML and ML.NET. The ML.NET CLI quickly iterates through your dataset for a specific ML Task (currently supports regression and classification) and produces the best model.
The CLI in addition to producing the best model also allows users to generate model training and model consumption code for the best performing model.
ML.NET CLI is cross-platform and is an easy add-on to the .NET CLI. The Model Builder Visual Studio extension also uses ML.NET CLI to provide model builder capabilities.
You can install the ML.NET CLI through this command.
dotnet tool install -g mlnet
Following picture shows the ML.NET CLI building a sentiment analysis dataset.
Learn more about the ML.NET CLI
ML.NET CLI is also currently in preview and we would love for you to try it out and share your thoughts below!
Get Started!
If you haven’t already, getting started with ML.NET is easy and you can do so in a few simple steps as shown below. The example below shows how you can perform sentiment analysis with ML.NET.
//Step 1. Create a ML Context
var ctx = new MLContext();
//Step 2. Read in the input data for model training
IDataView dataReader = ctx.Data
.LoadFromTextFile<MyInput>(dataPath, hasHeader: true);
//Step 3. Build your estimator
IEstimator<ITransformer> est = ctx.Transforms.Text
.FeaturizeText("Features", nameof(SentimentIssue.Text))
.Append(ctx.BinaryClassification.Trainers
.LbfgsLogisticRegression("Label", "Features"));
//Step 4. Train your Model
ITransformer trainedModel = est.Fit(dataReader);
//Step 5. Make predictions using your model
var predictionEngine = ctx.Model
.CreatePredictionEngine<MyInput, MyOutput>(trainedModel);
var sampleStatement = new MyInput { Text = "This is a horrible movie" };
var prediction = predictionEngine.Predict(sampleStatement);
You can also explore various other learning resources like tutorials and resources for ML.NET along with ML.NET samples demonstrating popular scenarios like product recommendation, anomaly detection and more in action.
What’s next with ML.NET
While we are very excited to release ML.NET 1.0 today, the team is already hard at work towards enabling the following features for ML.NET release post 1.0.
- AutoML experience for additional ML scenarios
- Improved support for deep learning scenarios
- Support for other additional sources like SQL Server, CosmosDB, Azure Blob storage and more.
- Scale-out on Azure for model training and consumption
- Support for additional ML scenarios and features when using Model Builder and CLI
- Native integration for machine learning at scale with .NET for Apache Spark and ML.NET
- New ML Types in .NET e.g. DataFrame