MATLAB繪制ROC曲線和PR曲線示意圖


注意:只是示意圖,不是根據數據繪制的。。論文需要

 

close all;
clear;
clc;
%% 數據

%% 畫圖ROC
% x=0:0.01:1;
% y=x;
% plot(x,y,'k--');
% hold on;
% theta=pi/2:0.01:pi;  
% X=1+1*cos(theta);  
% Y=0+1*sin(theta);   
% plot(X,Y);  
% xlim([0 1])
% %axis([0 1 0 1]) 
% text(0.4,0.8,' \leftarrow ROC曲線');%對曲線進行文字標注
% xlabel('False Positive Rate');
% ylabel('True Positive Rate');
% hold off;
%% 畫PR曲線
x=0:0.01:1;
y=x;
plot(x,y,'k--');
hold on;
theta=0:0.01:pi/2;  
X=0+1*cos(theta);  
Y=0+1*sin(theta);   
plot(X,Y);  
xlim([0 1])
%axis([0 1 0 1]) 
text(0.55,0.85,' \leftarrow PR曲線');%對曲線進行文字標注
scatter(0.71,0.71,200,'k.');%第三是點的大小,后面是顏色和形狀bgrcmykw
text(0.71,0.71,' \leftarrow 平衡點');%對曲線進行文字標注
hold on;
% 畫某點到XY軸的垂線!!
x0=0.71;y0=0.71;  %曲線上的一點
hold on;        %在畫完函數虛線之后保持曲線圖
plot([0 x0],[y0 y0],'r--'); %畫兩個虛線
plot([x0 x0],[0 y0],'r--');
hold off;
xlabel('查全率');
ylabel('查准率');
box off;%去掉坐標軸上面和右邊邊框
hold off;

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM