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

3 次查看(过去 30 天)
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