mcactivelearning.m

来自「一个matlab的工具包,里面包括一些分类器 例如 KNN KMEAN SVM 」· M 代码 · 共 22 行

M
22
字号
function  [Y_compute, Y_prob] = MCActiveLearning(classifier, para, X_train, Y_train, X_test, Y_test, num_class)

% global preprocess;
class_set = GetClassSet(Y_train);
p = str2num(char(ParseParameter(para, {'-Iter'; '-IncSize'}, {'10';'10'})));
Iteration = p(1);
IncrementSize = p(2);

for j = 1: Iteration
    [Y_compute, Y_prob] = Classify(classifier, X_train, Y_train, X_test, Y_test, num_class);
    % Y_prob = Y_prob - preprocess.SVMSCutThreshold;
    [C Index] = sort(abs(Y_prob));
    for k = 1:IncrementSize
        X_train = [X_train; X_test(Index(k), :)];
        Y_train = [Y_train; Y_test(Index(k), :)];
        X_test(Index(k), :) = []; % Delete the test examples in testing set
        Y_test(Index(k), :) = []; % Delete the test examples in testing set
    end;
      
    CalculatePerformance(Y_compute, Y_test, class_set);
end;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?