Error using pdist2 Too many input arguments
来源:互联网 发布:表格软件扫描录入 编辑:程序博客网 时间:2024/06/05 03:13
PS:遇到的问题
Error using pdist2
Too many input arguments.
Error inExhaustiveSearcher/knnsearch (line 207)
[dist,idx] = pdist2(obj.X,Y, distMetric,arg{:}, 'smallest',numNN);
Error in ClassificationKNN/score(line 322)
[CIDX,dist] = knnsearch(this.NS,X,'k',this.ModelParams.NumNeighbors,...
Error inClassificationKNN/predict (line 587)
posteriors = score(this,X);
Error in KNN_hog_new(line 16)
characterClass=predict(mdl,testHistograms(1,20:30));
解决:
help pdist2
Calculates the distance between sets of vectors.
LetX be an m-by-p matrix representing m points in p-dimensional space
andY be an n-by-p matrix representing another set of points in the same
space. This function computes the m-by-ndistance matrix D where D(i,j)
isthe distance between X(i,:) and Y(j,:). This function has been
optimized where possible, with most of the distance computations
requiring few or no loops.
Themetric can be one of the following:
'euclidean' / 'sqeuclidean':
Euclidean / SQUARED Euclidean distance. Note that 'sqeuclidean'
is significantly faster.
'chisq'
The chi-squared distance between two vectors is defined as:
d(x,y) = sum( (xi-yi)^2 / (xi+yi) ) / 2;
The chi-squared distance is useful when comparing histograms.
'cosine'
Distance is defined as the cosine of the angle between two vectors.
'emd'
Earth Mover's Distance (EMD) between positive vectors (histograms).
Note for 1D, with all histograms having equal weight, there is a simple
closed form for the calculation of the EMD. The EMD between histograms
xand y is given by the sum(abs(cdf(x)-cdf(y))), where cdf is the
cumulative distribution function (computed simply by cumsum).
'L1'
The L1 distance between two vectors is defined as: sum(abs(x-y));
USAGE
D= pdist2( X, Y, [metric] )
INPUTS
X - [m x p] matrix of mp-dimensional vectors
Y - [n x p] matrix of np-dimensional vectors
metric - ['sqeuclidean'],'chisq', 'cosine', 'emd', 'euclidean', 'L1'
OUTPUTS
D - [m x n] distance matrix
EXAMPLE
%simple example where points cluster well
[X,IDX] = demoGenData(100,0,5,4,10,2,0);
D= pdist2( X, X, 'sqeuclidean' );
distMatrixShow( D, IDX );
%comparison to pdist
n=500; d=200; r=100; X=rand(n,d);
tic, for i=1:r, D1 = pdist( X, 'euclidean' ); end, toc
tic, for i=1:r, D2 = pdist2( X, X, 'euclidean' ); end, toc
D1=squareform(D1); del=D1-D2; sum(abs(del(:)))
Seealso pdist, distMatrixShow
Piotr's Image&Video Toolbox Version 2.52
Copyright 2012 Piotr Dollar. [pdollar-at-caltech.edu]
Please email me if you find bugs, or havesuggestions or questions!
Licensed under the Simplified BSD License[see external/bsd.txt]
因为安装了Piotr'sImage&Video Toolbox这一工具箱,其里面也有同名函数,导致调用的是工具箱的函数,而不是matlab里头的函数。把这个toolboox的路径从path中删除就可以了。
所以一般发生too many input argument大部分原因都是因为自定义函数和系统函数重名。想要知道是不是这一错误,只要help 一下相关的文件名就可以了。
之前用低于10个变量的参数可以计算以为是matlab内置pdist2的函数问题。
- Error using pdist2 Too many input arguments
- Too many input arguments.
- Too many input arguments.
- matlab突然无法打开.m文件 ??? Error using ==> feature Too many input arguments.
- too many input arguments 问题解决 matlab
- Too many arguments error in bash
- Matlab运行时出现提示 too many input arguments问题
- Matlab运行时出现提示 too many input arguments问题
- shell [: too many arguments
- too many positional arguments
- shell test(too many arguments)
- error: #29: expected an expression,error: #140: too many arguments in function call
- 编译内核是出现:arch/arm/mm/tlb-v4wbi.S:64:error: too many positional arguments
- vmware 共享文件夹配置及 error: too many arguments to function ‘wait_on_bit’ 解决方法
- ./runInstaller: line 50: [: too many arguments
- 【转】bash中的错误 too many arguments
- too many arguments to function call
- Too many arguments to function call
- SQL SERVER插入数据操作
- DBUtils批量处理操作
- linux命令 sync
- 南阳 139 我排第几个
- IE6查看ActiveX控件是否已经安装以及版本号
- Error using pdist2 Too many input arguments
- NSAttributedString详解
- OER Voice Traffic Optimization Using Active Probes
- Linux下nm和ldd 命令
- Cocos2d-x 弹出对话框的设计与实现
- 去除List中重复元素
- Js实现短信发送进度条
- poj 3370 Halloween treats
- vc++提示cannot open include file 'afxres.h'———VC安装设置问题