如何绘制偏差 - 方差权衡的学习曲线?

时间:2013-09-11 08:27:45

标签: matlab machine-learning svm libsvm

使用带有MatLab接口的LIBSVM来分类3类中的34x5数据。我应用了10倍Kfold交叉验证方法和RBF内核。输出是这个混淆矩阵,具有0.88正确率(88%准确度)。我想提高准确度,得到可能的纯对角线混淆矩阵。这是代码

load Turn180SVM1; //load data file
libsvm_options = '-s 1 -t 2 -d 3 -r 0 -c 1 -n 0.1 -p 0.1 -m 100 -e 0.000001 -h 1 -b 0 -wi 1 -q';//svm options

C=size(Turn180SVM1,2);

% cross validation
for i = 1:10
    indices = crossvalind('Kfold',Turn180SVM1(:,C),10);
    cp = classperf(Turn180SVM1(:,C)); 
    for j = 1:10
        [X, Z] = find(indices(:,end)==j);%testing
        [Y, Z] = find(indices(:,end)~=j);%training


feature_training = Turn180SVM1([Y'],[1:C-1]); feature_testing = Turn180SVM1([X'],[1:C-1]);
class_training = Turn180SVM1([Y'],end); class_testing = Turn180SVM1([X'], end);
% SVM Training
       disp('training');
       [feature_training,ps] = mapminmax(feature_training',0,1);
       feature_training = feature_training';
       feature_testing = mapminmax('apply',feature_testing',ps)';
       model = svmtrain(class_training,feature_training,libsvm_options);  
% 

% SVM Prediction       
        disp('testing');
        TestPredict = svmpredict(class_testing,sparse(feature_testing),model);
       TestErrap = sum(TestPredict~=class_testing)./length(class_testing)*100;
         cp = classperf(cp, TestPredict, X);
        disp(((i-1)*10 )+j);
end;
end;
[ConMat,order] = confusionmat(TestPredict,class_testing);
cp.CorrectRate;
cp.CountingMatrix;

首先,我想绘制偏差 - 方差权衡的学习曲线。是否有任何帮助或哪个命令用于绘制学习曲线? 而且如何绘制中华民国也? 两种情况的任何帮助或代码示例?

由于

0 个答案:

没有答案