Machine Learning Monday

Explore ML.NET with F#: A hands-on introduction to Microsoft's open-source machine learning library and its capabilities for .NET developers.

2 min read 342 words

A few days back, I did a poll asking which new shiny library I should be trying. Here is the result of that:

As per popular demand, I should be trying ML.Net. It is a recently open-sourced library from Microsoft for Machine Learning. It started with all the C# examples, but lately there have been many F# samples.

So, obviously my first choice is to do it with F#.

First few good things about ML.Net:

  • Still in 0.6 version so a lot can improve (I like to try bleeding edge stuff)
  • Quite a few good things coming in, including Infer.net
  • Here are the lines from the ML.Net blog: Over time, ML.NET will enable other ML scenarios like recommendation systems, anomaly detection, and other approaches, like deep learning, by leveraging popular deep learning libraries like TensorFlow, Caffe2, and CNTK, and general machine learning libraries like Accord.NET.

I will be looking deep into the library as well. But for now there are more questions than answers:

  • I couldn't find how the internals of it work
  • How are all the calculations being done?
  • Are there any options for GPU processing, or will it leverage the power of a dependent library like TensorFlow or CNTK?
  • How does it compare to Keras? As that is also doing similar things.

For now, I have given a PR to make F# things more F# like. Nothing major, but a little bit of cleanup to make the code more functional. Hope that gets approved. And I will be digging more into the library.

I'll try to have a new article on F# in Machine Learning or Machine Learning in general every Monday. So, until next Monday, stay tuned.

Frequently Asked Questions

What is ML.NET and why should I use it?

ML.NET is an open-source machine learning library from Microsoft designed for .NET and F# developers. It's a good choice if you want to build ML models using C# or F# while maintaining compatibility with the .NET ecosystem, and it's actively being developed with plans to support deep learning through integration with popular libraries like TensorFlow and CNTK.

Can I use ML.NET with F#?

Yes, ML.NET fully supports F# with an increasing number of F# samples available in the official repository. The library was initially focused on C# examples, but the community has been actively adding F#-specific implementations to make the code more functional and idiomatic.

Does ML.NET support GPU processing?

ML.NET's direct GPU support capabilities are not clearly documented in the library itself, but it's designed to leverage dependent libraries like TensorFlow, CNTK, and Caffe2 that do support GPU acceleration. As the library evolves beyond its current 0.6 version, more explicit GPU processing options are expected to be added.

How does ML.NET compare to Keras?

Both ML.NET and Keras aim to simplify machine learning model development, but they target different ecosystems—Keras is Python-focused while ML.NET is designed for .NET developers. The comparison depends on your tech stack, though both offer similar functionality for building and training ML models.

What machine learning scenarios will ML.NET support in the future?

Beyond its current capabilities, ML.NET plans to support recommendation systems, anomaly detection, and deep learning approaches by integrating with popular deep learning libraries like TensorFlow, Caffe2, and CNTK. This roadmap makes it a promising platform for expanding ML capabilities within the .NET ecosystem.

Share this article