Nonlinear Iterative Partial Least Squares
Simplified Interface
firstPC :: Matrix Double -> (Vector Double, Vector Double, Matrix Double)Source
Calculate the first principal component of a set of samples.
Each row in the matrix is one sample. Note that this is transposed
compared to the implementation of principal components using svd
or leftSV
Example:
let (pc,scores,residuals) = firstPC $ fromRows samples
This is calculated by providing a default estimate of the scores to
firstPCFromScores
firstPCFromScores :: Matrix Double -> Vector Double -> (Vector Double, Vector Double, Matrix Double)Source
Calculate the first principal component of a set of samples given a starting estimate of the scores.
Each row in the matrix is one sample. Note that this is transposed
compared to the implementation of principal components using svd
or leftSV
The second argument is a starting guess for the score vector. If this is close to the actual score vector, then this will cause the algorthm to converge much faster.
Example:
let (pc,scores,residuals) = firstPCFromScores (fromRows samples) scoresGuess