错误:matlab遇到内部错误,需要关闭

时间:2016-06-22 02:51:14

标签: matlab

我尝试使用SVM作为分类器运行增强算法,有示例代码:

 load('d:\xapp.mat');
 load('d:\yapp.mat');

 M = 10;
   cv = cvpartition(yapp, 'Kfold', 10);
   cv_accuracy = zeros(1, cv.NumTestSets);


for i = 1 : cv.NumTestSets
training = cv.training(i);
testing = cv.test(i);

x_training = xapp(training, :); y_training = yapp(training, :);
x_testing = xapp(testing, :); y_testing = yapp(testing, :);

models = cell(M, 1);
n = size(x_training, 1);
w = repmat(1 / n, n, M);
alpha = zeros(M, 1);
eps = zeros(M, 1);

for m = 1 : M

    models{m} = svmtrain(w(:, m) ./ min(w(:, m)), y_training, x_training, ' -c 1000 -g 10');

    predictions = svmpredict(y_training, x_training, models{m});

    I = (predictions ~= y_training);

    eps(m) = (w(:, m)' * I) / sum(w(:, m));
    alpha(m) = log ( (1 - eps(m)) / eps(m) );

    if m < M
        w(:, m + 1) = w(:, m) .* exp(alpha(m) * I);
    end
end

predictions = zeros(size(y_testing, 1), M);
for m = 1 : M
    predictions(:, m) = svmpredict(y_testing, x_testing, models{m});
end
  pred=mode(predictions,2);

cv_accuracy(i) = 100.*sum(pred == y_testing) / size(y_testing, 1);
 end

  fprintf('Accuracy => [%s]\nMean => %s\n', num2str(cv_accuracy), num2str(mean(cv_accuracy) * 100));

当我运行此代码时,我在此图像中得到了相同的错误。enter image description here我正在使用带有窗口7的matlab 2013b。请帮助我,解决问题的任何建议?

0 个答案:

没有答案