Interview – Machine Learning that's ACTUALLY easy with Richard Campbell

Do you want to try machine learning, but don’t want to invest too much time learning a new programming language or some other complicated API or complicated online tools?

Richard Campbell and I are geeking out about why you would want to look at machine learning, how to get started, and what should you know when building your prototype. 🧐

ML.NET Model Builder opens up the world of Machine Learning to all developers.

I had a blast doing the interview. I hope you’ll enjoy watching it as much as I enjoyed making it! 😁

Updated demo (screenshots)

Here are updated screenshots for ML .NET v1.4 Model Builder.

Start ML.NET Model Builder WizzardFigure: Start ML.NET Model Builder Wizzard.

Select Issue ClassificationFigure: Select Issue Classification.

Select file, column to predict (label) and input columns used for predictionFigure: Select file, column to predict (label) and input columns used for prediction.

Start trainingFigure: Start training.

See results of trainingFigure: See results of training.

You can try out your model before generating the codeFigure: You can try out your model before generating the code.

Generate the codeFigure: Generate the code.

It generates 2 projects. ConsoleApp is testing purposes and Model project is the one that you can use in your appsFigure: It generates 2 projects. ConsoleApp is testing purposes and Model project is the one that you can use in your apps.

In ConsoleApp you can see the usage of ML ModelFigure: In ConsoleApp you can see the usage of ML Model.

Bonus

When using ML .NET Model Builder, it will try to determine if a column should be a hash table or text, which can have a significant impact on your use case. It decides based on the ration of unique and duplicate values and it might choose the wrong type because of that.

However, after generating the code, you can change from a hash table to text and vice versa.

  1. In file ModelBuilder.cs in method BuildTrainingPipeline change the .Append for desired column.

From:

.Append(mlContext.Transforms.Categorical.OneHotHashEncoding(new[] { new InputOutputColumnPair("Description", "Description") }))

To:

.Append(mlContext.Transforms.Text.FeaturizeText(inputColumnName: "Description", outputColumnName: "Description"))

Update the Append from Categorical hash to Featurize textFigure: Update the Append from Categorical hash to Featurize text.

  1. Retrain model by running ModelBuilder.CreateModel(); in Program.cs. Return right after training because the model hasn’t been copied yet to bin folder.

Retrain model with feature text instead of categorical hashFigure: Retrain model with feature text instead of categorical hash.

  1. Remove the code from step 2.

NOTE: If your project contains . in it’s name, chances are that the path to the model will be incorrect. (a bug since v1.3) Make sure that path MODEL_FILEPATH in ModelBuilder.cs is correct!

Model Builder has a bug in generating the right path if project contains a dot in the nameFigure: Model Builder has a bug in generating the right path if project contains a dot in the name.