Loading WASM module...
01 k-Means Clustering
Clustering
const model = await kmeans(data, { k: 3 });
model.getCentroids(); // [[x,y], ...]
model.getAssignments(); // [0, 1, 2, 0, ...]
02 k-Nearest Neighbors
Classification
const model = await knnClassifier(data, labels, { k: 5 });
model.predict([[1.5, 2.0]]); // [0] or [1]
03 Logistic Regression
Classification
const model = await logisticRegression(data, labels, { learningRate: 0.1 });
model.predictProba([[x, y]]); // [0.87]
04 DBSCAN
Clustering
const result = await dbscan(data, { eps: 0.8, minPoints: 4 });
result.nClusters; // 3 result.nNoise; // 12
05 Decision Tree
Classification
const tree = await decisionTree(data, labels, { maxDepth: 4, mode: 'classify' });
tree.depth; // 4 tree.nNodes; // 15
06 PCA
Dimensionality Reduction
const result = await pca(data, { nComponents: 2 });
result.getExplainedVarianceRatio(); // [0.72, 0.18]
07 Perceptron
Classification
const model = await perceptron(data, labels, { learningRate: 0.1 });
model.converged; // true model.getWeights(); // [w1, w2]
08 Seasonal Decomposition
Time Series
const d = await seasonalDecompose(data, 12);
d.getTrend(); d.getSeasonal(); d.getResidual();