Skip to content

HMath.MachineLearning.Decomposition

Module index · Numerical conventions

Description

Dense decomposition and manifold reference algorithms. PCA signs and degenerate eigenspaces are not unique. t-SNE implements exact all-pairs Student-t KL gradients (van der Maaten & Hinton, JMLR 2008); UMAP uses the fuzzy union and full cross-entropy gradient (McInnes et al., arXiv:1802.03426) with caller-supplied positive a,b curve parameters. Neither is a Barnes-Hut, ANN, or stochastic negative-sampling implementation. Budgets are explicit.

On this page

API Purpose
PCA Fitted feature center,principal-component directions,and their explained variances; use transform functions for new observations.
pcaMean Training feature means subtracted before projection.
pcaComponents Principal component loading vectors in component order.
pcaVariances Explained variances associated with the retained principal components.
fitPCA Fit count principal axes from at least two observations; uses sample covariance (denominator n-1).
transformPCA Center with the training mean and project onto retained axes; no whitening is applied.
inversePCA Reconstruct original features from retained scores and restore the training mean.
IncrementalPCA Exact sufficient statistics, including between-batch mean correction.
incrementalPCA Create empty running covariance state for a positive feature dimension.
updatePCA Merge observations by Welford updates.
mergePCA Combine independent batch statistics with the between-mean scatter correction.
finishPCA Extract principal axes from accumulated sample covariance; requires at least two observations.
KernelPCA Centered training kernel state and normalized positive eigenvectors.
fitKernelPCA Fit kernel principal axes; count must be smaller than n and within positive numerical rank.
transformKernelPCA Center query kernels with training means before projection, without fitting query statistics.
truncatedSVD Return reduced (U, singular values, V-transpose) from LAPACK, keeping the largest count values.
ICA Training center and whitened unmixing directions; component signs/permutations are arbitrary.
fitICA Symmetric FastICA with tanh nonlinearity (Hyvarinen 1999), whitening by sample covariance.
transformICA Apply the fitted centering and unmixing directions to new observations.
FactorAnalysis Fitted feature center,latent factor loadings,and diagonal feature-noise variances.
factorLoadings Fitted feature-by-factor loading matrix.
factorNoise Per-feature residual noise variances in the factor model.
fitFactorAnalysis Gaussian factor-analysis EM with diagonal noise floor.
CCA Paired training centers, canonical directions, and regularized canonical correlations.
fitCCA Fit paired canonical directions with a strictly positive diagonal covariance ridge.
transformCCA Project paired query rows with fitted training centers and canonical directions.
canonicalCorrelations Singular values of the whitened cross-covariance, in descending order.
PLS PLS2 regression state with predictor/response centers and a feature-by-response coefficient matrix.
fitPLS PLS2 NIPALS with regression deflation; count cannot exceed the predictor rank.
predictPLS Predict response rows using fitted PLS coefficients and training centers.
randomProjection Seeded Gaussian projection with variance 1/dimension per coefficient.
classicalMDS Classical metric MDS.
isomap Build a symmetric k-neighbor graph, compute geodesics, then metric MDS.
tsne Exact all-pairs t-SNE; perplexity must be strictly between one and n.
umap Exact full fuzzy-set cross entropy, caller supplies fitted curve a,b.

Documentation

PCA

data PCA Source #

Fitted feature center,principal-component directions,and their explained variances; use transform functions for new observations.

Instances

Instances details
Show PCA Source # 
Instance details

Defined in HMath.MachineLearning.Decomposition

Methods

showsPrec :: Int -> PCA -> ShowS #

show :: PCA -> String #

showList :: [PCA] -> ShowS #

Eq PCA Source # 
Instance details

Defined in HMath.MachineLearning.Decomposition

Methods

(==) :: PCA -> PCA -> Bool #

(/=) :: PCA -> PCA -> Bool #

pcaMean

pcaMean :: PCA -> [Double] Source #

Training feature means subtracted before projection.

pcaComponents

pcaComponents :: PCA -> Dataset Source #

Principal component loading vectors in component order.

pcaVariances

pcaVariances :: PCA -> [Double] Source #

Explained variances associated with the retained principal components.

fitPCA

fitPCA :: Int -> Dataset -> Either MathError PCA Source #

Fit count principal axes from at least two observations; uses sample covariance (denominator n-1).

transformPCA

transformPCA :: PCA -> Dataset -> Either MathError Dataset Source #

Center with the training mean and project onto retained axes; no whitening is applied.

inversePCA

inversePCA :: PCA -> Dataset -> Either MathError Dataset Source #

Reconstruct original features from retained scores and restore the training mean.

IncrementalPCA

data IncrementalPCA Source #

Exact sufficient statistics, including between-batch mean correction. Sample count, running mean, and centered scatter sufficient statistics.

incrementalPCA

incrementalPCA :: Int -> Either MathError IncrementalPCA Source #

Create empty running covariance state for a positive feature dimension.

updatePCA

updatePCA :: IncrementalPCA -> Dataset -> Either MathError IncrementalPCA Source #

Merge observations by Welford updates. Empty batches preserve the previous state.

mergePCA

mergePCA :: IncrementalPCA -> IncrementalPCA -> Either MathError IncrementalPCA Source #

Combine independent batch statistics with the between-mean scatter correction.

finishPCA

finishPCA :: Int -> IncrementalPCA -> Either MathError PCA Source #

Extract principal axes from accumulated sample covariance; requires at least two observations.

KernelPCA

data KernelPCA Source #

Centered training kernel state and normalized positive eigenvectors.

Instances

