def batch_pdist(data_slice):
# Each data_slice has tuples consisting of two points that we need to
# find the great circle distance between and their weight:
partial_sum = 0
for X, Y, weights in data_slice:
dist = np.array([])
zipped = zip(X, Y)
for x, y in zipped:
dist = np.append(dist, great_circle(x, y).km)
partial_sum += np.sum(weights * dist )
return partial_sum
# return 10
geo_pairwise_distance.py 文件源码
python
阅读 19
收藏 0
点赞 0
评论 0
评论列表
文章目录