• 【转】混淆矩阵和ROC曲线


    1.https://www.baidu.com/link?url=LvM7AdalbXSaDUmsELY0gPTErLvNbvAxlMpRJN0D3AX_xaIVv6sLI4M_3yVUx060NQQzYm-2d7t0s2bGEde1j1rgTr8OSpIikrTY8t42ZYe&wd=&eqid=9b791b9f00018c2d000000065f0295f8

     

     

     

     

    2.https://zhuanlan.zhihu.com/p/101315247

     

    clc; clear; close all;

    fuse_matrix=rand(5)#产生矩阵

    imagesc(fuse_matrix)

    set(gca,'xtick',1:5)

    set(gca,'xticklabel',{'one ','two','three','four','five'},'XTickLabelRotation',45)#设置横轴和横轴标签大小

    set(gca,'ytick',1:5)

    set(gca,'yticklabel',{'one','two','three','four','five'})#设置纵轴

    set(gca,'FontSize',14,'Fontname', 'Times New Roman');#设置坐标系的数字大小 colorbar#产生colorbar

    ROC曲线

     

    clc; clear; close all;
    
    FPR = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.050,0.15,0.15,0.15,0.20,0.20,0.20,0.20,0.20,0.20,0.20,0.25,0.25,0.30,0.35,0.40,0.45,0.45,0.55,0.60,0.65,0.65,0.70,0.70,0.70,0.70,0.70,0.70,0.75,0.75,0.80,0.85,0.90,0.90,0.90,0.95,0.95,0.95,1];
    TPR = [0,0,0.050,0.050,0.050,0.050,0.10,0.15,0.15,0.15,0.15,0.15,0.15,0.20,0.25,0.30,0.35,0.35,0.40,0.45,0.45,0.50,0.55,0.60,0.60,0.60,0.60,0.60,0.60,0.65,0.70,0.80,0.85,0.85,0.85,0.95,0.95,0.95,0.95,0.95,0.95,0.95,0.95,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];
    
    acurve=trapz(FPR,TPR);%计算AUC
    
    x_dig=0:0.01:1;
    y_dig=x_dig;
    
    color1=[0.9300    0.4700    0.5000];%红色
    color2=[86 180 232]./255;
    color3=[229 159 1]./255;
    color4=[107,105,102]./255;
    h=figure;
    set(h,'units','normalized','position',[0.1 0.1 0.48 0.8]);%设置绘图窗口的大小
    set(h,'color','w');%设置绘图窗口的背景为白色
    h1=plot(FPR, TPR,'Color',color2,'LineWidth',3,'MarkerSize',3);hold on;
    plot(x_dig,y_dig,'--','Color',color4,'LineWidth',1.5);%画中间的虚线
    xlabel('False Positive Ratio (1-specificity)','fontsize',2,'FontWeight','bold');%x轴
    ylabel('True Positive Ratio (Sensitivity)','fontsize',2,'FontWeight','bold');%y轴
    set(gca,'YLim',[0,1.02]);
    set(gca,'XLim',[-0.01,1.01]);
    
    set(gca,'FontSize',24,'LineWidth',1.6)
    set(get(gca,'YLabel'),'FontSize',24);
    set(get(gca,'XLabel'),'FontSize',24);
    set(gca,'YTick',[0:0.2:1])
    
    grid on
    
    ROCtitle_1=['AI AUC = ',num2str(roundn(acurve,-3))];
    hh=legend([h1],ROCtitle_1)%,'Location','southeast');
    set(hh,'edgecolor','white')
  • 相关阅读:
    07.对称加密算法指令
    06.Openssl基本概念
    04.openssl背景
    03.openssl密码实现技术
    02.密钥学基本概念
    01.openssl-概述
    17行为型模式之命令模式
    16行为型模式之模板模式
    15结构型模式之享元模式
    14结构型模式之外观模式
  • 原文地址:https://www.cnblogs.com/rinroll/p/13257945.html
Copyright © 2020-2023  润新知