Birch, Affinity Propagation, and Bisecting K-Means
Cluster streamed, exemplar-based, or hierarchical data in JavaScript and TypeScript with Birch, AffinityPropagation, and BisectingKMeans.
View as MarkdownAdvanced clustering
Algorithm overview
Birch incrementally compresses observations into clustering-feature subclusters, AffinityPropagation discovers exemplars by message passing, and BisectingKMeans recursively splits high-inertia groups.
JavaScript implementation
These estimators run locally in browser or Node.js and follow the library's fitPredict convention. Affinity propagation stores several O(n²) matrices; as a practical browser ceiling, keep it below roughly 2,000 samples unless you have benchmarked the target device's memory budget.
Interactive advanced clustering playground
Switch among Birch, Affinity Propagation, and Bisecting K-Means, then change each estimator's most important controls. Every view is fitted live with the corresponding @kanaries/ml class, including its reported centers, exemplars, or inertia.
Learn Birch by changing it
Adjust the compression threshold and final cluster count while a Birch CF tree summarizes the observations. Click the chart to add a point and refit.
Clusters.BirchQuick start
import { Clusters } from '@kanaries/ml';
const X = [[-2, -2], [-1.8, -2.1], [2, 2], [2.1, 1.9]];
const labels = new Clusters.Birch({ threshold: 0.5, nClusters: 3 }).fitPredict(X);
console.log(labels);Birch also supports partialFit; AffinityPropagation exposes exemplar indices and nIter; BisectingKMeans exposes final centers and inertia.
Detailed API reference
Birch accepts threshold, branchingFactor, and nClusters. AffinityPropagation accepts damping, preference, maxIter, convergenceIter, and randomState. BisectingKMeans accepts nClusters, bisectingStrategy, the inner K-Means iteration settings, and randomState.
k-means++ Initialization
Learn what k-means++ Initialization does, when to use it, and how to run kmeansPlusPlus in JavaScript or TypeScript with @kanaries/ml for browser and Node.js applications.
Linear Models
Explore linear regression, logistic regression, regularized regression, and linear classification in JavaScript and TypeScript with @kanaries/ml.