deepbox/ml
Decomposition
PCA, ICA, NMF, LDA, and related decomposition or topic-model transforms.
Dimensionality reduction
FastICA
FastICA — Independent Component Analysis using the fast fixed-point algorithm.
LatentDirichletAllocation
Latent Dirichlet Allocation (LDA) for topic modeling.
NMF
Non-negative Matrix Factorization (NMF).
PCA
Principal Component Analysis (PCA).
TruncatedSVD
Truncated SVD (aka LSA — Latent Semantic Analysis).
ml-decomposition.ts
import { FastICA, NMF, PCA, TruncatedSVD } from "deepbox/ml";import { tensor } from "deepbox/ndarray";const X = tensor([ [1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, 6],]);console.log(new PCA({ nComponents: 2 }).fitTransform(X).toString());console.log(new TruncatedSVD({ nComponents: 2 }).fitTransform(X).toString());console.log(new FastICA({ nComponents: 2 }).fitTransform(X).toString());console.log(new NMF({ nComponents: 2 }).fitTransform(X).toString());