menpo.math.pcacov(C, is_inverse=False, eps=1e-05)[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.

  • C ((N, N) ndarray or scipy.sparse) – The Covariance/Scatter matrix. If it is a precision matrix (inverse covariance), then set is_inverse=True.

  • is_inverse (bool, optional) – It True, then it is assumed that C is a precision matrix ( inverse covariance). Thus, the eigenvalues will be inverted. If False, then it is assumed that C is a covariance 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.


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

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