8000 Add comments on optimized precision computations. · seckcoder/scikit-learn@602bac4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 602bac4

Browse files
VirgileFritschamueller
authored andcommitted
Add comments on optimized precision computations.
1 parent 4829341 commit 602bac4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

sklearn/covariance/robust_covariance.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ def fast_mcd(X, support_fraction=None,
343343
support[np.argsort(np.abs(X - location), axis=0)[:n_support]] = True
344344
covariance = np.asarray([[np.var(X[support])]])
345345
location = np.array([location])
346+
# get precision matrix in an optimized way
346347
precision = symmetric_pinv(covariance)
347348
dist = (np.dot(X_centered, precision) \
348349
* (X_centered)).sum(axis=1)
@@ -543,6 +544,7 @@ def fit(self, X):
543544
raw_location = np.zeros(n_features)
544545
raw_covariance = self._nonrobust_covariance(
545546
X[raw_support], assume_centered=True)
547+
# get precision matrix in an optimized way
546548
precision = symmetric_pinv(raw_covariance)
547549
raw_dist = np.sum(np.dot(X, precision) * X, 1)
548550
self.raw_location_ = raw_location

0 commit comments

Comments
 (0)
0