On Monday, .NET engineering team announced the latest monthly release of their cross-platform, open source machine learning framework for .NET developers, ML.NET 0.6.
Some of the exciting features in this release include new API for building and using machine learning models, performance improvements, and much more.
Improvements in the ML.NET 0.6
A new LearningPipeline API for building ML model
The new API is more flexible and enables new tasks and code workflow that weren’t possible with the previous LearningPipeline API. The team further plans to deprecate the current LearningPipeline API.
This new API is designed to support a wider set of scenarios. It closely follows ML principles and naming from other popular ML related frameworks like Apache Spark and Scikit-Learn.
Know more about the new ML.NET API, visit the Microsoft blog.
Ability to get predictions from pre-trained ONNX Models
ML.NET 0.6 includes support for getting predictions from ONNX models. This is done by using a new transformer and runtime for scoring ONNX models.
There are a large variety of ONNX models created and trained in multiple frameworks that can export models to ONNX format. Those models can be used for tasks like image classification, emotion recognition, and object detection.
The ONNX transformer in ML.NET provides some data to an existing ONNX model and gets the score (prediction) from it.
In the ML.NET 0.6 release, there are made several performance improvements in making single predictions from a trained model. Two improvements include:
- Moving the legacy LearningPipeline API to the new Estimators API.
- Optimizing the performance of PredictionFunction in the new API.
Following are some comparisons of the LearningPipeline with the improved PredictionFunction in the new Estimators API:
- Predictions on Iris data: 3,272x speedup (29x speedup with the Estimators API, with a further 112x speedup with improvements to PredictionFunction).
- Predictions on Sentiment data: 198x speedup (22.8x speedup with the Estimators API, with a further 8.68x speedup with improvements to PredictionFunction). This model contains a text featurizer, so it is not surprising to see a smaller gain.
- Predictions on Breast Cancer data: 6,541x speedup (59.7x speedup with the Estimators API, with a further 109x speedup with improvements to PredictionFunction).
Improvements in Type system
In this ML.NET version, the Dv type system has been replaced with .NET’s standard type system. This makes ML.NET easy to use.
ML.NET previously had its own type system, which helped it deal with missing values (a common case in ML). This type system required users to work with types like DvText, DvBool, DvInt4, etc. One effect of this change is, only floats and doubles have missing values which are represented by NaN.
Due to the improved approach to dependency injection, users can also deploy ML.NET in additional scenarios using .NET app models such as Azure Functions easily without convoluted workarounds.
To know more about other improvements in the ML.NET 0.6 visit the Microsoft Blog.