matlat之KDTreeSearcher()函数
Create Kd-tree nearest neighbor searcher(创建kd-树最近邻搜索器)。
Description
KDTreeSearcher model objects store the results of a nearest neighbor search that uses the Kd-tree algorithm. Results include the training data, distance metric and its parameters, and maximum number of data points in each leaf node (that is, the bucket size). The Kd-tree algorithm partitions an n-by-K data set by recursively splitting n points in K-dimensional space into a binary tree.
KDrelesearcher模型对象存储最近邻搜索的结果,该搜索使用kd-tree算法。结果包括训练数据、距离及其参数,以及每个叶子节点中的最大数据点数目(即BucketSize)。KD-树算法通过递归地将k维空间中的n个点分割为二叉树来分割n行k列数据集。
Once you create a KDTreeSearcher model object, you can search the stored tree to find all neighboring points to the query data by performing a nearest neighbor search using knnsearch or a radius search usingrangesearch. The Kd-tree algorithm is more efficient than the exhaustive search algorithm when K is small (that is, K ≤ 10), the training and query sets are not sparse, and the training and query sets have many observations.
创建KDrelesearcher模型对象后,可以通过使用knnsearch()函数或使用rangesearch()函数搜索执行最近的邻居搜索来搜索所存储的树,以查找查询数据的所有相邻点。当维数K比较小的时候(如k≤10),Kd-tree算法比穷举搜索算法更有效,训练和查询集并不稀疏,训练和查询集具有许多观察结果。
Syntax
Mdl = KDTreeSearcher(X)Mdl = KDTreeSearcher(X,Name,Value)Description
grows a default Kd-tree (Mdl = KDTreeSearcher(X)Mdl) using the n-by-K numeric matrix of training data (X).
KDTreeSearcher(X)使用训练数据(X)的n行k列数字矩阵生长默认的kd-树(Mdl)。
specifies additional options using one or more name-value pair arguments. You can specify the maximum number of data points in each leaf node (that is, the bucket size) and the distance metric, and set the distance metric parameter (Mdl = KDTreeSearcher(X,Name,Value)DistParameter) property. For example,KDTreeSearcher(X,'Distance','minkowski','BucketSize',10) specifies to use the Minkowski distance when searching for nearest neighbors and to use 10 for the bucket size. To specify DistParameter, use the P name-value pair argument.
mdl=kdtreesearcher(x,name,value)使用一个或多个名称-值对参数指定附加选项。您可以在每个叶子节点(即bucket size)和距离度量中指定数据点的最大数量,并设置距离度量参数属性。例如,KDTreeSearcher(x,‘Distance’,‘Minkowski’,‘BucketSize’,10)指定在搜索最近的邻居时使用Minkowski距离,bucket size指定为10。若要指定DistParameter参数,请使用p name-value对参数。
Object Functions 对象函数
knnsearch |
Find k-nearest neighbors using searcher object |
rangesearch |
Find all neighbors within specified distance using searcher object |
knnsearch:用搜索器对象Mdl寻找k个临近点。
rangesearch:使用搜索器对象Mdl以指定的距离范围寻找所有临近点。
举例:
load fisheriris;
X = meas;
[n,k] = size(X);
Mdl1 = KDTreeSearcher(X);
X has 150 observations and 4 predictors.
n=150
k=4
X有150个观测值和4个预测器。(predictors翻译成预测器好像有些别扭!)
Grow a four-dimensional Kd-tree using the entire data set as training data.
使用整个数据集作为训练样本来生成四维KD-树。




