-
大小: 4KB文件類型: .zip金幣: 2下載: 0 次發(fā)布日期: 2024-02-04
- 語言: Matlab
- 標(biāo)簽: ROC??目標(biāo)檢測(cè)??matlab??
資源簡(jiǎn)介
接受者操作特性曲線 (receiver operating characteristic curve,簡(jiǎn)稱ROC曲線),又稱為感受性曲線(sensitivity curve)。得此名的原因在于曲線上各點(diǎn)反映著相同的感受性,它們都是對(duì)同一信號(hào)刺激的反應(yīng),只不過是在幾種不同的判定標(biāo)準(zhǔn)下所得的結(jié)果而已。接受者操作特性曲線就是以虛驚概率為橫軸,擊中概率為縱軸所組成的坐標(biāo)圖,和被試在特定刺激條件下由于采用不同的判斷標(biāo)準(zhǔn)得出的不同結(jié)果畫出的曲線。

代碼片段和文件信息
function?ROCdata=roc(varargin)
%?ROC?-?Receiver?Operating?Characteristics.
%?The?ROC?graphs?are?a?useful?tecnique?for?organizing?classifiers?and
%?visualizing?their?performance.?ROC?graphs?are?commonly?used?in?medical
%?decision?making.
%?If?you?have?downloaded?partest
%?http://www.mathworks.com/matlabcentral/fileexchange/12705
%?the?routine?will?compute?several?data?on?test?performance.
%
%?Syntax:?roc(xalpha)
%
%?Input:?x?-?This?is?the?data?matrix.?The?first?column?is?the?column?of?the?data?value;
%????????????The?second?column?is?the?column?of?the?tag:?unhealthy?(1)?and
%????????????healthy?(0).
%??????????alpha?-?significance?level?(default?0.05)
%
%?Output:?The?ROC?plot;
%?????????The?Area?under?the?curve?with?Standard?error?and?Confidence
%?????????interval?and?comment.
%?????????Cut-off?point?for?best?sensitivity?and?specificity.
%?????????(Optional)?the?test?performances?at?cut-off?point.
%
%?Example:
%???????????load?rocdata
%???????????roc(x)
%
%???????????Created?by?Giuseppe?Cardillo
%???????????giuseppe.cardillo-edta@poste.it
%
%?To?cite?this?file?this?would?be?an?appropriate?format:
%?Cardillo?G.?(2008)?ROC?curve:?compute?a?Receiver?Operating?Characteristics?curve.
%?http://www.mathworks.com/matlabcentral/fileexchange/19950
%Input?Error?handling
args=cell(varargin);
nu=numel(args);
if?isempty(nu)
????error(‘Warning:?almost?the?data?matrix?is?required‘)
elseif?nu>3
????error(‘Warning:?Max?three?input?data?are?required‘)
end
default.values?=?{[]0.051};
default.values(1:nu)?=?args;
[x?alpha?verbose]?=?deal(default.values{:});
if?isvector(x)
????error(‘Warning:?X?must?be?a?matrix‘)
end
if?~all(isfinite(x(:)))?||?~all(isnumeric(x(:)))
????error(‘Warning:?all?X?values?must?be?numeric?and?finite‘)
end
x(:2)=logical(x(:2));
if?all(x(:2)==0)
????error(‘Warning:?there?are?only?healthy?subjects!‘)
end
if?all(x(:2)==1)
????error(‘Warning:?there?are?only?unhealthy?subjects!‘)
end
if?nu>=2
????if?~isscalar(alpha)?||?~isnumeric(alpha)?||?~isfinite(alpha)?||?isempty(alpha)
????????error(‘Warning:?it?is?required?a?numeric?finite?and?scalar?ALPHA?value.‘);
????end
????if?alpha?<=?0?||?alpha?>=?1?%check?if?alpha?is?between?0?and?1
????????error(‘Warning:?ALPHA?must?be?comprised?between?0?and?1.‘)
????end
????if?nu==3
????????verbose=logical(verbose);
????end
end
clear?args?default?nu
tr=repmat(‘-‘180);
lu=length(x(x(:2)==1));?%number?of?unhealthy?subjects
lh=length(x(x(:2)==0));?%number?of?healthy?subjects
z=sortrows(x1);
%find?unique?values?in?z
labels=unique(z(:1));
ll=length(labels);?%count?unique?value
a=zeros(ll2);?%array?preallocation
ubar=mean(x(x(:2)==1)1);?%unhealthy?mean?value
hbar=mean(x(x(:2)==0)1);?%healthy?mean?value
for?K=1:ll
????if?hbar ????????TP=length(x(x(:2)==1?&?x(:1)>labels(K)));
????????FP=length(x(x(:2)==0?&?x(:1)>labels(K)));
????????FN=length(x(x(:2)==1?&?x(:1)<=labels(K)));
????????TN=length(x(x(:2)==0?&?x(:
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件????????1338??2010-04-08?13:00??license.txt
?????文件????????7911??2010-04-08?12:49??roc.m
?????文件?????????351??2009-02-16?15:52??rocdata.mat
評(píng)論
共有 條評(píng)論