February ML.NET Model Builder Updates

Bri

March 2nd, 2020

ML.NET is a cross-platform, machine learning framework for .NET developers. Model Builder is the UI tooling in Visual Studio that uses Automated Machine Learning (AutoML) to train and consume custom ML.NET models in your .NET apps. Together, you can now create custom machine learning models for scenarios like sentiment analysis, price prediction, and more. All this without any machine learning experience or even leaving the .NET development environment!

ML.NET Model Builder

This release of Model Builder comes with bug fixes and several exciting new features:

Azure training (image classification) – harness the power of Azure to scale out training for image classification.

– harness the power of Azure to scale out training for image classification. Recommendation scenario – locally train recommendation models (e.g. to recommend products).

Azure Training (Image Classification)

We added the image classification scenario to ML.NET Model Builder late last year. Which enabled you to locally train image classification models with your own images. However, you may have noticed the limitations of training on images when using your CPU, particularly the duration of training time.

This month, we are excited to release the ability to train image classification models in Azure Machine Learning directly from Model Builder. Take advantage of the cloud and get even faster, more accurate results!

Let’s look at the dogs vs. cats example. In Model Builder, after selecting the Image Classification scenario and uploading your local dataset, you have the following training options:

To train in Azure, set up an Azure Machine Learning workspace and create an experiment. Do that right in the UI:

There are several concepts that are specific to Azure and Azure Machine Learning. Learn about workspaces, computes, and experiments in our Docs.

After setting up your Azure ML workspace and experiment settings, click Start training to kick off training in Azure. This will then:

Create a new experiment. Upload your data to Azure. Begin training with Azure AutoML.

The status will be displayed in the Progress section and Output window. On top of that, you will be provided with a link to the Azure ML portal for more information about the training status:

Once training in Azure is complete, the model is downloaded locally to your machine (both an ML.NET model and an ONNX model). Then, try out your model in the Evaluate step and generate the model consumption code to use the ML.NET model to make predictions. Just like with local image classification training:

Recommendation Scenario

Additionally, we have also added a Recommendation scenario to Model Builder. This locally trains ML.NET models for recommending items (such as products or movies) to users:

With this recommendation model, you can predict what rating a user will give to specific items based on historical item rating data. Then get the top rated / recommended items for a particular user. This type of recommendation in Model Builder uses the matrix factorization algorithm. Learn more in our documentation.

Matrix factorization has several different algorithm options which can be tuned to better suit your data needs. Model Builder tries out different combinations of these options in the given amount of training time. After that, chooses the combination of options which gives the best performance (measured by RMSE).

To use the Recommendation scenario in Model Builder, your dataset must have three specific columns:

User column Item column Rating column

Let’s use movie recommendation as an example. With a dataset (taken from the MovieLens dataset) which has columns for userId, movie, timestamp, and ratings. In the Data screen in Model Builder, the Column to predict is the ratings column. The User column is the userId column. And the Item column is the movie column (the timestamp column is ignored):

After the model is finished training, try out the recommendation model in the Evaluate screen in Model Builder. Specifically, input a userId and a movie to get the predicted rating that the user will give that particular movie. As well as the top 5 recommended movies for the specified user:

Share Your Feedback

Since Model Builder is still in Preview, your feedback is super important in driving the direction of this tool and ML.NET in general. We would love to hear your feedback!

If you run into any issues, please let us know by creating an issue in our GitHub repo.

Get Started with ML.NET Model Builder

Download ML.NET Model Builder in the VS Marketplace. Additionally, find it in the Extensions menu of Visual Studio.

Learn more in the ML.NET Docs. Get started with this intro tutorial.

Not currently using Visual Studio? Try out the ML.NET CLI. (Image classification and recommendation will be implemented in the next CLI release.)