How to train SVM that contains data with NAN or 0 values

조회 수: 3 (최근 30일)
Valeska Pearson
Valeska Pearson 2013년 10월 11일
Hello Matlab experts,
I need some help with the following. I am using SVM and in my feature extraction I obtain area of abnormality detected in the retina fundus. And when no abnormalities are detected, the area will be 0 and also the density ratio which is also an attribute used to train my SVM. But now Matlab gives the Error using svd Input to SVD must not contain NaN or Inf.
Here is my code: what must I do????? This is the data I load.
1 66 0.91667 -1
0 0 0 1
0 0 0 1
0 0 0 1
2 182 0.54167 -1
1 1 Inf 1
MyData=load ('My_69_Fotos.csv')
% Vir My_69_fotos groups=[1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;...
1;1;1;1;1;0;0;0;1;0;1;0;0;1;0;...
0;0;0;1;0;0;0;0;0;0;1;0;0;0;...
0;0;0;1;1;1;1;0;0;1;1;0;0;0;0;0;0;...
0;0;0;1;1;0]
exudates=MyData(:,1:3)
amountExudates = MyData(:,1); %ATTRIBUTE1
total_area=MyData(:,2); %ATTRIBUTE2
densityRatio=MyData(:,3); %ATTRIBUTE3
Trainlabels=goeiedata(:,4);
k=10;
cvFolds = crossvalind('Kfold', groups, k) %# get indices of 10-fold CV
cp = classperf(groups) %# init performance tracker
for i = 1:k %# for each fold testIdx = (cvFolds == i); %# get indices of test instances
trainIdx = ~testIdx; %# get indices training instances
%# train an SVM model over training instances
svmModel = svmtrain(exudates(trainIdx,:), groups(trainIdx), ...
'Autoscale',true, 'Showplot',true, 'Method','QP', ...
'BoxConstraint',2e-1, 'Kernel_Function','rbf', 'RBF_Sigma',1);
%# test using test instances
pred = svmclassify(svmModel, exudates(testIdx,:), 'Showplot',true);
%# evaluate and update performance object
cp = classperf(cp, pred, testIdx);
end

답변 (0개)

카테고리

Help CenterFile Exchange에서 Dimensionality Reduction and Feature Extraction에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by