总结:Mdl1 = KDTreeSearcher(X);这一句中的原始样本数据和利用原始样本数据建立的KDTreeSearcher(kd树搜索器)是完全一样的,只不过一个是离散的点,一个是对象。
matlat之KDTreeSearcher()函数的更多相关文章
- Python 小而美的函数
python提供了一些有趣且实用的函数,如any all zip,这些函数能够大幅简化我们得代码,可以更优雅的处理可迭代的对象,同时使用的时候也得注意一些情况 any any(iterable) ...
- 探究javascript对象和数组的异同,及函数变量缓存技巧
javascript中最经典也最受非议的一句话就是:javascript中一切皆是对象.这篇重点要提到的,就是任何jser都不陌生的Object和Array. 有段时间曾经很诧异,到底两种数据类型用来 ...
- JavaScript权威指南 - 函数
函数本身就是一段JavaScript代码,定义一次但可能被调用任意次.如果函数挂载在一个对象上,作为对象的一个属性,通常这种函数被称作对象的方法.用于初始化一个新创建的对象的函数被称作构造函数. 相对 ...
- C++对C的函数拓展
一,内联函数 1.内联函数的概念 C++中的const常量可以用来代替宏常数的定义,例如:用const int a = 10来替换# define a 10.那么C++中是否有什么解决方案来替代宏代码 ...
- 菜鸟Python学习笔记第一天:关于一些函数库的使用
2017年1月3日 星期二 大一学习一门新的计算机语言真的很难,有时候连函数拼写出错查错都能查半天,没办法,谁让我英语太渣. 关于计算机语言的学习我想还是从C语言学习开始为好,Python有很多语言的 ...
- javascript中的this与函数讲解
前言 javascript中没有块级作用域(es6以前),javascript中作用域分为函数作用域和全局作用域.并且,大家可以认为全局作用域其实就是Window函数的函数作用域,我们编写的js代码, ...
- 复杂的 Hash 函数组合有意义吗?
很久以前看到一篇文章,讲某个大网站储存用户口令时,会经过十分复杂的处理.怎么个复杂记不得了,大概就是先 Hash,结果加上一些特殊字符再 Hash,结果再加上些字符.再倒序.再怎么怎么的.再 Hash ...
- JS核心系列:浅谈函数的作用域
一.作用域(scope) 所谓作用域就是:变量在声明它们的函数体以及这个函数体嵌套的任意函数体内都是有定义的. function scope(){ var foo = "global&quo ...
- C++中的时间函数
C++获取时间函数众多,何时该用什么函数,拿到的是什么时间?该怎么用?很多人都会混淆. 本文是本人经历了几款游戏客户端和服务器开发后,对游戏中时间获取的一点总结. 最早学习游戏客户端时,为了获取最精确 ...
随机推荐
- Trie|如何用字典树实现搜索引擎的关键词提示功能
Trie字典树 Trie字典树又称前缀树,顾名思义,是查询前缀匹配的一种树形数据结构 可以分为插入(创建) 和 查询两部分.参考地址极客时间 下图为插入字符串的过程: 创建完成后,每个字符串最后一个字 ...
- iOS tableView高度缓存
tableView计算完高度后,把高度缓存起来,避免下次重复计算,以减少不必要的消耗 // declare cellHeightsDictionary NSMutableDictionary *cel ...
- 使用第三方工具Cornerstone搭建本地SVNserver
一.加入版本号资源库 点击Cornerstone左下角REPOSITORIES栏右边的加号button.在弹出的视图中选择File Repository,然后选择Create a New Reposi ...
- Borg Maze - poj 3026(BFS + Kruskal 算法)
Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 9821 Accepted: 3283 Description The B ...
- 数仓interview总结
一 数据库 1.1 数据库事务特性ACID 原子性Atomicity,一致性Consistency,隔离性Isolation,持续性Durability 1.2 锁有几种,及范围 从数据库系统角度分为 ...
- python学习 04 函数参数
1.参数可以传递元组,但是要加* 2.参数可以传递字典,但是要加**
- NYOJ-欧几里得
欧几里得 时间限制:1000 ms | 内存限制:65535 KB 难度:0 描写叙述 已知gcd(a,b)表示a,b的最大公约数. 如今给你一个整数n,你的任务是在区间[1,n)里面找到一个最大 ...
- php-fpm重启失败报错
php-fpm启动命令:/usr/local/php5/sbin/php-fpm 报错:ERROR: unable to bind listening socket for address '127. ...
- 自学宝典:10个学习Android开发的网站推荐
1. Android Developers 作为一个Android开发者,官网的资料当然不可错过,从设计,培训,指南,文档,都不应该错过,在以后的学习过程中慢慢理解体会. 2. Android Gui ...
- Robbery(记忆化搜索)
Robbery Inspector Robstop is very angry. Last night, a bank has been robbed and the robber has not b ...