Loading WASM module...

ML Playground

8 algorithms. ~56KB. All running in your browser via WebAssembly.

01 k-Means Clustering

Clustering
-
Iterations
-
Inertia
const model = await kmeans(data, { k: 3 }); model.getCentroids(); // [[x,y], ...] model.getAssignments(); // [0, 1, 2, 0, ...]

02 k-Nearest Neighbors

Classification
-
Samples
-
Time (ms)
const model = await knnClassifier(data, labels, { k: 5 }); model.predict([[1.5, 2.0]]); // [0] or [1]

03 Logistic Regression

Classification
-
Loss
-
Bias
const model = await logisticRegression(data, labels, { learningRate: 0.1 }); model.predictProba([[x, y]]); // [0.87]

04 DBSCAN

Clustering
-
Clusters
-
Noise
const result = await dbscan(data, { eps: 0.8, minPoints: 4 }); result.nClusters; // 3 result.nNoise; // 12

05 Decision Tree

Classification
-
Depth
-
Nodes
const tree = await decisionTree(data, labels, { maxDepth: 4, mode: 'classify' }); tree.depth; // 4 tree.nNodes; // 15

06 PCA

Dimensionality Reduction
-
PC1 Var%
-
PC2 Var%
const result = await pca(data, { nComponents: 2 }); result.getExplainedVarianceRatio(); // [0.72, 0.18]

07 Perceptron

Classification
-
Converged
-
Iterations
const model = await perceptron(data, labels, { learningRate: 0.1 }); model.converged; // true model.getWeights(); // [w1, w2]

08 Seasonal Decomposition

Time Series
-
Detected Period
-
Strength
const d = await seasonalDecompose(data, 12); d.getTrend(); d.getSeasonal(); d.getResidual();