jakevdp / wpca

Weighted Principal Component Analysis (PCA) in Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unit tests are failing

dkirkby opened this issue · comments

The current status with current sklearn and numpy is:

(wpca) wpca% nosetests wpca
..E.................................FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF....................................................................................................................................................

There are two sources of failures:

  • sklearn.utils.estimator_checks expects fit() to set an attribute n_iter_ >= 1.
  • the explained variance computed by WPCA and EMPCA does not match sklearn PCA.

The first is easy to fix (set n_iter_ = 1 in fit()), but I'm not sure what is going on with the second. Did it ever pass? The values don't seem wildly different, but its obviously more than round off, and even more than I would expect from SVD vs eigh, e.g.

 x: array([ 3.007   ,  1.693608,  1.072242,  0.647339,  0.304193])
 y: array([ 3.6084  ,  2.032329,  1.28669 ,  0.776807,  0.365031])