nearest-neighbor

How to filter numpy array by list of indices?

你说的曾经没有我的故事 提交于 2019-12-18 07:59:48
问题 I am relatively new to python and have been trying to learn how to use numpy and scipy. I have a numpy array comprised of LAS data [x, y, z, intensity, classification]. I have created a cKDTree of points and have found nearest neighbors using query_ball_point. I would like to find standard deviation of the z values for the neighbors returned by query_ball_point, which returns a list of indices for the point and its neighbors. Is there a way to filter filtered__rows to create an array of only

How to filter numpy array by list of indices?

微笑、不失礼 提交于 2019-12-18 07:58:49
问题 I am relatively new to python and have been trying to learn how to use numpy and scipy. I have a numpy array comprised of LAS data [x, y, z, intensity, classification]. I have created a cKDTree of points and have found nearest neighbors using query_ball_point. I would like to find standard deviation of the z values for the neighbors returned by query_ball_point, which returns a list of indices for the point and its neighbors. Is there a way to filter filtered__rows to create an array of only

Two sets of high dimensional points: Find the nearest neighbour in the other set

送分小仙女□ 提交于 2019-12-18 07:18:31
问题 I have 2 sets: A and B. Both sets contain the same number of high dimensional points. How do I find the nearest neighbour in Set A for every point in Set B? I thought about using a Voronoi diagram but it seems (according to wikipedia) that it is not suitable for dimensions higher than 2. Can someone suggest a method to me, please? 回答1: FLANN If your data do really lie in a high dimensional space, then you could use FLANN. It actually builds a number of rotated kd-trees and queries (a bit)

Algorithm to find for all points in set A the nearest neighbor in set B

旧街凉风 提交于 2019-12-18 01:05:15
问题 Suppose we have two sets of points A, B, and we want to find for every point in set A its nearest neighbor in set B. There are many good algorithms to find the nearest neighbor for one point. Is there some way to use the information we got for a_1, to more efficiently search for the nearest neighbor for a_2 or other points in the set? I am thinking something like: use triangular inequlity to get a interval for possible distance between every point in B and new point a_2, and sort the max and

Nearest Neighbor Search: Python

╄→гoц情女王★ 提交于 2019-12-17 22:08:04
问题 I have a 2 dimensional array: MyArray = array([6588252.24, 1933573.3, 212.79, 0, 0], [6588253.79, 1933602.89, 212.66, 0, 0], etc...) The first two elements MyArray[0] and MyArray[1] are the X and Y coordinates of the points. For every element in the array, I would like to find the quickest way to return its single nearest neighbor in a radius of X units. We are assuming this is in 2D space. lets say for this example X = 6 . I have solved the problem by comparing every element to every other

Number of buckets in LSH

社会主义新天地 提交于 2019-12-14 01:26:50
问题 In LSH, you hash slices of the documents into buckets. The idea is that these documents that fell into the same buckets will be potentially similar, thus a nearest neighbor, possibly. For 40.000 documents, what is a good value (pretty much) for the number of buckets? I have it as: number_of_buckets = 40.000/4 now, but I feel it can be reduced more. Any ideas, please ? Relative: How to hash vectors into buckets in Locality Sensitive Hashing (using jaccard distance)? 回答1: A common starting

Content Based Image Retrieval (CBIR): Bag of Features or Descriptors Matching?

泄露秘密 提交于 2019-12-13 00:19:20
问题 I've read a lot of papers about the Nearest Neighbor problem, and it seems that indexing techniques like randomized kd-trees or LSH has been successfully used for Content Based Image Retrieval (CBIR), which can operate in high dimensional space. One really common experiment is given a SIFT query vector, find the most similar SIFT descriptor in the dataset. If we repeat the process with all the detected SIFT descriptors we can find the most similar image. However, another popular approach is

Calculation of Contact/Coordination number with Periodic Boundary Conditions

强颜欢笑 提交于 2019-12-12 01:39:47
问题 I have data for N atoms including the radius of each atom, the position of each atom and the box dimensions. I want to calculate the number of atoms each atom is in contact with and store the result. This is equivalent to calculating the number of atoms within a specified cutoff distance. The box has periodic boundary conditions, and hence a difficulty arises in remapping atoms such that the distance calculated between each atom is the minimum possible. Here is what I have so far: import

Local Sensitive Hashing using a arbitray non euclidean metric

风格不统一 提交于 2019-12-11 11:59:13
问题 I have a very specific question. I work on a project, were I need to find nearest neighbours (k and near). As I dont need the excat ones and want to be able to extend to high dimensions, I focused on LSH. My data has a distance that is a metric, but non euclidean. I found many ways for vector space with euclidean metric (e.g. the p stable distribution), binary coding(via projections) or string based. What I am searching are papers that present a LSH template for an arbitrary metric. Does

Using Google's C KD Tree Library

我与影子孤独终老i 提交于 2019-12-11 10:32:43
问题 Google has a KD Tree Library written in C: Here As far as I can tell, you insert notes into the tree using one of it's functions, and then query the tree for nearest neighbors. It returns a pointer to a new array (as far as I can tell). Here is my goal: I have a 3D array and I am hoping to find a way to return the index of a given point's nearest neighbor. I want to say: Here is a point: (12,23,14), now tell me the index of the point that is closest ex: "it is the 5th item in your array".