FIX Add check array for empirical_covariance - #26108
Conversation
jeremiedbb
left a comment
There was a problem hiding this comment.
Thanks for the PR @qbarthelemy. We don't need it for _oas because it's a private function only called by OAS which already validates X.
Co-authored-by: Jérémie du Boisberranger <[email protected]>
jeremiedbb
left a comment
There was a problem hiding this comment.
Thinking about that again, I think it deserves an entry in the changelog. Please add an entry in v1.3.rst, saying that now empirical_covariance gives an informative error message when input is not appropriate.
Co-authored-by: Jérémie du Boisberranger <[email protected]>
354b832 to
f75cb70
Compare
Co-authored-by: Thomas J. Fan <[email protected]>
Co-authored-by: Thomas J. Fan <[email protected]>
thomasjpfan
left a comment
There was a problem hiding this comment.
Thank you for the update! LGTM
| [0.25, 0.25, 0.25]]) | ||
| """ | ||
| X = np.asarray(X) | ||
| X = check_array(X, ensure_2d=False, force_all_finite=False) |
There was a problem hiding this comment.
For reviewers, I think it's okay to set force_all_finite=False here, which is consistent with the behavior on main. If we set force_all_finite=True, then there can be a performance regression when empirical_covariance is called. The alternative is to set config_context(assume_finite=True) everywhere, but it adds the context manager to many places.
Co-authored-by: Jérémie du Boisberranger <[email protected]> Co-authored-by: Thomas J. Fan <[email protected]>
Reference Issues/PRs
Fixes #25519
What does this implement/fix? Explain your changes.
It adds
check_arraytoempirical_covariance.