nearest-neighbor

R function to calculate nearest neighbor distance given [inconsistent] constraint?

给你一囗甜甜゛ 提交于 2020-02-21 05:57:42
问题 I have data consisting of tree growth measurements (diameter and height) for trees at known X & Y coordinates. I'd like to determine the distance to each tree's nearest neighbor of equal or greater size . I've seen other SE questions asking about nearest neighbor calculations (e.g., see here, here, here, here, etc.), but none specify constraints on the nearest neighbor to be searched. Is there a function (or other work around) that would allow me to determine the distance of a point's nearest

Nearest neighbor search in 2D using a grid partitioning

旧街凉风 提交于 2020-02-02 04:18:07
问题 I have a fairly large set of 2D points (~20000) in a set, and for each point in the x-y plane want to determine which point from the set is closest. (Actually, the points are of different types, and I just want to know which type is closest. And the x-y plane is a bitmap, say 640x480.) From this answer to the question "All k nearest neighbors in 2D, C++" I got the idea to make a grid. I created n*m C++ vectors and put the points in the vector, depending on which bin it falls into. The idea is

Nearest neighbor search in 2D using a grid partitioning

青春壹個敷衍的年華 提交于 2020-02-02 04:17:21
问题 I have a fairly large set of 2D points (~20000) in a set, and for each point in the x-y plane want to determine which point from the set is closest. (Actually, the points are of different types, and I just want to know which type is closest. And the x-y plane is a bitmap, say 640x480.) From this answer to the question "All k nearest neighbors in 2D, C++" I got the idea to make a grid. I created n*m C++ vectors and put the points in the vector, depending on which bin it falls into. The idea is

finding nearest neighbor for python numpy.ndarray in 3d-space

帅比萌擦擦* 提交于 2020-01-30 07:00:50
问题 I have a numpy.ndarray of 3d-points, i.e. the np.shape of it is (4350,3) and such a second numpy.ndarray of 3d-points of np.shape (10510,3). Now I am trying to find the right python-package to calculate the nearest neighbors in the second array of the points in the first array as quickly as possible. I've found a quite similar question here: find the k nearest neighbours of a point in 3d space with python numpy but I don't understand how to use the solution there for my problem. I'd very,

Numpy - Finding Nearest Neighbors of a Matrix Multiplication

怎甘沉沦 提交于 2020-01-29 05:40:26
问题 I have a dataset of a thousand 128 dimensional features in the shape of e.g. (1000,128). I want to find the sorted nearest neighbors of a 128 dimensional feature in the shape of (128,1). The distance in calculated via a Matrix Multiplication between dataset (1000,128) and feature (128,1) which would give an array of similarities in the shape of (1000,1) : DATASET (1000,128) x FEATURE (128,1) = SIMILARITIES (1000,1) This is done via: # features.shape=(1000,128) ; feature.shape=(128,1) ;

nearest neighbour search kdTree

心不动则不痛 提交于 2020-01-24 17:30:05
问题 To a list of N points [(x_1,y_1), (x_2,y_2), ... ] I am trying to find the nearest neighbours to each point based on distance. My dataset is too large to use a brute force approach so a KDtree seems best. Rather than implement one from scratch I see that sklearn.neighbors.KDTree can find the nearest neighbours. Can this be used to find the nearest neighbours of each particle, i.e return a dim(N) list? 回答1: This question is very broad and missing details. It's unclear what you did try, how

Example data set for the k-Nearest Neighbors algorithm?

半城伤御伤魂 提交于 2020-01-24 10:54:28
问题 What is an example of a data set one would use with the k-Nearest Neighbors algorithm? I understand the concept but I am unsure about what kind of data one would use for the x, y coordinates. Can one provide an example of a dataset (with x, y coordinates) for the nearest-neighbor-k algorithm ? 回答1: NN search is in a simple way this: You have a database of elements (here you have 2 dimensional points, with coordinates x and y ). A query comes, which is the same type of the elements of the

Example data set for the k-Nearest Neighbors algorithm?

让人想犯罪 __ 提交于 2020-01-24 10:54:06
问题 What is an example of a data set one would use with the k-Nearest Neighbors algorithm? I understand the concept but I am unsure about what kind of data one would use for the x, y coordinates. Can one provide an example of a dataset (with x, y coordinates) for the nearest-neighbor-k algorithm ? 回答1: NN search is in a simple way this: You have a database of elements (here you have 2 dimensional points, with coordinates x and y ). A query comes, which is the same type of the elements of the

Nearest neighbors in a given range

社会主义新天地 提交于 2020-01-15 04:01:08
问题 I faced the problem of quickly finding the nearest neighbors in a given range. Example of dataset: id | string | float 0 | AA | 0.1 12 | BB | 0.5 2 | CC | 0.3 102| AA | 1.1 33 | AA | 2.8 17 | AA | 0.5 For each line, print the number of lines satisfying the following conditions: string field is equal to current float field <= current float - del For this example with del = 1.5: id | count 0 | 0 12 | 0 2 | 0 102| 2 (string is equal row with id=0,33,17 but only in row id=0,17 float value: 1.1-1

Best GPU algorithm for calculating lists of neighbours

不羁的心 提交于 2020-01-13 12:16:28
问题 Given a collection of thousands of points in 3D, I need to get the list of neighbours for each particle that fall inside some cutoff value (in terms of euclidean distance), and if possible, sorted from nearest fo farthest. Which is the fastest GPU algorithm for this purpose in the CUDA or OpenCL languages? 回答1: One of the fastest GPU MD codes I'm aware of, HALMD, uses a (highly tuned) version of the same sort of approach that is used in the CUDA SDK examples, "Particles". Both the HALMD paper