Skip to Content
Analyzing and Visualizing Data with F#
book

Analyzing and Visualizing Data with F#

by Tomas Petricek
October 2015
Beginner to intermediate
40 pages
1h 6m
English
O'Reilly Media, Inc.
Content preview from Analyzing and Visualizing Data with F#

Chapter 3. Implementing Machine Learning Algorithms

All of the analysis that we discussed so far in this report was manual. We looked at some data, we had some idea what we wanted to find or highlight, we transformed the data, and we built a visualization. Machine learning aims to make the process more automated. In general, machine learning is the process of building models automatically from data. There are two basic kinds of algorithms. Supervised algorithms learn to generalize from data with known answers, while unsupervised algorithms automatically learn to model data without known structure.

In this chapter, we implement a basic, unsupervised machine learning algorithm called k-means clustering that automatically splits inputs into a specified number of groups. We’ll use it to group countries based on the indicators obtained in the previous chapter.

This chapter also shows the F# language from a different perspective. So far, we did not need to implement any complicated logic and mostly relied on existing libraries. In contrast, this chapter uses just the standard F# library, and you’ll see a number of ways in which F# makes it very easy to implement new algorithms—the primary way is type inference which lets us write efficient and correct code while keeping it very short and readable.

How k-Means Clustering Works

The k-means clustering algorithm takes input data, together with the number k that specifies how many clusters we want to obtain, and automatically assigns the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

F# High Performance

F# High Performance

Eriawan Kusumawardhono
F# Deep Dives

F# Deep Dives

Phillip Trelford, Tomas Petricek

Publisher Resources

ISBN: 9781492048350Errata Page