principal_component_decomposition¶
- menpo.math.decomposition.principal_component_decomposition(X, whiten=False, center=True, bias=False, inplace=False)[source]¶
Apply 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 this destructively edits the data matrix by subtracting the mean inplace.
Parameters: x : (n_samples, n_features) ndarray
Training data
whiten : bool, optional
Normalise the eigenvectors to have unit magnitude
Default: False
center : bool, optional
Whether to center the data matrix. If False, zero will be subtracted.
Default: True
bias : bool, optional
Whether to use a biased estimate of the number of samples. If False, subtracts 1 from the number of samples.
Default: False
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.
Default: False
Returns: eigenvectors : (n_components, n_features) ndarray
The eigenvectors of the data matrix
eigenvalues : (n_components,) ndarray
The positive eigenvalues from the data matrix
mean_vector : (n_components,) ndarray
The mean that was subtracted from the dataset