PLS Regression and CCA
Model two related data blocks with PLSRegression and canonical correlation analysis in JavaScript or TypeScript.
View as MarkdownPLS and CCA
Algorithm overview
Partial least squares finds latent directions that predict a target block, while canonical correlation analysis finds directions with high cross-block correlation. Both help with correlated, multivariate features.
JavaScript implementation
PLSRegression uses mode-A NIPALS with regression deflation. CCA uses mode-B weights with canonical deflation.
Interactive PLS regression playground
Change the latent-component count and data distribution below. The visible first target and holdout metrics come from a live multi-output CrossDecomposition.PLSRegression fit.
PLSRegression playground
Adjust the data and model, then click the chart to add a training observation.
Quick start
import { CrossDecomposition } from '@kanaries/ml';
const X = [[0, 1], [1, 2], [2, 3], [3, 5]];
const Y = [[1], [2], [4], [7]];
const model = new CrossDecomposition.PLSRegression({ nComponents: 2 });
model.fit(X, Y);
console.log(model.predict([[4, 6]]));Detailed API reference
Both expose weights, loadings, rotations, iteration counts, transform, and predict.
Kernel Ridge Regression and Kernel Density
Use nonlinear KernelRidge prediction and KernelDensity estimation in JavaScript or TypeScript with @kanaries/ml.
Gaussian and Sparse Random Projection
Reduce high-dimensional data with Johnson-Lindenstrauss Gaussian or sparse random projections in JavaScript and TypeScript.