All projects

Learning group clustering

Splitting hundreds of students into small groups of similar ability, using equal-size k-means and a constraint solver.

Small-group tutoring only works if the five students in a group need roughly the same thing. After an LSA every student has a skill vector, so grouping becomes an optimisation problem: minimise the summed distance between students who share a group.

The repository has three solvers:

  1. Score sort. The baseline: sort by total score and cut into groups of five.
  2. CP-SAT. An exact model in Google OR-Tools: one boolean per student and group, exactly one group per student, minimum and maximum group sizes, and an objective that penalises every pair of dissimilar students placed together. Optimal, but too slow for 500 students.
  3. Hybrid. Equal-size k-means first splits the cohort into clusters of about 25. CP-SAT then solves each cluster on its own for up to 15 seconds.

The LSA added a better measure than score. A concept from November 2023 described each student by their set of root deficits, the most basic skills they had failed. It defined the distance between two students by how few of those they share, so that a group of five could spend its lessons on the same foundations.

The hybrid produced noticeably more homogeneous groups than the score sort, in seconds rather than hours.