R

K-Means from Scratch

Cluster data into natural groups by implementing k-means yourself: assign, recompute, repeat. The workhorse of unsupervised machine learning.

RAdvancedPortfolio piece

What you'll be able to build

Cluster data into natural groups by implementing k-means yourself: assign, recompute, repeat. The workhorse of unsupervised machine learning. Along the way you pick up real, transferable R skills, not just this one project:

  • euclidean distance between points
  • assigning points to the nearest centroid
  • recomputing centroids as group means
  • iterating until convergence
  • vectorised distance computation
  • evaluating cluster quality

A course like this one

Yours is built from your own placement, so module count and depth will differ. This map shows what a advanced-level R learner building K-Means from Scratch actually gets.

  1. Module 1: Coercion edge cases and the integer/double divide5 lessons

    Builds the production-ready version of the vector for your k-means from scratch.

  2. Module 2: Closures, Reduce accumulate, and functional pipelines5 lessons

    Builds the production-ready version of the reusable factor for your k-means from scratch.

  3. Module 3: Monte Carlo simulation and bootstrap from base R5 lessons

    Builds the production-ready version of the simulation for your k-means from scratch.

  4. Module 4: Tidy reshaping and factor-level engineering5 lessons

    Builds the production-ready version of the apply pipeline workflow for your k-means from scratch.

  5. Module 5: Recycling, NextMethod, and S3 dispatch surprises5 lessons

    Builds the production-ready version of the data frame that powers your k-means from scratch.

  6. Module 6: Reproducible, NA-safe, self-checking analyses3 lessons

    Builds the production-ready version of the summary table for your k-means from scratch.

How the lessons actually work

Every lesson has you predict what a piece of R code will output before you run it, then run it for real in your browser and fix what you got wrong. Each module ends in a challenge gate with hidden tests, so you can't advance until your code actually works. The course closes with a capstone that assembles everything into K-Means from Scratch, and a runnable proof page tied to your own code.

Common questions

How long does the K-Means from Scratch course take?

about 7 hours, across 6 modules and 28 lessons, at roughly 15 minutes per lesson. Your own course may run shorter or longer, since it's sized to your placement result, not a fixed template.

Do I need experience?

Yes. This is an advanced-tier R project, so it assumes you're already comfortable writing and reading R before you start.

How much does it cost?

$15 one-time, no subscription. The first module is free, so you can see exactly how the course teaches before you pay for the rest.

No subscription. Module one is free.

Build my K-Means from Scratch