Error Using Feature Selector
3 ビュー (過去 30 日間)
古いコメントを表示
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
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
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 Center および File Exchange で Deep Learning Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!