Error Using Feature Selector
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Image Analyst
le 15 Fév 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
le 15 Fév 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
Réponses (0)
Voir également
Catégories
En savoir plus sur Deep Learning Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!