• 大小: 52KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-13
  • 语言: Matlab
  • 标签: matlab  

资源简介

Matlab code for computing and visualization: Confusion Matrix, Precision/Recall, ROC, Accuracy, F-Measure etc. for Classification

资源截图

代码片段和文件信息

%  Matlab package for statistics and visualization of classification results and many other problems.
%  
%  Author: Created by Piji Li (pagelee.sd@gmail.com)  
%           Blog: www.zhizhihu.com;
%           QQ:379115886;
%  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;   % predicted 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‘);
[confusaccuracynumcorrectprecisionrecallFPatNMAPNDCGatN]=compute_accuracy_F(actual_labelpredict_labelclasses)
fprintf(‘Finish.\n‘);



 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2012-06-22 06:13  PG_Curve-master\
     目录           0  2012-06-22 06:13  PG_Curve-master\AccuracyF\
     文件        1904  2012-06-22 06:13  PG_Curve-master\AccuracyF\compute_accuracy_F.m
     目录           0  2012-06-22 06:13  PG_Curve-master\ConfusionMatrices\
     文件         714  2012-06-22 06:13  PG_Curve-master\ConfusionMatrices\compute_confusion_matrix.m
     文件        1032  2012-06-22 06:13  PG_Curve-master\ConfusionMatrices\draw_cm.m
     文件       13953  2012-06-22 06:13  PG_Curve-master\ConfusionMatrices\rotateXLabels.m
     目录           0  2012-06-22 06:13  PG_Curve-master\PrecisionRecall\
     文件        1061  2012-06-22 06:13  PG_Curve-master\PrecisionRecall\compute_precision_recall.m
     文件        3009  2012-06-22 06:13  PG_Curve-master\PrecisionRecall\draw_prc.m
     文件        2654  2012-06-22 06:13  PG_Curve-master\PrecisionRecall\prc_stats.m
     文件        2775  2012-06-22 06:13  PG_Curve-master\PrecisionRecall\prc_stats_binormal.m
     文件        2179  2012-06-22 06:13  PG_Curve-master\PrecisionRecall\prc_stats_empirical.m
     文件        1309  2012-06-22 06:13  PG_Curve-master\ReadMe.txt
     文件         210  2012-06-22 06:13  PG_Curve-master\actual_label.mat
     文件       37372  2012-06-22 06:13  PG_Curve-master\decision_values.mat
     文件        1546  2012-06-22 06:13  PG_Curve-master\main.m
     文件         224  2012-06-22 06:13  PG_Curve-master\name_class.mat
     文件         188  2012-06-22 06:13  PG_Curve-master\num_in_class.mat
     文件         437  2012-06-22 06:13  PG_Curve-master\predict_label.mat
     目录           0  2019-05-16 21:06  新建文件夹\

评论

共有 条评论