ML—libSVM获得权重

华电北风吹

天津大学认知计算与应用重点实验室

最后修改日期:2014/12/20

clear;clc;

[label_vector, instance_matrix] = libsvmread('heart_scale');
instance_matrix=full(instance_matrix);
model = svmtrain(label_vector, instance_matrix,'-t 0');
[predict_label,accuracy,dec_values_L] = svmpredict(label_vector, instance_matrix,model);

 w = model.SVs' * model.sv_coef;
 b = -model.rho;
 mypredictresult=sign(instance_matrix*w+b);
 mypredictresult-predict_label


你可能感兴趣的:(matlab,SVM,libsvm,对偶问题)