Version: v0.0.0-...-5130504 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2017 License: Apache-2.0 Imports: 4 Imported by: 0



Package pca provides some helpers for principal component analysis.



This section is empty.


This section is empty.



func NIPALS(data *mat64.Dense, components int, iterations int64,
	tolerance float64) (scores mat64.Dense, loadings mat64.Dense,
	explainedVariance mat64.Vector)

NIPALS calculates a limited number of principal components using the nonlinear iterative partial least-squares algorithm (NIPALS), developed by H. Wold (1966).

Assuming an initial score vector u which can be arbitrarily chosen from the variables in the input data, the corresponding loading vector is calculated by the input data's transpose times u and normalized to length 1. This approximation can be improved by calculating the input data times the loading vector. Until the improvement does not exceed a small threshold, the improved new vector is used to repeat this procedure. If convergence is reached, the first principal component is subtracted from the currently used matrix, and the resulting residual matrix is used to find the second PC. This procedure is repeated until the desired number of PCs is reached or until the residual matrix contains very small values.

NIPALS will return two matrixes, one containing the scores for each component and one with the loadings for each component. Last, it will return a vector containing how much variance each principal component represents.

Read more about the NIPALS algorithm (and the code this was ported from) at https://cran.r-project.org/web/packages/chemometrics/vignettes/chemometrics-vignette.pdf


This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL