@@ -118,7 +118,7 @@ def _c_step(X, n_support, random_state, remaining_iterations=30,
118
118
# Iterative procedure for Minimum Covariance Determinant computation
119
119
det = fast_logdet (covariance )
120
120
previous_det = np .inf
121
- while (det < previous_det ) and (remaining_iterations > 0 ) and ( det != - np .inf ):
121
+ while (det < previous_det ) and (remaining_iterations > 0 ) and not ( np .isinf ( det ) ):
122
122
# save old estimates values
123
123
previous_location = location
124
124
previous_covariance = covariance
@@ -140,15 +140,9 @@ def _c_step(X, n_support, random_state, remaining_iterations=30,
140
140
141
141
previous_dist = dist
142
142
dist = (np .dot (X - location , precision ) * (X - location )).sum (axis = 1 )
143
- # Catch computation errors
143
+ # Check if best fit already found (det => 0, logdet => -inf)
144
144
if np .isinf (det ):
145
145
results = location , covariance , det , support , dist
146
- # raise ValueError(
147
- # "Singular covariance matrix. "
148
- # "Please check that the covariance matrix corresponding "
149
- # "to the dataset is full rank and that MinCovDet is used with "
150
- # "Gaussian-distributed data (or at least data drawn from a "
151
- # "unimodal, symmetric distribution.")
152
146
# Check convergence
153
147
if np .allclose (det , previous_det ):
154
148
# c_step procedure converged
0 commit comments