K means

Reflecting on What We Built: Finishing the Rubber Duckies Project

The C++ Programmer’s Mindset by Sam Morley (ISBN 978-1-83588-842-1)

Chapter 12 is the payoff moment. After chapters of file readers, regex parsing, and k-means clustering, Morley finally wires everything into one runnable program and then sits back to ask: what did we actually learn?

Implementing K-Means Clustering in C++ for Hotspot Detection

Book: The C++ Programmer’s Mindset
Author: Sam Morley
ISBN: 978-1-83588-842-1

Chapter 11 Part 2 is where Morley ships the clustering code. Theory from Part 1 becomes KMeans, compute_score, best_kmeans_cluster, and compute_clusters. Tests catch real bugs, including a longitude flip at the north pole that only shows up on round-trip coordinate conversion.

K-Means Clustering Theory for Geographic C++ Data

Book: The C++ Programmer’s Mindset
Author: Sam Morley
ISBN: 978-1-83588-842-1

Chapter 11 is the computational core of the rubber duckies project. All those file readers were building toward one question: where on Earth are these sightings clustering? Morley implements k-means from scratch. Choosing k and embedding geographic data correctly are the hard parts, not the iteration loop itself.

Outlining the Rubber Duckies Challenge in C++

Book: The C++ Programmer’s Mindset
Author: Sam Morley
ISBN: 978-1-83588-842-1

Part 1 was theory. Chapter 7 kicks off Part 2 with a full project. Morley hands you a client brief, sample data, and then does the thing most tutorials skip: he thinks before he codes.