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. poj3411--Paid Roads(bfs+状压)

    题目链接:id=3411">点击打开链接 题目大意:有n个点.m条有向边,经过边须要一个花费,a b c p q代表 a到b的一条道路,假设经过这条边之前经过c点,那么须要p的花费,否 ...

  2. java.lang.IllegalArgumentException: Request header is too large的解决方法

    <Connector port="8080" protocol="HTTP/1.1"               connectionTimeout=&q ...

  3. iOS 控制器title和tabbar的title设置问题

    iOS 设置tabbarItem的title的是通过 controller.tabBarItem.title = @"标题" iOS 设置导航栏控制器title通过 contoll ...

  4. vim与windows/linux之间的复制粘贴小结

    vim与windows/linux之间的复制粘贴小结 用 vim这么久了,始终也不知道怎么在vim中使用系统粘贴板,通常要在网上复制一段代码都是先gedit打开文件,中键粘贴后关闭,然后再用vim打开 ...

  5. Modern.IE,创建现代网站的给力开发工具!

    Modern.IE是微软推出的用来帮助开发者创建现代网站的基本开发工具.作为Web攻城师,最头疼的问题莫过于浏览器兼容性测试,各种类型浏览器,各种版本的浏览器,还有各种头疼的前缀等等.Modern.I ...

  6. userdel命令

    userdel 功能:删除用户相关文件:/etc/passwd    /etc/shadow    /home/usernameuserdel [-r] username 常用参数:-r    连同家 ...

  7. 【问题】:spring cloud sleuth日志组件冲突问题

    在使用spring cloud sleuth的时候,启动工程报错如下: 根据错误信息明显就是jar包冲突,spring boot默认用的是logback,所以移除其中一个依赖就可以了,修改pom依赖为 ...

  8. 源码安装Apache,报错:Cannot use an external APR with the bundled APR-util

    一般在第一次源码安装是没有问题的,在版本变化情况下在次源码安装可能会遇到此问题: apache2.0.x与apache2.2.x在apr有很大区别,前者为依赖公用apr,后者依赖于自身的apr.一般前 ...

  9. history命令使用方法详解

    history是一条非常实用的shell命令,可以显示出之前在shell中运行的命令,配合last显示之前登录的用户,就可以追溯是哪个用户执行了某些命令.以下详细说明history使用中常见的命令或技 ...

  10. urllib.urlencode() 无法encode中文, UnicodeEncodeError

    urllib.urlencode() 无法encode中文, UnicodeEncodeError, 具体错误内容如下:File "/System/Library/Frameworks/Py ...