Repository navigation
FIX MinCovDet: no spurious "Determinant has increased" warning - #35531
Conversation
…changed support The c_step only checked convergence by comparing log-determinants. If the support does not change between two steps, location and covariance are mathematically identical, and a difference of the determinants is numerical noise. This happens in particular for singular covariance matrices, e.g. when n_samples == n_features and the support contains all samples. Treat an unchanged support as convergence. Fitted results are unchanged. Fix the remaining warnings in covariance tests Co-Authored-By: Claude Fable 5.2 <[email protected]>
OmarManzoor
left a comment
There was a problem hiding this comment.
LGTM. Thank you @lorentzenchr
|
@lorentzenchr The CI is failing for a common test: [gw3] linux -- Python 3.12.16 /home/runner/miniconda3/envs/testvenv/bin/python
model = LogisticRegression(l1_ratio=0.5, solver='saga', tol=1e-15)
with_sample_weight = False, global_random_seed = 0
FAILED linear_model/tests/test_common.py::test_balance_property[0-False-LogisticRegression] - assert np.float64(0.4462582590512244) == 0.44 ± 0.0044This might be related to the I think we might need to adjust the tolerance or the parameters, or remove the |
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
❌ Linting issuesThere was an issue running the linter job. Please update with |
Reference Issues/PRs
Follow-up of #35476, towards a warning-free test suite (see #5685).
What does this implement/fix? Explain your changes.
With this PR,
pytest -W error -W "ignore::sklearn.exceptions.SkipTestWarning" sklearn/covariancepasses. It had 3 failures before.
Fix in
MinCovDetThe C-step only checked convergence by comparing log-determinants. If the
support does not change between two steps, location and covariance are
mathematically identical, and any difference of the determinants is numerical
noise. For singular covariance matrices, this noise triggered
for example when
n_samples == n_features, where the support contains allsamples, so that raising
support_fractioncannot help.An unchanged support is now treated as convergence. Example:
AI usage disclosure
Claude Fable for
MinCovDetbug.I reviewed all changes.