⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 roc.m.svn-base

📁 a function inside machine learning
💻 SVN-BASE
字号:
function [tp, fp] = roc(t, y)%% ROC - generate a receiver operating characteristic curve%%    [TP,FP] = ROC(T,Y) gives the true-positive rate (TP) and false positive%    rate (FP), where Y is a column vector giving the score assigned to each%    pattern and T indicates the true class (a value above zero represents%    the positive class and anything else represents the negative class).  To%    plot the ROC curve,%%       PLOT(FP,TP);%       XLABEL('FALSE POSITIVE RATE');%       YLABEL('TRUE POSITIVE RATE');%       TITLE('RECEIVER OPERATING CHARACTERISTIC (ROC)');%%    See [1] for further information.%%    [1] Fawcett, T., "ROC graphs : Notes and practical%        considerations for researchers", Technical report, HP%        Laboratories, MS 1143, 1501 Page Mill Road, Palo Alto%        CA 94304, USA, April 2004.%%    See also : ROCCH, AUROC%% File        : roc.m%% Date        : Friday 9th June 2005%% Author      : Dr Gavin C. Cawley%% Description : Generate an ROC curve for a two-class classifier.%% References  : [1] Fawcett, T., "ROC graphs : Notes and practical%                   considerations for researchers", Technical report, HP%                   Laboratories, MS 1143, 1501 Page Mill Road, Palo Alto%                   CA 94304, USA, April 2004.%% History     : 10/11/2004 - v1.00%               09/06/2005 - v1.10 - minor recoding%% Copyright   : (c) G. C. Cawley, June 2005.%%    This program is free software; you can redistribute it and/or modify%    it under the terms of the GNU General Public License as published by%    the Free Software Foundation; either version 2 of the License, or%    (at your option) any later version.%%    This program is distributed in the hope that it will be useful,%    but WITHOUT ANY WARRANTY; without even the implied warranty of%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%    GNU General Public License for more details.%%    You should have received a copy of the GNU General Public License%    along with this program; if not, write to the Free Software%    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA%% process targetst = t > 0;% sort by classifier output[Y,idx] = sort(-y);t       = t(idx);% compute true positive and false positive ratestp = cumsum(t)/sum(t);fp = cumsum(~t)/sum(~t);% add trivial end-pointstp = [0 ; tp ; 1];fp = [0 ; fp ; 1];% bye bye...

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -