ML.NET is an open-source, cross-platform machine learning framework for .NET developers that enables integration of custom machine learning models into .NET apps.
Just over a month ago, we released ML.NET 2.0. Thank you for trying it out and giving us feedback.
We’re not stopping there though and are excited to introduce the first preview release of ML.NET 3.0. This release brings several hardware acceleration improvements that allow you to make the most out of your compute resources during training.
Install the latest ML.NET 3.0 and Intel oneDaL preview packages to try out the latest improvements powered by Intel oneDAL and give us feedback.
What is Intel oneAPI Data Analytics Library (oneDAL)
Intel oneAPI Data Analytics Library is a library that helps speed up data analysis by providing highly optimized algorithmic building blocks for all stages of the data analytics and machine learning process.
oneDAL makes use of the SIMD extensions in 64-bit architectures, which are featured in Intel and AMD CPUs
oneDAL components in ML.NET
oneDAL integrates into ML.NET by accelerating existing trainers during training. Currently, the following ML.NET trainers provide oneDAL support.
Trainer | Machine Learning Task |
---|---|
Ordinary Least Squares | Regression |
L-BGFS | Classification |
FastTree | Regression & Classification |
FastForest | Regression & Classification |
Get started with oneDAL in ML.NET
- Install the latest
Microsoft.ML
3.0 preview version.dotnet add package Microsoft.ML --prerelease
If you’re using
OLS
orFastTree
, you’ll have to install additional packages# Ordinary Least Squares (OLS) dotnet add package Microsoft.ML.Mkl.Components --prerelease # FastTree dotnet add package Microsoft.ML.FastTree --prerelease
- Install the Microsoft.ML.OneDal NuGet package.
dotnet add package Microsoft.ML.OneDal --prerelease
- Set the
MLNET_BACKEND
environment variable toONEDAL
. If you’re using one of the trainers supported by oneDAL, there are no code changes required. - Create a pipeline using one of the oneDAL-supported ML.NET trainers. In this sample, it’s using
LbfgsLogisticRegression
to train a binary classification model to predict oneDAL support.// Initialize MLContext var ctx = new MLContext(); // Define data var trainingData = new [] { new {Arch="ARM", Trainer="LightGBM", oneDALSupport=false}, new {Arch="x86", Trainer="FastTree", oneDALSupport=true}, new {Arch="x86", Trainer="LbfgsLogisticRegression", oneDALSupport=true}, new {Arch="ARM", Trainer="FastTree", oneDALSupport=false} }; // Load data into IDataView var trainingDv = ctx.Data.LoadFromEnumerable(trainingData); // Define data processing pipeline & trainer var pipeline = ctx.Transforms.Categorical.OneHotEncoding(new [] { new InputOutputColumnPair("ArchEncoded", "Arch"), new InputOutputColumnPair("TrainerEncoded", "Trainer")}) .Append(ctx.Transforms.Concatenate("Features", "ArchEncoded", "TrainerEncoded")) .Append(ctx.BinaryClassification.Trainers.LbfgsLogisticRegression(labelColumnName:"oneDALSupport")); // Train model var model = pipeline.Fit(trainingDv)
- Train your model.
For a more complete example, see this sample.
Known issues
On Windows, you may see a library loading error. To unblock yourself, add the “runtimes\win-x64\native” directory in your application “bin” directory to the PATH environment variable.
What’s next?
We’re just getting started with ML.NET 3.0 development and are excited about the improvements and new capabilities we’re looking to enable. For more details, see the ML.NET roadmap.
Thank you
We are extremely grateful to our Intel partners as none of these improvements would be possible without them.
Get started and resources
Learn more about ML.NET, Model Builder, and the ML.NET CLI in Microsoft Docs.
If you run into any issues, feature requests, or feedback, please file an issue in the ML.NET repo.
Join the ML.NET Community Discord or #machine-learning channel on the .NET Development Discord.
Tune in to the Machine Learning .NET Community Standup every other Wednesday at 10am Pacific Time.
The post Accelerate ML.NET training with Intel oneDAL appeared first on .NET Blog.
Comments
Post a Comment