📄 simpleroc.m
字号:
function f = simpleroc(netout,truelab)%SIMPLEROC Basic receiver-operating characteristic curve%% F = SIMPLEROC(NETOUT,TRUELAB)%% Compute the ROC curve for the network output NETOUT, given the true% labels TRUELAB. TRUELAB should contain 0-1 values, where 0 is the% correct output if (netout < some_threshold) and 1 when the% (netout > some_threshold).%% This version returns a vector of the same length as NETOUT and% TRUELAB. Maybe this will be shortened/subsampled in the future.%% See also: dd_roc, plotroc% Check the size of the netout vector:if size(netout,2)~=1 netout = netout'; if size(netout,1)~=1 error('Please make netout a column vector'); endend% So all sizes become:n = size(netout,1);n_t = sum(truelab);n_o = n - n_t;% Sort the network output:[sout,I] = sort(netout);slab = truelab(I);% Go over the whole rangef = zeros(n-1,2);for i=1:n-1 f(i,1) = sum(slab(1:i)); f(i,2) = sum(1-slab((i+1):n));end% ... and normalize:f = f./repmat([n_t n_o],n-1,1);return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -