Chapter 4. Conclusions and Next Steps

This brief report shows just a few examples of what you can do with F#, but we used it to demonstrate many of the key features of the language that make it a great tool for data science and machine learning. With type providers, you can elegantly access data. We used the XPlot library for visualization, but F# also gives you access to the ggplot2 package from R and numerous other tools. As for analysis, we used the Deedle library and R type provider, but we also implemented our own clustering algorithm.

Adding F# to Your Project

I hope this report piqued your interest in F# and showed some good reasons why you might want to use it in your projects. So, what are the best first steps? First of all, you probably should not immediately switch all your code to F# and become the only person in your company who understands it!

A large part of any machine learning and data science is experimentation. Even if your final implementation needs to be in C# (or any other language), you can still use F# to explore the data and prototype different algorithms (using plain F#, R type provider, and the machine learning libraries discussed below).

F# integrates well with .NET and Xamarin applications, so you can write your data access code or a machine learning algorithm in F# and use it in a larger C# application. There are also many libraries for wrapping F# code as a web application or a web service;1 and so you can expose the functionality as a simple REST service and host it on Heroku, AWS, or Azure.

Resources for Learning More

If you want to learn more about using F# for data science and machine learning, a number of excellent resources are worth checking out now that you have finished the quick overview in this report.

Report Source Code (fslab.org/report)

The best way to learn anything is to try it on your own, so download the full source code for the examples from this report and try modifying them to learn other interesting things about the data we’ve been using, or change the code to load other data relevant to your work!

F# User Groups and Coding Dojos (c4fsharp.net)

The F# community is very active, and there is likely an F# user group not far from where you live. The Community for F# website is the best place to find more information. It also hosts coding Dojos that you can try completing on your own.

F# Software Foundation (fsharp.org)

The F# Foundation website is the home of the F# language and is a great starting point if you want to learn more about the language and find resources like books and online tutorials. It also provides up-to-date installation instructions for all platforms.

FsLab Project (fslab.org)

FsLab is a package that brings together many of the popular data science libraries for F#. We used F# Data (for data access), Deedle and R provider (for data analysis), and XPlot (for visualization). The FsLab website hosts their documentation and other useful resources.

Accord.NET Framework (accord-framework.net)

Accord.NET is a machine learning library for .NET that works well with F#. In this report, we implemented k-means clustering to demonstrate interesting F# language features, but when solving simple machine learning problems, you can often just use an existing library!

MBrace Project (http://www.m-brace.net/)

MBrace is a simple library for scalable data scripting and programming with F# and C#. It lets you run F# computations in the cloud directly from your F# Interactive with the same rapid feedback that you get when running your F# code locally. Check out MBrace if you are looking at implementing scalable machine learning with F#.

Machine Learning Projects for .NET Developers (Mathias Brandewinder, Apress)

Finally, if you enjoyed Chapter 3, then Mathias Brandewinder’s book is a great resource. It implements a number of machine learning algorithms using F# and also provides more details for some of the libraries used in this report, like the R type provider and F# Data.

1 See the web guide on the F# Foundation website: http://fsharp.org/guides/web.

Get Analyzing and Visualizing Data with F# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.