Created
November 20, 2012 13:35
-
-
Save weilinear/4117966 to your computer and use it in GitHub Desktop.
Manhattan Distances for Sparse Matrix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scipy.sparse import csr_matrix | |
from sklearn.metrics.pairwise import manhattan_distances | |
A = csr_matrix(np.array([[1,2,3],[8,9,0]],dtype=np.float)) | |
B = csr_matrix(np.array([[1,2,4],[3,4,5]],dtype=np.float)) | |
C = manhattan_distances(A, B) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment