-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
EllipticEnvelope and GraphicalLasso: inconsistent results under different setups #12127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
For the EllipticEnveloppe failure I don't know if that helps but import numpy as np
from sklearn.covariance import EllipticEnvelope
from sklearn.covariance import MinCovDet
from sklearn.utils.testing import assert_array_equal
np.random.seed(0)
real_cov = np.array([[.8, .3], [.3, .4]])
X = np.random.multivariate_normal(mean=[0, 0], cov=real_cov, size=500)
mcd = MinCovDet(random_state=0).fit(X)
env = EllipticEnvelope(random_state=0).fit(X)
assert_array_equal(mcd.covariance_, env.covariance_)
print(mcd.covariance_) returns
|
You put size=300 in the doctest of EllipticEnveloppe but 500 in the doctest of MinCovDet |
Maybe I misunderstood the issue for EllipticEnveloppe but in
the expected result is the one you obtained with n_samples=500 whereas you put n_samples=300. I think that if you put n_samples=500 in the doctest:
the test will pass. |
And the result should be the same for MinCovDet and EllipticEnveloppe |
@albertcthomas, sorry, just had a chance to test them. You're right. That was a silly mistake of mine (copy paste issues). I also investigated the other issue. It's odd, but passing an integer instead of |
While adding examples to docstrings, two models (three classes) show an odd
behavior, i.e. they give different results under different circumstances and they
are not random, since the random
seed
andrand_state
are fixed.The results are deterministic under each setting, but change from setup to
setup.
For instance (observed in PR #12124), the EllipticEnvelope, has the following
issue (this is a failiur on travis).
The same issue was observed in PR #11732, for GraphicalLasso and
GraphicalLassoCV.
Please note that the results are deterministic, i.e. changing the values to
what's reported by travis, would make the test pass, as I've done for the
PR #11732 .
The corresponding code resulting in the issue, is the following:
The text was updated successfully, but these errors were encountered: