码迷,mamicode.com
首页 > 其他好文 > 详细

geometric median

时间:2014-10-11 21:09:46      阅读:222      评论:0      收藏:0      [点我收藏+]

标签:des   io   ar   for   数据   sp   问题   on   amp   

The geometric median of a discrete set of sample points in a Euclidean space is the point minimizing the sum of distances to the sample points. This generalizes the median, which has the property of minimizing the sum of distances for one-dimensional data, and provides a central tendency in higher dimensions.

也就是说,中位数就是一个数组里到所有其他数据点的距离之和达到最小值的点。n维的也一样。

一维的中位数满足这个性质,证明的话可以用反证法。可以证明的到的是,中位数往左一点或者往右一点都会造成距离之和增加,所以中位数是到其他点的距离之和最小。

$Geometric Median =\underset{y \in \mathbb{R}^n}{\operatorname{arg\,min}} \sum_{i=1}^m \left \| x_i-y \right \|_2$

然后,问题来了。。。

Q:Given set of points in 2d grid space. Find a grid point such that sum
of distance from all the points to this common point is minimum.

eg: p1: [0, 0] p2: [3, 0] p3: [0, 3]

ans: r: [0,0]

sum: 0 + 3 + 3 = 6

这题naive 方法就是$O(n^2)$,求出所有点到其他点的距离之和,再取最小。

 

geometric median

标签:des   io   ar   for   数据   sp   问题   on   amp   

原文地址:http://www.cnblogs.com/linyx/p/4019658.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!