The Microsoft ML.NET (“machine learning .NET”) is a large library of .NET modules for machine learning. AutoML is a new, associated system that tries different ML.NET algorithms and tells you how good each is at a particular problem. AutoML is still in preview mode but I thought I’d take the system out for a test drive.
As is often the case with a new technology, it took quite a bit of struggle just to get the system installed properly. AutoML and ML.NET run on the .NET Core system. That’s a big topic in itself, but briefly, I had to locate the .NET Core installation information (version 2.2) and install the .NET Core SDK that allows you to create and run .NET Core programs.
After installing the .NET Core SDK, I installed the ML.NET command-line interface (CLI) tool (which includes AutoML) by launching a shell and entering the command “dotnet tool install -g mlnet”. AutoML has a close relationship with the Visual Studio development environment, but I already had VS2017 installed. To summarize, 1.) install Visual Studio 2017 or 2019 if necessary, 2.) install .NET Core SDK 2.2 if necessary, 3.) install ML.NET CLI (which includes AutoML).
I created two data files to experiment with — training data to create a model and test data to evaluate the trained model. The data looks like:
sex age region income politic False 26 eastern 53800.00 conservative False 19 western 39200.00 moderate True 19 central 80800.00 liberal False 52 eastern 86700.00 conservative False 56 eastern 89200.00 liberal (etc.)
My goal is to predict political leaning (conservative, moderate, liberal) from Sex (male = False, female = True), Age, Region (“eastern”, “western”, “central”), and Income.
I opened a shell and entered the command:
mlnet auto-train ^ --task multiclass-classification ^ --dataset ".\Data\people_train_1000.tsv" ^ --test-dataset ".\Data\people_test_200.tsv" ^ --label-column-name politic ^ --max-exploration-time 5
The ^ character is line continuation for a cmd shell. And then the AutoML / ML.NET CLI systems did their thing. Quite Impressive.
But things got better. The mlnet tool created a C# project that I opened with Visual Studio. The project had all the code I needed to use the trained model to make a prediction for a new person. I fed the model (sex = Male, age = 33, region = “central”, income = $62,000.00 and got a prediction of “moderate”. Very, very impressive.
I just scratched the surface of AutoML with ML.NET but I like what I’ve seen so far.