numpy - calculating distance matrix of a given row-wise vector matrix -
suppose have matrix nxm accommodating row vectors. want have distance matrix nxn presents distance of each vector each other. how can in python using numpy. know scipy want dirst hands. write cosine similarity function cos_dist(a,b) , b 2 different vectors. need caller function doing each couple of items efficiently. how it?
why don't check on scipy's spatial.distance.pdist(), computes pairwise distances between observations in n-dimensional space , has vast number of distance functions choose from?
since don't have scipy installed , want code using numpy, suggest study its source code, linked @ top-left of documentation page.
Comments
Post a Comment