matlab查找最临近搜索knnsearch
returns Idx = knnsearch(X,Y,Name,Value)Idx with additional options specified using one or more name-value pair arguments. For example, you can specify the number of nearest neighbors to search for and the distance metric used in the search.
返回IDX,并使用一个或多个名称-值对参数指定其他选项。例如,可以指定要搜索的最近邻居的数目和搜索中使用的距离度量。
[ additionally returns the matrix Idx,D] = knnsearch(___)D, using any of the input arguments in the previous syntaxes. D contains the distances between each observation in Y and the corresponding closest observations in X.
使用先前语法中的任何输入参数返回矩阵D。D包含Y中每个观测值与X中对应的最近观测值之间的距离。
举例:
Load Fisher's iris data set.
load fisheriris
X = meas(:,:); % Measurements of original flowers
Y = [ 1.45; ;2.75 .]; % New flower data
Perform a knnsearch between X and the query points Y using Minkowski and Chebychev distance metrics.
使用Minkowski和chebychev距离度量在x和查询点y之间执行 knnsearch。
[mIdx,mD] = knnsearch(X,Y,'K',10,'Distance','minkowski','P',5);
[cIdx,cD] = knnsearch(X,Y,'K',10,'Distance','chebychev');
Visualize the results of the two nearest neighbor searches. Plot the training data. Plot the query points with the marker X. Use circles to denote the Minkowski nearest neighbors. Use pentagrams to denote the Chebychev nearest neighbors.
可视化两个最近邻搜索的结果。绘制训练数据。用标记x绘制查询点。用圆表示Minkowski最近的邻居。用五角星表示切比雪夫最近的邻居。
gscatter(X(:,1),X(:,2),species);
line(Y(:,1),Y(:,2),'Marker','x','Color','k',...
'Markersize',10,'Linewidth',2,'Linestyle','none');
line(X(mIdx,1),X(mIdx,2),'Color',[.5 .5 .5],'Marker','o',...
'Linestyle','none','Markersize',10);
line(X(cIdx,1),X(cIdx,2),'Color',[.5 .5 .5],'Marker','p',...
'Linestyle','none','Markersize',10);
legend('setosa','versicolor','virginica','query point',...
'minkowski','chebychev','Location','best');

来源:https://ww2.mathworks.cn/help/stats/knnsearch.html?searchHighlight=knnsearch&s_tid=doc_srchtitle
matlab查找最临近搜索knnsearch的更多相关文章
- 用matlab查找txt文档中的关键字,并把关键字后面的数据存到起来用matlab处理
用matlab查找txt文档中的关键字,并把关键字后面的数据存到起来用matlab处理 我测了一组数据存到txt文件中,是个WIFI信号强度文档,里面有我们需要得到的数据,有没用的数据,想用matla ...
- 1.3 正则表达式和Python语言-1.3.5使用 search()在一个字符串中查找模式(搜索与匹配 的对比)
1.3.5 使用 search()在一个字符串中查找模式(搜索与匹配的对比) 其实,想要搜索的模式出现在一个字符串中间部分的概率,远大于出现在字符串起始部分的概率.这也就是 search()派上用场的 ...
- linux 查找文件和搜索文件
按照文件名搜索 find . -name 'file name' grep -lr 'content' filepath
- Android Studio查找功能(搜索功能)及快捷键
版权声明:本文为博主原创文章,未经博主允许不得转载. 1.在当前窗口查找文本[Ctrl+F] F3 向下查找关键字出现位置 Shift+F3 向上一个关 ...
- Android Studio查找功能(搜索功能)
F3 向下查找关键字出现位置 Shift+F3 向上一个关键字出现位置 2.在当前工程内查找文本[Ctrl+Shift+F] 先会弹出一个对话框,直接点击[find],开始在整个工程内查找该字符串 ...
- matlab查找回车字符
Hi all, I would like to read the data all at once with: `file_text = fread(fid, inf, 'uint8=>char ...
- python自动化 协程函数、二分查找、模块搜索
协程函数 yiled: 把函数的执行结果封装好__iter__和__next__得到一个迭代器 与return功能类似,都可以返回值,但是return只能返回一次只 def fun(count): p ...
- Linux搜索查找类指令
⒈find [搜索范围] [选项] find指令将从指定目录下递归的遍历其各个子目录,将满足条件的文件或者目录显示在终端 选项说明: 选项 功能 -name<查询方式> 按照指定的文件名查 ...
- 【机器学习】 Matlab 2015a 自带机器学习算法汇总
MATLAB机器学习没看到啥教程,只有一系列函数,只好记录下: MATLAB每个机器学习方法都有很多种方式实现,并可进行高级配置(比如训练决策树时设置的各种参数) ,这里由于篇幅的限制,不再详细描述. ...
随机推荐
- IPython introduction
转载:http://blog.csdn.net/gavin_john/article/details/53086766 1. IPython介绍 ipython是一个python的交互式shell,比 ...
- oracle中can not set解决方法
原因:set autotrace on和set trimspool on在pl\sql中使用不了 解决方法:在window环境中,使用cmd命令,sqlplus user_name/password@ ...
- java线程模型Master-Worker
这样的模型是最经常使用的并行模式之中的一个,在Nginx源代码中有涉及到有想看的能够去这个大神的博客了解一下http://blog.csdn.net/marcky/article/details/60 ...
- Live555 中的客户端动态库.so的调用方式之一 程序中调用
1. 打开动态链接库: #include <dlfcn.h> void *dlopen(const char *filename, int flag); 该函数返回操作 ...
- wordcloud使用
学了下怎么用wordcloud. 以imet的数据集为例 https://www.kaggle.com/c/imet-2019-fgvc6 读取“train.csv”,”label.csv”文件,得到 ...
- PHP-Manual的学习----【安装与配置】
2017年6月27日17:59:16 安装与配置 安装前需要考虑的事项 Unix系统下的安装 Mac OS x系统下的安装 windows 系统下的安装 云计算平台上的安 ...
- windows中wamp环境composer使用中openssl问题解决
今天在windows下学习lavaral,使用composer update命令报如下错误: [Composer\Exception\NoSslException] The openssl exten ...
- Lumen开发:phpunit单元测试
先来直接运行,cmd先进入根目录,然后进入tests或是test文件夹 运行命令行:..\vendor\bin\phpunit ExampleTest.php laravel/lumen中集成了PHP ...
- HTTP/HLS/RTMP超级负载测试工具(转)
这个负载测试工具是网游分享的工具,可以在http://blog.csdn.net/win_lin/article/details/11835011 或者https://github.com/winli ...
- spring注解集合
spring篇 @Autowired Spring 2.5 引入了 @Autowired 注释,它可以对类成员变量.方法及构造函数进行标注,完成自动装配的工作. Spring 通过一个 BeanPos ...