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++获取时间函数众多,何时该用什么函数,拿到的是什么时间?该怎么用?很多人都会混淆. 本文是本人经历了几款游戏客户端和服务器开发后,对游戏中时间获取的一点总结. 最早学习游戏客户端时,为了获取最精确 ...
随机推荐
- Iwfu-GitHubclient使用
Git/GitHub介绍 GitHub是著名的项目托管平台,有关Git和GitHub的介绍參考以下链接: Git介绍 url=OlagjwbaAdSJ2pjckgJCLBYd-LFFTDBriRnLt ...
- 《TomCat与Java Web开发技术详解》(第二版) 第八章节的学习总结 -- 访问mysql
终于学到如何访问Mysql了 1. 可以看看此章节提供的sql脚本,以后可以照着写了.此外,对于Mysql如何使用,最好的地方就是其官网介绍了.http://dev.mysql.com/doc/ref ...
- [C++]二维数组还是一维数组?
记得刚学习C++那会这个问题曾困扰过我,后来慢慢形成了不管什么时候都用一维数组的习惯,再后来知道了在一维数组中提出首列元素地址进行二维调用的办法.可从来没有细想过这个问题,最近自己写了点代码测试下,虽 ...
- shiro自定义拦截url
在实际项目上,我们针对不同的用户(guste,user,admin,mobile user)等等,需要进入不同的页面,比如,手机端用户需要进入Mobile/这个路径下的,这个时候,我们需要自定义拦截u ...
- Linux1_Ubuntu的安装
安装Ubuntu双系统大致有两种方式: 如果是Vmware+linux系统的话,先下载个securable.exe监测本机是否支持虚拟机的安装 1) wubi.exe安装(13.*版本不支持)2) 刻 ...
- diamond源码阅读-目录监控
PathNode(Path)StandardWatchEventKind(WatchEvent)Watchable(WatchKey WatchService WatchEvent)WatchKey( ...
- Shiro 认证失败返回JSON
Shiro框架默认认证失败后会返回到登录页面,在前后端分离项目中,需要返回JSON数据,以便前端或者app端解析处理. 实现方式: 1. 扩展shiro框架的UserFilter类,重写redirec ...
- Miller-Rabin大素数测试模板
根据费马小定理: 对于素数n,a(0<a<n),a^(n-1)=1(mod n) 如果对于一个<n的正整数a,a^(n-1)!=1(mod n),则n必不是素数. 然后就可以随机生成 ...
- Bag of mice(概率DP)
Bag of mice CodeForces - 148D The dragon and the princess are arguing about what to do on the New Y ...
- Android笔记之OnLongClickListener
OnLongClickListener中的回调函数boolean onLongClick(View v),其返回值的官方释义如下 如果这个回调消耗了长点击,则返回true,否则返回false. 即使翻 ...