Skip to main content

Accelerate ML.NET training with Intel oneDAL

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

  1. Install the latest Microsoft.ML 3.0 preview version.
    dotnet add package Microsoft.ML --prerelease

    If you’re using OLS or FastTree, 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
  2. Install the Microsoft.ML.OneDal NuGet package.
    dotnet add package Microsoft.ML.OneDal --prerelease
    
  3. Set the MLNET_BACKEND environment variable to ONEDAL. If you’re using one of the trainers supported by oneDAL, there are no code changes required.
  4. 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)
  5. 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

Popular posts from this blog

Fake CVR Generator Denmark

What Is Danish CVR The Central Business Register (CVR) is the central register of the state with information on all Danish companies. Since 1999, the Central Business Register has been the authoritative register for current and historical basic data on all registered companies in Denmark. Data comes from the companies' own registrations on Virk Report. There is also information on associations and public authorities in the CVR. As of 2018, CVR also contains information on Greenlandic companies, associations and authorities. In CVR at Virk you can do single lookups, filtered searches, create extracts and subscriptions, and retrieve a wide range of company documents and transcripts. Generate Danish CVR For Test (Fake) Click the button below to generate the valid CVR number for Denmark. You can click multiple times to generate several numbers. These numbers can be used to Test your sofware application that uses CVR, or Testing CVR APIs that Danish Govt provide. Generate

How To Iterate Dictionary Object

Dictionary is a object that can store values in Key-Value pair. its just like a list, the only difference is: List can be iterate using index(0-n) but not the Dictionary . Generally when we try to iterate the dictionary we get below error: " Collection was modified; enumeration operation may not execute. " So How to parse a dictionary and modify its values?? To iterate dictionary we must loop through it's keys or key - value pair. Using keys

How To Append Data to HTML5 localStorage or sessionStorage?

The localStorage property allows you to access a local Storage object. localStorage is similar to sessionStorage. The only difference is that, while data stored in localStorage has no expiration time untill unless user deletes his cache, data stored in sessionStorage gets cleared when the originating window or tab get closed. These are new HTML5 objects and provide these methods to deal with it: The following snippet accesses the current domain's local Storage object and adds a data item to it using Storage.setItem() . localStorage.setItem('myFav', 'Taylor Swift'); or you can use the keyname directly as : localStorage.myFav = 'Taylor Swift'; To grab the value set in localStorage or sessionStorage, we can use localStorage.getItem("myFav"); or localStorage.myFav There's no append function for localStorage or sessionStorage objects. It's not hard to write one though.The simplest solution goes here: But we can kee