kdtree

Search for all nearest neighbors within a certain radius of a point in 3D?

天涯浪子 提交于 2019-12-23 03:09:49
问题 I have about 80 million spatial points(3D) and I want to find all the nearest neighbors of a query point which lie under a sphere of a certain radius(can be given as input) with the query point as center. I have read about some data structures that are used for such kind of search, such as Kd-trees, octrees or range trees. For my application, I only need to populate the data structure once and then search for multiple query points. My question is: Is there any better way or a better data

how to add/remove data points to/from a scikit-learn KD-Tree?

╄→гoц情女王★ 提交于 2019-12-22 09:51:48
问题 I am wondering if it is possible to add or remove data points from a scikit-lern KD-Tree instance after its creation ? For example: from sklearn.neighbors import KDTree import numpy as np X = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]]) kdt = KDTree(X, leaf_size=30, metric='euclidean') ''' Do another stuff ''' # Then, I want to add [8,3] point to kdt without rebuilding it again # How to remove [-2,-1] from kdt ? I did not find such information in the KD-Tree documentation

Local maxima in a point cloud

旧巷老猫 提交于 2019-12-21 02:56:12
问题 I have a point cloud C, where each point has an associated value. Lets say the points are in 2-d space, so each point can be represented with the triplet (x, y, v). I'd like to find the subset of points which are local maxima. That is, for some radius R, I would like to find the subset of points S in C such that for any point Pi (with value vi) in S, there is no point Pj in C within R distance of Pi whose value vj is greater that vi. I see how I could do this in O(N^2) time, but that seems

efficient way to handle 2d line segments

只谈情不闲聊 提交于 2019-12-20 11:06:02
问题 I am having huge set of 2D line segments. So, I know; Line number, Begin (X,Y,Z) and End (x,Y,Z) of each line segment. I want to get proximity line segments for a given line segment. Likewise for all. To find the proximity I can apply this If I say my data it is as; So, at the end I want to get proximity lines as a vector for each line segment . I heard this type of vector of vector can be taken with r-tree data structures. I was searching it but still could not find the relevant one for me.

蚂蚁金服 ZSearch 在向量检索上的探索

不羁的心 提交于 2019-12-19 11:26:19
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 图为 ZSearch 基础架构负责人十倍 2019 Elastic Dev Day 现场分享 引言 ElasticSearch(简称 ES)是一个非常受欢迎的分布式全文检索系统,常用于数据分析,搜索,多维过滤等场景。蚂蚁金服从2017年开始向内部业务方提供 ElasticSearch 服务,我们在蚂蚁金服的金融级场景下,总结了不少经验,此次主要给大家分享我们在向量检索上的探索。 ElasticSearch 的痛点 ElasticSearch 广泛应用于蚂蚁金服内部的日志分析、多维分析、搜索等场景。当我们的 ElasticSearch 集群越来越多,用户场景越来越丰富,我们会面临越来越多的痛点: 如何管理集群; 如何方便用户接入和管理用户; 如何支持用户不同的个性化需求; ... 为了解决这些痛点,我们开发了 ZSearch 通用搜索平台: 基于 K8s 底座,快速创建 ZSearch 组件,快捷运维,故障机自动替换; 跨机房复制,重要业务方高保; 插件平台,用户自定义插件热加载; SmartSearch 简化用户搜索,开箱即用; Router 配合 ES 内部多租户插件,提高资源利用率; 向量检索需求 基于 ElasticSearch 的通用搜索平台 ZSearch 日趋完善,用户越来越多,场景更加丰富。

KDTree for longitude/latitude

南楼画角 提交于 2019-12-18 02:48:23
问题 Are there any packages in Python that allow one to do kdtree-like operations for longitude/latitudes on the surface of a sphere? (this would need to take into account the spherical distances properly, as well as the wraparound in longitude). 回答1: A binary search tree cannot handle the wraparound of the polar representation by design. You might need to transform the coordinates to a 3D cartesian space and then apply your favorite search algorithm, e.g., kD-Tree, Octree etc. Alternatively, if

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

Why is the kd-tree a main memory structure?

自作多情 提交于 2019-12-12 04:55:48
问题 I'm just wondering why the kd-tree is always considered as a main memory structure. This means that every node is kept in main memory, doesn't it? Compared to B-trees (where every node should fit into one disk block), this doesn't make too much sense to me. Could anyone explain that? Thanks :) 回答1: To efficiently store the tree on the disk, it should fit into 8k pages (the page size of most harddrives). With a k-d-tree this would be enormous waste, and very inefficient. Thus, writing the k-d

SciPy KDTree distance units?

☆樱花仙子☆ 提交于 2019-12-11 23:04:03
问题 Let's say I have and array, where column 1 is in feet, column 2 is in feet, and column 3 is in seconds. For example: x = [50 40 30] I then have another array, y , with the same units and same number of columns, but many rows. I then turn it into a KDTree with Scipy: tree = scipy.KDTree(y) and then query that tree: distance,index = tree.query(x,k=1) By default, I believe the distance is calculated based on the Euclidean norm. So for example, distance might be: print distance [34] What units

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".