如何从点的布局中获取平均值
考虑下面的图片:
我如何获得该点上一个点的“平均值”(未知这叫什么)飞机?例如,如果我在该网格上处于 23、15、45 和 34 之间,它会将所有这些值按距离加权进行平均。例如,在这里我期望类似于 25 的值。
这确实很难解释,如有任何问题,请随时提出。
非常感谢您的帮助, 基多瓦特
Consider the following image:
How would I get the "average" (unknown what this is called) of a point on this plane? For example, if I was in between 23, 15, 45, and 34 on that grid, it would average all them together weighted by distance to each. For example, here I'd expect something like 25.
This is really difficult to explain and feel free to ask any questions you have.
Thanks so much for the help,
Kidovate
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定我是否理解你的意思,但是 - 如果我理解 - 你可以尝试使用 kNN 算法。例如,如果这些点是已知值,并且您想“猜测”任意点的值,则可以使用该算法。
基本上,您必须计算每个已知点与您正在计算的点的距离,然后按距离对向量进行排序并保留前 k 个项目(k 个最近邻居)。然后你可以简单地使用加权平均值。
作为起点:http://en.wikipedia.org/wiki/Nearest-neighbor_interpolation
I'm not sure I did understand what you mean but - if I did - you may try to use a kNN algorithm. For example if that points are known values and you want to "guess" the value of an arbitrary point you can use that algorithm.
Basically you have to calculate the distance of each known point from the point you're calculating then sort the vector by distance and keep first k items (k Nearest Neighbors). Then you can simply use a weighted mean.
As start point: http://en.wikipedia.org/wiki/Nearest-neighbor_interpolation