pcacov

menpo.math.pcacov(C, eps=1e-10)[source]

Apply Principal Component Analysis (PCA) given a covariance/scatter matrix C. 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:
  • C ((N, N) ndarray or scipy.sparse) – Covariance/Scatter matrix
  • 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.