Try .NET on Azure for free
Get started with 12 months of free services and build .NET cloud apps with your Azure free account.

ML.NET Tutorial - Get started in 10 minutes

Train your model

Now you'll train your model with the wikipedia-detox-250-line-data.tsv dataset.

Model Builder evaluates many models with varying algorithms and settings to give you the best performing model.

  1. Leave the Time to train, which is the amount of time you'd like Model Builder to explore various models, as 10 seconds. Note that for larger datasets, you should set a longer training time.

  2. Select Start Training to start the training process. Once training starts, you can see the time remaining.

Training results

Once training is done, you can see a summary of the training results.

  • Best accuracy - This shows you the accuracy of the best model that Model Builder found. Higher accuracy means the model predicted more correctly on test data.
  • Best model - This shows you which algorithm performed the best during Model Builder's exploration.
  • Training time - This shows you the total amount of time that was spent training / exploring models.
  • Models explored (total) - This shows you the total number of models explored by Model Builder in the given amount of time.

If you want, you can view more information about the training session in the Machine Learning Output window.

After model training finishes, go to the Evaluate step.

In your terminal, run the following command (in your myMLApp folder):

Terminal
mlnet classification --dataset "wikipedia-detox-250-line-data.tsv" --label-col "Sentiment" --train-time 10

What do these commands mean?

The mlnet classification command runs ML.NET with AutoML to explore many iterations of classification models with varying combinations of data transformations, algorithms, and algorithm options and then chooses the highest performing model.

  • --dataset: You chose wikipedia-detox-250-line-data.tsv as the dataset (internally, the CLI will split the one dataset into training and testing datasets).
  • --label-col: You must specify the target column you want to predict (or the Label). In this case, you want to predict the sentiment in the "Sentiment" column.
  • --train-time: You must also specify the amount of time you would like the ML.NET CLI to explore the different models, in this case 10 seconds. Note that for larger datasets, you should set a longer training time.

Progress

While the ML.NET CLI is exploring different models, it displays the following data:

  • Start training - This section shows each model iteration, including the trainer (algorithm) used and evaluation metrics for that iteration.
  • Time left - This and the progress bar will indicate how much time is left in the training process in seconds.
  • Best algorithm - This shows you which algorithm has performed the best so far.
  • Best score - This shows you the performance of the best model so far. Higher accuracy means the model predicted more correctly on test data.

If you want, you can view more information about the training session in the log file generated by the CLI.

Continue