Error Using Feature Selector

1 visualización (últimos 30 días)
Luís Dias
Luís Dias el 15 de Feb. de 2016
Comentada: Greg Heath el 15 de Feb. de 2016
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 comentarios
Image Analyst
Image Analyst el 15 de Feb. de 2016
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 el 15 de Feb. de 2016
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

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Deep Learning Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by