simpleroc.m

来自「数据挖掘的工具箱,最新版的,希望对做这方面研究的人有用」· M 代码 · 共 45 行

M
45
字号
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 + =
减小字号Ctrl + -
显示快捷键?