File tree Expand file tree Collapse file tree 1 file changed +1
-9
lines changed Expand file tree Collapse file tree 1 file changed +1
-9
lines changed Original file line number Diff line number Diff line change @@ -463,15 +463,7 @@ class distributions will exceed 1 (normalization may be desired).
463
463
affinity_matrix = self ._get_kernel (self .X_ )
464
464
normalizer = affinity_matrix .sum (axis = 0 )
465
465
if sparse .issparse (affinity_matrix ):
466
- normalizer = np .array (normalizer ) # convert np.matrix to np.array
467
- if normalizer .ndim == 2 :
468
- # old spmatrix treatment. RHS is a scalar (b/c normalizer is 2D row)
469
- affinity_matrix .data /= np .diag (normalizer )
470
- else :
471
- # We could use the (questionable) spmatrix treatment using:
472
- # affinity_matrix.data /= np.diag(np.array(normalizer[np.newaxis, :]))
473
- # Instead: use numpy treatment dividing each row by its normalizer.
474
- affinity_matrix .data /= normalizer [affinity_matrix .indices ]
466
+ affinity_matrix .data /= np .diag (np .array (normalizer ))
475
467
else :
476
468
affinity_matrix /= normalizer [:, np .newaxis ]
477
469
return affinity_matrix
You can’t perform that action at this time.
0 commit comments