Skip to content

Commit

Permalink
remove np.sqrt and unnecessary commentout
Browse files Browse the repository at this point in the history
  • Loading branch information
tsurubee committed Feb 2, 2019
1 parent e08bfb1 commit 97455e2
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions banpei/sst.py
Expand Up @@ -134,10 +134,7 @@ def _calculate_score_by_lanczos(self, tra_matrix, test_matrix):
P = np.dot(tra_matrix, tra_matrix.T)
T = tridiagonalize_by_lanczos(P, m, k)
eigenvalue, eigenvectors = tridiag_eigen(T)

# `eig()` returns unordered eigenvalues,
# so the top-r eigenvectors should be picked carefully
return 1 - np.sqrt(np.sum(eigenvectors[0, np.argsort(eigenvalue)[::-1][:self.m]] ** 2))
return 1 - np.sum(eigenvectors[0, np.argsort(eigenvalue)[::-1][:self.m]] ** 2)

def _extract_matrix(self, data, start, end, w):
row = w
Expand Down

0 comments on commit 97455e2

Please sign in to comment.