sbailey / empca

Principal Component Analysis (PCA) for Missing and/or Noisy Data
Other
77 stars 23 forks source link

nan not allow in input data even if weight=0 #2

Open sbailey opened 8 years ago

sbailey commented 8 years ago

As reported by Lingfeng Cheng at Cornell, input data cannot have NaN values even if the corresponding values are masked with weights=0. Normally masked data (weights=0) are effectively ignored via line 247:

b = A.T.dot( w*b )

But if any of the data in b are NaN, this results in a NaN output, not a 0 output for that element even if w (=weights) is 0. This results in an error like:

ValueError: On entry to DGELSD parameter number 6 had an illegal value

At minimum, catch NaNs in the input and report as a meaningful error. Explore whether masked NaNs can be ignored without requiring rewriting or recopying the input array.