8000 MNT: Use `nrm2` to find the residuals squared (#11923) · scikit-learn/scikit-learn@e00817d · GitHub
[go: up one dir, main page]

Skip to content

Commit e00817d

Browse files
jakirkhamjnothman
authored andcommitted
MNT: Use nrm2 to find the residuals squared (#11923)
1 parent 8cbb131 commit e00817d

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

sklearn/decomposition/dict_learning.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,7 @@ def _update_dict(dictionary, Y, code, verbose=False, return_r2=False,
411411
# R <- -1.0 * U_k * V_k^T + R
412412
R = ger(-1.0, dictionary[:, k], code[k, :], a=R, overwrite_a=True)
413413
if return_r2:
414-
R **= 2
415-
R = R.sum()
414+
R = nrm2(R) ** 2.0
416415
return dictionary, R
417416
return dictionary
418417

0 commit comments

Comments
 (0)
0