资源简介
不错的混淆矩阵代码实现过程,matlab版本,拿来和大家分享
代码片段和文件信息
% Matlab package for statistics and visualization of classification results and many other problems.
%
% Author: Page( 丕子)
% Blog: www.shamoxia.com;
% QQ:379115886;
% Email: peegeelee@gmail.com
% Date: Dec. 2010
%% initialization
clc;
clear;
load num_in_class; % instance number of each class
load actual_label; % actual label of each instance
load predict_label; % predict label of your experiments
load decision_values; % deccision values of each instance in your classification experiments(e.g. dec_values of Libsvm)
load name_class; % name of each class
%% compute and visualize the confusion matrix
addpath ConfusionMatrices; % package for computing confusion matrix
[confusion_matrix]=compute_confusion_matrix(predict_labelnum_in_classname_class);
%% compute and visualize the precision/recall curve and ROC
addpath PrecisionRecall;
label_or_decision=‘decision‘; % use label(‘label‘) as decision or decision_values(‘decision‘) as decision decision will be better.
PRC_or_ROC=0; % 0 for PRC 1 for ROC 2 for both;
compute_precision_recall(predict_labeldecision_valuesactual_labelnum_in_classlabel_or_decisionPRC_or_ROC);
%% compute accuracy and F-measure etc.
addpath AccuracyF;
classes = [1:max(max(actual_label)max(predict_label))];
fprintf(‘Begin computing confusaccuracynumcorrectprecisionrecallF...\n‘);
[confusaccuracynumcorrectprecisionrecallF]=compute_accuracy_F(actual_labelpredict_labelclasses)
fprintf(‘Finish.\n‘);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2010-12-29 14:26 PG_Curve\
目录 0 2010-12-29 14:26 PG_Curve\AccuracyF\
文件 210 2010-12-29 14:26 PG_Curve\actual_label.mat
目录 0 2010-12-29 14:26 PG_Curve\ConfusionMatrices\
文件 37372 2010-12-29 14:26 PG_Curve\decision_values.mat
文件 1572 2010-12-29 14:26 PG_Curve\main.m
文件 224 2010-12-29 14:26 PG_Curve\name_class.mat
文件 188 2010-12-29 14:26 PG_Curve\num_in_class.mat
目录 0 2010-12-29 14:26 PG_Curve\PrecisionRecall\
文件 437 2010-12-29 14:26 PG_Curve\predict_label.mat
文件 1093 2010-12-29 14:26 PG_Curve\ReadMe.txt
文件 1694 2010-12-29 14:26 PG_Curve\AccuracyF\compute_accuracy_F.m
文件 739 2010-12-29 14:26 PG_Curve\ConfusionMatrices\compute_confusion_matrix.m
文件 985 2010-12-29 14:26 PG_Curve\ConfusionMatrices\draw_cm.m
文件 14297 2010-12-29 14:26 PG_Curve\ConfusionMatrices\rotateXLabels.m
文件 1061 2010-12-29 14:26 PG_Curve\PrecisionRecall\compute_precision_recall.m
文件 3084 2010-12-29 14:26 PG_Curve\PrecisionRecall\draw_prc.m
文件 2654 2010-12-29 14:26 PG_Curve\PrecisionRecall\prc_stats.m
文件 2775 2010-12-29 14:26 PG_Curve\PrecisionRecall\prc_stats_binormal.m
文件 2179 2010-12-29 14:26 PG_Curve\PrecisionRecall\prc_stats_empirical.m
- 上一篇:MATLAB退火算法
- 下一篇:模拟退火算法的matlab程序,简单易懂
评论
共有 条评论