Skip to content

Function: pca()

ts
function pca(
   data, 
   n, 
   d, 
   k?): PcaResult;

Defined in: ml/reduce.ts:44

Principal component analysis of a row-major n×d matrix, projected to k dims (default 2). Centers columns, forms the d×d covariance, then extracts the top-k eigenvectors by power iteration + deflation. Deterministic.

Parameters

ParameterTypeDefault value
dataArrayLike<number>undefined
nnumberundefined
dnumberundefined
knumber2

Returns

PcaResult

MIT licensed. WebGL2 required.