Instances details
Show KernelPCA Source # 
Instance details

Defined in HMath.MachineLearning.Decomposition

Eq KernelPCA Source # 
Instance details

Defined in HMath.MachineLearning.Decomposition

fitKernelPCA

fitKernelPCA :: Int -> Kernel -> Dataset -> Either MathError KernelPCA Source #

Fit kernel principal axes; count must be smaller than n and within positive numerical rank.

transformKernelPCA

transformKernelPCA :: KernelPCA -> Dataset -> Either MathError Dataset Source #

Center query kernels with training means before projection, without fitting query statistics.

truncatedSVD

truncatedSVD :: Int -> Dataset -> Either MathError (Dataset, [Double], Dataset) Source #

Return reduced (U, singular values, V-transpose) from LAPACK, keeping the largest count values.

ICA

data ICA Source #

Training center and whitened unmixing directions; component signs/permutations are arbitrary.

Instances

Instances details
Show ICA Source # 
Instance details

Defined in HMath.MachineLearning.Decomposition

Methods

showsPrec :: Int -> ICA -> ShowS #

show :: ICA -> String #

showList :: [ICA] -> ShowS #

Eq ICA Source # 
Instance details

Defined in HMath.MachineLearning.Decomposition

Methods

(==) :: ICA -> ICA -> Bool #

(/=) :: ICA -> ICA -> Bool #

fitICA

fitICA :: MLConfig -> Int -> Dataset -> Either MathError (Fit ICA) Source #

Symmetric FastICA with tanh nonlinearity (Hyvarinen 1999), whitening by sample covariance. Convergence accounts for independent component signs.

transformICA

transformICA :: ICA -> Dataset -> Either MathError Dataset Source #

Apply the fitted centering and unmixing directions to new observations.

FactorAnalysis

data FactorAnalysis Source #

Fitted feature center,latent factor loadings,and diagonal feature-noise variances.

factorLoadings

factorLoadings :: FactorAnalysis -> Dataset Source #

Fitted feature-by-factor loading matrix.

factorNoise

factorNoise :: FactorAnalysis -> [Double] Source #

Per-feature residual noise variances in the factor model.

fitFactorAnalysis

fitFactorAnalysis :: MLConfig -> Int -> Double -> Dataset -> Either MathError (Fit FactorAnalysis) Source #

Gaussian factor-analysis EM with diagonal noise floor. Unlike PCA, each observed feature has its own learned residual variance.

CCA

data CCA Source #

Paired training centers, canonical directions, and regularized canonical correlations.

Instances

Instances details
Show CCA Source # 
Instance details

Defined in HMath.MachineLearning.Decomposition

Methods

showsPrec :: Int -> CCA -> ShowS #

show :: CCA -> String #

showList :: [CCA] -> ShowS #

Eq CCA Source # 
Instance details

Defined in HMath.MachineLearning.Decomposition

Methods

(==) :: CCA -> CCA -> Bool #

(/=) :: CCA -> CCA -> Bool #

fitCCA

fitCCA :: Int -> Double -> Dataset -> Dataset -> Either MathError CCA Source #

Fit paired canonical directions with a strictly positive diagonal covariance ridge.

transformCCA

transformCCA :: CCA -> Dataset -> Dataset -> Either MathError (Dataset, Dataset) Source #

Project paired query rows with fitted training centers and canonical directions.

canonicalCorrelations

canonicalCorrelations :: CCA -> [Double] Source #

Singular values of the whitened cross-covariance, in descending order.

PLS

data PLS Source #

PLS2 regression state with predictor/response centers and a feature-by-response coefficient matrix.

Instances

Instances details
Show PLS Source # 
Instance details

Defined in HMath.MachineLearning.Decomposition

Methods

showsPrec :: Int -> PLS -> ShowS #

show :: PLS -> String #

showList :: [PLS] -> ShowS #

Eq PLS Source # 
Instance details

Defined in HMath.MachineLearning.Decomposition

Methods

(==) :: PLS -> PLS -> Bool #

(/=) :: PLS -> PLS -> Bool #

fitPLS

fitPLS :: MLConfig -> Int -> Dataset -> Dataset -> Either MathError (Fit PLS) Source #

PLS2 NIPALS with regression deflation; count cannot exceed the predictor rank. Inner fixed-point iteration obeys the supplied convergence budget.

predictPLS

predictPLS :: PLS -> Dataset -> Either MathError Dataset Source #

Predict response rows using fitted PLS coefficients and training centers.

randomProjection

randomProjection :: MLConfig -> Int -> Dataset -> Either MathError Dataset Source #

Seeded Gaussian projection with variance 1/dimension per coefficient. Returns transformed rows.

classicalMDS

classicalMDS :: Int -> Dataset -> Either MathError Dataset Source #

Classical metric MDS. Negative eigenvalues are omitted; requesting a dimension beyond positive rank fails instead of creating imaginary axes.

isomap

isomap :: Int -> Int -> Dataset -> Either MathError Dataset Source #

Build a symmetric k-neighbor graph, compute geodesics, then metric MDS. Disconnected graphs fail.

tsne

tsne :: MLConfig -> Int -> Double -> Dataset -> Either MathError (Fit Dataset) Source #

Exact all-pairs t-SNE; perplexity must be strictly between one and n.

umap

umap :: MLConfig -> Int -> Int -> Double -> Double -> Dataset -> Either MathError (Fit Dataset) Source #

Exact full fuzzy-set cross entropy, caller supplies fitted curve a,b. Local connectivity rho is the first positive neighbor distance. This dense reference resolves every repulsive pair instead of sampling negatives.