tdmROCRbase: Single plot of ROC, lift or other chart for a 'TDMclassifier'...

Description Usage Arguments Value See Also Examples

View source: R/tdmROCR.r

Description

Single plot of ROC, lift or other chart for a TDMclassifier object.

Usage

1
2
3
4
5
6
7
8
tdmROCRbase(
  x,
  dataset = "validation",
  nRun = 1,
  typ = "ROC",
  noPlot = FALSE,
  ...
)

Arguments

x

return value from a prior call to tdmClassifyLoop, an object of class TDMclassifier.

dataset

["validation"] which part of the data to use, either "training" or "validation"

nRun

[1] if x contains multiple runs, which run to show (1,...,Opts(x)$NRUN)

typ

["ROC"] which chart type, one out of ("ROC","lift","precRec") for (ROC, lift, precision-recall)-chart (see performance in package ROCR for more details):

  • "ROC": receiver operating curve, TPR vs. FPR, with TPR=TP/(TP+FN)=TP/P and FPR=FP/(FP+TN)=FP/N (true and false positive rate).

  • "lift": lift chart, LIFT vs. RPP, with LIFT=TPR/RPR with random positive rate RPR=P/(P+N) and RPP=(TP+FP)/(P+N) (rate of pos. predictions).

  • "precRec": precision-recall-chart, PREC vs. RECALL, with PREC=TP/(TP+FP) and RECALL=TP/P (same as TPR).

noPlot

[FALSE] if TRUE, suppress the plot, return only the area under curve

...

currently not used

Value

The area between the curve and the bottom line y=0.0 in the case of typ=="ROC" | typ=="precRec"
or the area between the curve and the bottom line y=1.0 in the case of typ=="lift".
If object x does not contain a prediction score, a warning is issued and the return value is NULL.

See Also

tdmClassifyLoop tdmROCR.TDMclassifier

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#*# --------- demo/demo05ROCR.r ---------
#*# Run task SONAR with "area under ROC curve" as performance measure (rgain.type="arROC").
#*# Other settings are similar to demo01-1sonar.r (level 1 of TDMR).
#*# Finally, plot ROC curve for validataion data set and 
#+#          plot lift chart for training data set
#*#
    path <- paste(find.package("TDMR"), "demo02sonar",sep="/");
    #path <- paste("../inst", "demo02sonar",sep="/");

    source(paste(path,"main_sonar.r",sep="/"));    # defines readTrnSonar

    controlDM <- function() {
      #
      # settings for the DM process (former sonar_00.apd file): 
      # (see ?tdmOptsDefaultsSet for a complete list of all default settings 
      # and many explanatory comments)
      #
      opts = list(path = path,
                  dir.data = "data",            # relative to path
                  filename = "sonar.txt",
                  READ.TrnFn = readTrnSonar,    # defined in main_sonar.r
                  data.title = "Sonar Data",
                  NRUN =  1,
                  rgain.type = "arROC",
                  VERBOSE = 2
      );
      opts <- setParams(opts, defaultOpts(), keepNotMatching = TRUE);
    }
    
    opts <- controlDM();
    result <- main_sonar(opts);     
    
    tdmGraphicNewWin(opts);
    cat("Area under ROC-curve for validation data set: ",
        tdmROCRbase(result),"\n");                                # side effect: plot ROC-curve
    tdmGraphicNewWin(opts);
    cat("Area under lift curve for  training data set: ",
        tdmROCRbase(result,dataset="training",typ="lift"),"\n");  # side effect: plot lift chart
    

TDMR documentation built on March 3, 2020, 1:06 a.m.