从成对距离集中确定点
给定点之间的距离矩阵,是否有一种算法可以确定具有这些距离的一组 n 维点? (或者至少最小化误差)
有点像收费公路问题的 n 维版本。
我能想到的最好的方法是使用多维缩放。
given a matrix of distances between points is there an algorithm for determining a set of n-dimensional points that has these distances? (or at least minimises the error)
sort of like a n-dimensional version of the turnpike problem.
The best I can come up with is using multidimensional scaling.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
多维缩放 (MDS) 的方向是正确的,但 MDS 对于大型数据集来说是不切实际的,因为它的时间复杂度是点数的二次方。 您可能想看看 FastMap,它具有线性时间复杂度并且更适合索引。 看:
You are on the right track with multi-dimensional scaling (MDS), but MDS is impractical for large datasets, as its time complexity is quadratic in the number of points. You may want to look at FastMap, which has linear time complexity and is better suited to indexing. See:
您可以“作弊”并为此使用迭代数值方法。 最初将所有点置于一些“随机”位置,然后循环遍历它们,将它们按所需距离的比例彼此远离。 这会更喜欢一些点,但在应用它们之前对移动进行平均,然后应用平均值将消除这个问题。 这是一个 O(n²) 算法,但实现和理解非常简单。 在下面的二维示例中,错误为 << 10%,但如果给出的距离不切实际,它可能表现得不太好。
C++ 示例:
You can "cheat" and use an iterative numerical method for this. Take all of the points to be in some "random" positions initially, and then loop through them, moving them away from each other proportionally to the required distance. This will prefer some points, but taking an average of the moves before applying them, then applying the average will remove this problem. This is an O(n²) algorithm, but very simple to implement and understand. In the 2-d example below the error is << 10%, though it may not behave so well if the distances given are unrealistic.
C++ Example:
集体智能编程,第 11 页中有一个用于执行此操作的算法。 49,“查看二维数据”,可适用于 n 维。
嘿——这是多维尺度——所以我猜你走在正确的轨道上。
There is an algorithm for doing this in Programming Collective Intelligence, p. 49, "Viewing Data in Two Dimensions", which could be adapted for n-dimensions.
Hey -- it's multidimensional scaling -- so I guess you are on the right track.
我无法编辑原文,因为我没有足够的代表,但我尝试在这里重述问题。
OP 有一个输入 NxN 距离矩阵。 他想要创建一个输出数组,大小为 N,由代表点的 N 维坐标组成,其中每个点之间的距离存储在输入矩阵中。
请注意,这在一般情况下是无法解决的:
假设我有一个像这样的矩阵,
A 距离 B 1 个距离单位(比如 1 米),A 距离 C 1 米。但是 B 和 C 在同一位置点。
在这种特殊情况下,最小误差总和为 1 米,并且有无数种解决方案可以实现该结果
I can't edit the original, because I don't have enough rep, but I've tried to restate the problem here.
The OP has an input NxN matrix of distances. He wants to create an output array, size N, of N-dimensional coordinates representing points, where the distance between each point is stored in the input matrix.
Note that this is not solvable in the general case:
Suppose I have a matrix like this
A is 1 unit of distance (say 1 metre) away from B, and A is one metre away from C. But B and C are in the same spot.
In this particular case the minimal sum of errors is 1 metre, and there are an infinite variety of solutions which achieve that result