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
Fitted feature center,principal-component directions,and their explained variances; use transform functions for new observations.
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.
Instances
| Show IncrementalPCA Source # | |
Defined in HMath.MachineLearning.Decomposition Methods showsPrec :: Int -> IncrementalPCA -> ShowS # show :: IncrementalPCA -> String # showList :: [IncrementalPCA] -> ShowS # | |
| Eq IncrementalPCA Source # | |
Defined in HMath.MachineLearning.Decomposition Methods (==) :: IncrementalPCA -> IncrementalPCA -> Bool # (/=) :: IncrementalPCA -> IncrementalPCA -> Bool # | |
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
Centered training kernel state and normalized positive eigenvectors.
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
Training center and whitened unmixing directions; component signs/permutations are arbitrary.
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.
Instances
| Show FactorAnalysis Source # | |
Defined in HMath.MachineLearning.Decomposition Methods showsPrec :: Int -> FactorAnalysis -> ShowS # show :: FactorAnalysis -> String # showList :: [FactorAnalysis] -> ShowS # | |
| Eq FactorAnalysis Source # | |
Defined in HMath.MachineLearning.Decomposition Methods (==) :: FactorAnalysis -> FactorAnalysis -> Bool # (/=) :: FactorAnalysis -> FactorAnalysis -> Bool # | |
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
Paired training centers, canonical directions, and regularized canonical correlations.
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
PLS2 regression state with predictor/response centers and a feature-by-response coefficient matrix.
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.