Numpy: Vectorize Sum Of Distances To A Set Of Points
I'm trying to implementing a k-medoids clustering algorithm in Python/NumPy. As part of this algo, I have to compute the sum of distances from objects to their 'medoids' (cluster r
Solution 1:
How about:
In [17]: D[np.arange(n_samples),medoids[cl]].sum()
Out[17]: 10.777269629999999
Post a Comment for "Numpy: Vectorize Sum Of Distances To A Set Of Points"