ipca

menpo.math.ipca(B, U_a, l_a, n_a, m_a=None, f=1.0, eps=1e-10)[source]

Perform Incremental PCA on the eigenvectors U_a, eigenvalues l_a and mean vector m_a (if present) given a new data matrix B.

Parameters
  • B ((n_samples, n_dims) ndarray) – New data matrix.

  • U_a ((n_components, n_dims) ndarray) – Eigenvectors to be updated.

  • l_a ((n_components) ndarray) – Eigenvalues to be updated.

  • n_a (int) – Total number of samples used to produce U_a, s_a and m_a.

  • m_a ((n_dims,) ndarray, optional) – Mean to be updated. If None or (n_dims,) ndarray filled with 0s the data matrix will not be centred.

  • f ([0, 1] float, optional) – Forgetting factor that weights the relative contribution of new samples vs old samples. If 1.0, all samples are weighted equally and, hence, the results is the exact same as performing batch PCA on the concatenated list of old and new simples. If <1.0, more emphasis is put on the new samples. See [1] for details.

  • 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) – Updated eigenvectors.

  • s (eigenvalues) ((n_components,) ndarray) – Updated positive eigenvalues.

  • m (mean vector) ((n_dims,) ndarray) – Updated mean.

References

1

David Ross, Jongwoo Lim, Ruei-Sung Lin, Ming-Hsuan Yang. “Incremental Learning for Robust Visual Tracking”. IJCV, 2007.