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

example

Mdl = KDTreeSearcher(X) grows a default Kd-tree (Mdl) using the n-by-K numeric matrix of training data (X).

KDTreeSearcher(X)使用训练数据(X)的n行k列数字矩阵生长默认的kd-树(Mdl)。

example

Mdl = KDTreeSearcher(X,Name,Value) 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 (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()函数的更多相关文章

  1. Python 小而美的函数

    python提供了一些有趣且实用的函数,如any all zip,这些函数能够大幅简化我们得代码,可以更优雅的处理可迭代的对象,同时使用的时候也得注意一些情况   any any(iterable) ...

  2. 探究javascript对象和数组的异同,及函数变量缓存技巧

    javascript中最经典也最受非议的一句话就是:javascript中一切皆是对象.这篇重点要提到的,就是任何jser都不陌生的Object和Array. 有段时间曾经很诧异,到底两种数据类型用来 ...

  3. JavaScript权威指南 - 函数

    函数本身就是一段JavaScript代码,定义一次但可能被调用任意次.如果函数挂载在一个对象上,作为对象的一个属性,通常这种函数被称作对象的方法.用于初始化一个新创建的对象的函数被称作构造函数. 相对 ...

  4. C++对C的函数拓展

    一,内联函数 1.内联函数的概念 C++中的const常量可以用来代替宏常数的定义,例如:用const int a = 10来替换# define a 10.那么C++中是否有什么解决方案来替代宏代码 ...

  5. 菜鸟Python学习笔记第一天:关于一些函数库的使用

    2017年1月3日 星期二 大一学习一门新的计算机语言真的很难,有时候连函数拼写出错查错都能查半天,没办法,谁让我英语太渣. 关于计算机语言的学习我想还是从C语言学习开始为好,Python有很多语言的 ...

  6. javascript中的this与函数讲解

    前言 javascript中没有块级作用域(es6以前),javascript中作用域分为函数作用域和全局作用域.并且,大家可以认为全局作用域其实就是Window函数的函数作用域,我们编写的js代码, ...

  7. 复杂的 Hash 函数组合有意义吗?

    很久以前看到一篇文章,讲某个大网站储存用户口令时,会经过十分复杂的处理.怎么个复杂记不得了,大概就是先 Hash,结果加上一些特殊字符再 Hash,结果再加上些字符.再倒序.再怎么怎么的.再 Hash ...

  8. JS核心系列:浅谈函数的作用域

    一.作用域(scope) 所谓作用域就是:变量在声明它们的函数体以及这个函数体嵌套的任意函数体内都是有定义的. function scope(){ var foo = "global&quo ...

  9. C++中的时间函数

    C++获取时间函数众多,何时该用什么函数,拿到的是什么时间?该怎么用?很多人都会混淆. 本文是本人经历了几款游戏客户端和服务器开发后,对游戏中时间获取的一点总结. 最早学习游戏客户端时,为了获取最精确 ...

随机推荐

  1. json字符串传值到后台出现乱码的问题的解决方法

    1.原因:前台的编码是ISO-8859-1,后台的编码是UTF-8,所以会冲突 2.解决方法:先用ISO-8859-1解码成字节数组,再转成UTF-8编码格式 String strw = new St ...

  2. Google Code Jam 资格赛: Problem A. Magic Trick

    Note: To advance to the next rounds, you will need to score 25 points. Solving just this problem wil ...

  3. 史上最全的CSS hack方式一览(转)

    做前端多年,虽然不是经常需要hack,但是我们经常会遇到各浏览器表现不一致的情况.基于此,某些情况我们会极不情愿的使用这个不太友好的方式来达到大家要求的页面表现.我个人是不太推荐使用hack的,要知道 ...

  4. PHP里的socket_recv方法解释

    以前一直经为PHP里没有低级的socket帧接收函数,看来是没看仔细,不过那些说明也太少了,(更令人气的里在英文版说明里的例子下有一句话:这个程序不能运行,因为没用listen函数,但在中文版里却没了 ...

  5. 【转】python测试开发面试题

    出处:http://my.oschina.net/u/1433482/blog/467954?fromerr=WrfxL2Kw 试卷时间 60分钟,请不要在试卷上作答,用A4纸做答题纸作答. 一,中文 ...

  6. java数据结构-Vector

    1 Vector基础实现为数组 object[] synchronized线程安全 2 扩容使用  System.arraycopy(original, 0, copy, 0,Math.min(ori ...

  7. PHP中foreach用法详细讲解

    1.foreach是什么? foreach是PHP的一种语法结构,其实就是一个工具,(工具:就是工作的时候用到的器具),那么在程序开发过程中,为了达到程序效果,就用到了foreach. 2.如何用? ...

  8. jqcloud 标签云效果

    官网地址: http://mistic100.github.io/jQCloud/index.htmlgithub 地址: https://github.com/lucaong/jQCloud使用 & ...

  9. 九度OJ 1333:考研海报 (区间操作)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:738 解决:299 题目描述: sun是万千考研学子中的一员,他每天过着三点一线的生活. 学校里有一个公告栏,他每天都看到上面张贴着各种考研 ...

  10. images have the “stationarity” property, which implies that features that are useful in one region are also likely to be useful for other regions.

    Convolutional networks may include local or global pooling layers[clarification needed], which combi ...