⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 confusion_matrix.m

📁 调用过程 CM = Confusion_matrix(train_predicts, train_targets) [combining_predicts, errorrate] = combinin
💻 M
字号:
function CM = Confusion_matrix(train_predicts, train_targets)

% solve the confusion matrix of classifiers

% Inputs:
%   predicts    - the predicting class by single classifiers
%   targets     - the real class of each pattern 
% Outputs:
%   CM          -  confusion matrix
%
% Notice: available for only two classes

[nClassifiers, nPatterns] = size(train_predicts);
nClasses = max(train_targets) + 1;

CM = zeros(nClasses, nClasses, nClassifiers);

for i = 1: nClassifiers
    for j = 1: nPatterns
        CM(train_targets(j)+1, train_predicts(i,j)+1, i) = CM(train_targets(j) + 1, train_predicts(i,j) + 1, i) + 1;
    end
end

⌨️ 快捷键说明

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