MLNET is awesome! Here’s why you need to pay attention

Do you remember ‘Gremlins’, that famous 80’s movie?

I had to think of a gremlin when I was all set to host a live webinar, and 10 minutes before launch my Internet connection suddenly died.

And right after I had notified everyone that I had to cancel the webinar, the Internet connection mysteriously came back up.

My only explanation is that I had a gremlin in my switch box, chewing on the network cable 😅

So, anyway, let me show you what I wanted to demo in the webinar.

I’ve been playing around with NET Core v3 and the MLNET machine learning framework.

And let me tell you, this stuff is awesome!

NET Core is really cool all by itself. It’s the multi-platform version of the NET framework: it runs on Windows, OS/X, and Linux. I’m running it directly on my Mac right now without using my Windows 10 virtual machine.

And MLNET is Microsoft’s new machine learning library. It can run linear regression, logistic classification, clustering, deep learning, and many other machine learning algorithms.

MLNET is a first-class NET library. There’s no need to use Python, you can easily tap into this library using any NET language, including C#.

Microsoft is pouring all their effort into MLNET right now. This is going to be their go-to solution for all machine learning in NET going forward.

And it’s super easy to use. Watch this:

I built a simple classifier and trained it on a dataset of botanical data. My code loads a CSV file with the exact dimensions of Iris flower petal sizes, and uses it to train the model to correctly identify the type of each flower.

Here’s my code:

See how easy it is?

MLNET uses the concept of a pipeline to string data-loading, transformation, and learning stages together into a single machine learning sequence. All I need to do at the end is call the Fit() method to train the machine learning model on the data.

And did you notice I’m not using Visual Studio?

You’re looking at Visual Studio Code, a lightweight multi-platform code editor that runs on Windows, OS/X, and Linux.

Building and running machine learning apps in VS Code is a piece of cake, and I can do it directly on my Mac. Again, I’m not touching my Windows VM.

Here’s my code running in the VS Code debugger. It has correctly identified my test flower as an Iris-Virginica:

So what do you think of my setup?