principal_component_decomposition

menpo.math.principal_component_decomposition(X, whiten=False, centre=True, bias=False, inplace=False)[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_features) ndarray) – Training data.
  • whiten (bool, optional) – Normalise the eigenvectors to have unit magnitude.
  • centre (bool, optional) – Whether to centre the data matrix. If False, zero will be subtracted.
  • bias (bool, optional) – Whether to use a biased estimate of the number of samples. If False, subtracts 1 from the number of samples.
  • 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.
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.