BIRCH compresses a large dataset into small summaries called clustering features. A clustering feature (CF) for a subcluster holds the count N, the linear sum LS, and the sum of squared norms SS. Those three numbers give the centroid and radius without storing the points.
Implement birch_subclusters(X, threshold). Return (labels, centroids).
threshold, add the point to that CF. Otherwise start a new CF with this point.threshold must be nonnegative, otherwise raise ValueError.threshold (up to a floating point tolerance of 1e-9).X.Store each CF as its N, its LS vector, and its SS scalar in three parallel lists.
Clamp the radius inside the square root at zero, since rounding can make it slightly negative.
No results yet
Run your code to check it against the examples, or submit to run every test.