Error Using Feature Selector

1 次查看(过去 30 天)
Luís Dias
Luís Dias 2016-2-15
评论: Greg Heath 2016-2-15
Hey, I´m trying to use sequentialfs to find the more important features to feed my neural network. Here's the code:
in=normc(input);
out2=transpose(output);
out=out2(:,1);
xtrain=in(1:616,:);
xtest=in(617:end,:);
ytrain=out(1:616,:);
ytest=out(617:end,:);
ypred = classify(xtest, xtrain, ytrain);
fun=@(xtrain,ytrain,xtest,ytest) sum(ytest~=classify(xtest,xtrain,ytrain));
inmodel=sequentialfs(fun,in,out);
--------------------------------------------------------------------------------------------------------
The out variable is a 880*1 matrix with the predicted output and the in is a 880*36 matrix with the features.
When I run the program the following errors appear:
Error using classify (line 228)
The pooled covariance matrix of TRAINING must be positive definite.
Error in Example (line 8)
ypred = classify(xtest, xtrain, ytrain);
------------------------------------------------------------------------------------------------------
I checked and the problem is on the matrixes because if i use other two with random numbers it works.
I have no idea how to solve this. Can you help me?
Thanks in advance,
Luís Dias
  2 个评论
Image Analyst
Image Analyst 2016-2-15
We don't have your data, so it's hard to help you.
input() is a built-in function. I don't think it's good practice to use input() as the argument to another function. You didn't make the mistake of calling some array your have "input" did you?
Greg Heath
Greg Heath 2016-2-15
The default for CLASSIFY is 'linear'.
Therefore you might have an easier time using either
PLSREGRESS or STEPWISEFIT.
Although you could add squares and cross-products as extra variables to pick from, I don't recommend it.
Hope this helps.
Greg

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Deep Learning Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by