Undefined function 'mtimes' for input arguments of type 'nominal'.
Mostrar comentarios más antiguos
Dear all,
I want to use cross-validation function crossval to find some parameters of my SVM function. I follow the help document to have this .m file:
load UCI_abalone; %2088
data = [train_data;test_data];
label = [train_labels;test_labels];
data_size = size(data,1);
c = cvpartition(data_size,'kfold',10);
minfn = @(z)crossval('mcr',data,label,'Predfun', ...
@(xtrain,ytrain,xtest)crossfun(xtrain,ytrain,...
xtest,exp(z)),'partition',c);
opts = optimset('TolX',5e-4,'TolFun',5e-4);
[searchmin fval] = fminsearch(minfn,randn(1,1),opts)
the corresponding function is:
function [ ytest ] = crossfun(x,y,xtest,lambda)
p = size(x,2);
N = size(x,1);
w = zeros(p,1);
for i = 1:N
yita = 1 / sqrt(i);
if 1 - y(i) * x(i,:) * w > 0
w = w + y(i) * yita * x(i,:)';
end
if w' * w > 1 / lambda
w = w / sqrt(w' * w) / lambda;
end
end
ytest = xtest * w;
end
And when I run it, the error shows like this:
>> cv_test
Error using crossval>evalFun (line 465)
The function '@(xtrain,ytrain,xtest)crossfun(xtrain,ytrain,xtest,exp(z))' generated the following error:
Undefined function 'mtimes' for input arguments of type 'nominal'.
Error in crossval>getLossVal (line 502)
funResult = evalFun(funorStr,arg(1:end-1));
Error in crossval (line 401)
[funResult,outarg] = getLossVal(i, nData, cvp, data, predfun);
Error in
@(z)crossval('mcr',data,label,'Predfun',@(xtrain,ytrain,xtest)crossfun(xtrain,ytrain,xtest,exp(z)),'partition',c)
Error in fminsearch (line 191)
fv(:,1) = funfcn(x,varargin{:});
Error in cv_test (line 12)
[searchmin fval] = fminsearch(minfn,randn(1,1),opts)
Is there anyone can help me??? Thanks!!
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Gaussian Process Regression en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!