# pca¶

menpo.math.pca(X, centre=True, inplace=False, eps=1e-10)[source]

Apply Principal Component Analysis (PCA) on the data matrix X. In the case where the data matrix is very large, it is advisable to set inplace = True. However, note this destructively edits the data matrix by subtracting the mean inplace.

Parameters
• X ((n_samples, n_dims) ndarray) – Data matrix.

• centre (bool, optional) – Whether to centre the data matrix. If False, zero will be subtracted.

• inplace (bool, optional) – Whether to do the mean subtracting inplace or not. This is crucial if the data matrix is greater than half the available memory size.

• eps (float, optional) – Tolerance value for positive eigenvalue. Those eigenvalues smaller than the specified eps value, together with their corresponding eigenvectors, will be automatically discarded.

Returns

• U (eigenvectors) (((n_components, n_dims)) ndarray) – Eigenvectors of the data matrix.

• l (eigenvalues) ((n_components,) ndarray) – Positive eigenvalues of the data matrix.

• m (mean vector) ((n_dimensions,) ndarray) – Mean that was subtracted from the data matrix.