SVM classification weight fitcsvm
18 次查看(过去 30 天)
显示 更早的评论
Hi,
I am training a linear SVM classifier:
cvFolds = crossvalind('Kfold', labels, nrFolds);
for i = 1:nrFolds % iteratre through each fold
testIdx = (cvFolds == i); % indices of test instances
trainIdx = ~testIdx; % indices training instances
% train the SVM
% 'OptimizeHyperparameters','auto'
cl = fitcsvm(features(trainIdx,:), labels(trainIdx),'KernelFunction',kernel,'Standardize',true,...
'BoxConstraint',C,'ClassNames',[0,1], 'Solver', solver);
[labelPred,scores] = predict(cl, features(testIdx,:));
eq = sum(labelPred==labels(testIdx));
accuracy(i) = eq/numel(labels(testIdx));
end
As is obvious, the trained SVM model is stored in cl. Checking the model parameters in cl I do not see which parameters correspond to classifier weight - feedback much appreciated.
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Statistics and Machine Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!