Commit 0cbf7f6a918a67324a85aebb4d5e60960695c124

Authored by Ben Klein
Committed by GitHub
2 parents 43ddeb86 4d56d791

Merge pull request #587 from biometrics/frr_table

plot FRR table out to six digits
openbr/core/eval.cpp
... ... @@ -376,11 +376,11 @@ float Evaluate(const Mat &simmat, const Mat &mask, const File &csv, const QStrin
376 376 QString::number(1-searchOperatingPoint.TAR)));
377 377 }
378 378  
379   - // Write TAR@FAR Table (TF)
  379 + // Write FRR@FAR Table (FF)
380 380 foreach (float FAR, QList<float>() << 1e-6 << 1e-5 << 1e-4 << 1e-3 << 1e-2 << 1e-1)
381   - lines.append(qPrintable(QString("TF,%1,%2").arg(
  381 + lines.append(qPrintable(QString("FF,%1,%2").arg(
382 382 QString::number(FAR, 'f'),
383   - QString::number(getOperatingPoint(operatingPoints, "FAR", FAR).TAR, 'f', 3))));
  383 + QString::number(1-getOperatingPoint(operatingPoints, "FAR", FAR).TAR, 'f', 6))));
384 384  
385 385 // Write FAR@TAR Table (FT)
386 386 foreach (float TAR, QList<float>() << 0.4 << 0.5 << 0.65 << 0.75 << 0.85 << 0.95)
... ...
openbr/core/plot.cpp
... ... @@ -180,13 +180,13 @@ bool Plot(const QStringList &amp;files, const File &amp;destination, bool show)
180 180  
181 181 RPlot p(files, destination);
182 182 p.file.write("\nformatData()\n\n");
183   - p.file.write(qPrintable(QString("algs <- %1\n").arg((p.major.size > 1 && p.minor.size > 1) && !(p.major.smooth || p.minor.smooth) ? QString("paste(TF$%1, TF$%2, sep=\"_\")").arg(p.major.header, p.minor.header)
184   - : QString("TF$%1").arg(p.major.size > 1 ? p.major.header : (p.minor.header.isEmpty() ? p.major.header : p.minor.header)))));
  183 + p.file.write(qPrintable(QString("algs <- %1\n").arg((p.major.size > 1 && p.minor.size > 1) && !(p.major.smooth || p.minor.smooth) ? QString("paste(FF$%1, FF$%2, sep=\"_\")").arg(p.major.header, p.minor.header)
  184 + : QString("FF$%1").arg(p.major.size > 1 ? p.major.header : (p.minor.header.isEmpty() ? p.major.header : p.minor.header)))));
185 185 p.file.write("algs <- algs[!duplicated(algs)]\n");
186 186  
187 187 if (p.major.smooth || p.minor.smooth) {
188 188 QString groupvar = p.major.size > 1 ? p.major.header : (p.minor.header.isEmpty() ? p.major.header : p.minor.header);
189   - foreach(const QString &data, QStringList() << "DET" << "IET" << "CMC" << "TF" << "FT" << "CT") {
  189 + foreach(const QString &data, QStringList() << "DET" << "IET" << "CMC" << "FF" << "FT" << "CT") {
190 190 p.file.write(qPrintable(QString("%1 <- summarySE(%1, measurevar=\"Y\", groupvars=c(\"%2\", \"X\"), conf.interval=confidence)"
191 191 "\n").arg(data, groupvar)));
192 192 }
... ... @@ -214,8 +214,8 @@ bool Plot(const QStringList &amp;files, const File &amp;destination, bool show)
214 214  
215 215 // optional plot metadata and accuracy tables
216 216 if (destination.getBool("metadata", true)) {
217   - p.file.write("plotTAR(tableData=TF)\n");
218   - p.file.write("plotTAR(tableData=TF,operatingPoint=1e-6)\n");
  217 + p.file.write("plotFRR(tableData=FF)\n");
  218 + p.file.write("plotFRR(tableData=FF,operatingPoint=1e-6)\n");
219 219 }
220 220  
221 221 // Write plots
... ... @@ -375,12 +375,12 @@ bool PlotEER(const QStringList &amp;files, const File &amp;destination, bool show)
375 375  
376 376 RPlot p(files, destination);
377 377 p.file.write("\nformatData()\n\n");
378   - p.file.write(qPrintable(QString("algs <- %1\n").arg((p.major.size > 1 && p.minor.size > 1) && !(p.major.smooth || p.minor.smooth) ? QString("paste(TF$%1, TF$%2, sep=\"_\")").arg(p.major.header, p.minor.header)
379   - : QString("TF$%1").arg(p.major.size > 1 ? p.major.header : (p.minor.header.isEmpty() ? p.major.header : p.minor.header)))));
  378 + p.file.write(qPrintable(QString("algs <- %1\n").arg((p.major.size > 1 && p.minor.size > 1) && !(p.major.smooth || p.minor.smooth) ? QString("paste(FF$%1, FF$%2, sep=\"_\")").arg(p.major.header, p.minor.header)
  379 + : QString("FF$%1").arg(p.major.size > 1 ? p.major.header : (p.minor.header.isEmpty() ? p.major.header : p.minor.header)))));
380 380 p.file.write("algs <- algs[!duplicated(algs)]\n");
381 381 if (p.major.smooth || p.minor.smooth) {
382 382 QString groupvar = p.major.size > 1 ? p.major.header : (p.minor.header.isEmpty() ? p.major.header : p.minor.header);
383   - foreach(const QString &data, QStringList() << "DET" << "TF" << "FT") {
  383 + foreach(const QString &data, QStringList() << "DET" << "FF" << "FT") {
384 384 p.file.write(qPrintable(QString("%1 <- summarySE(%1, measurevar=\"Y\", groupvars=c(\"%2\", \"X\"), conf.interval=confidence)"
385 385 "\n").arg(data, groupvar)));
386 386 }
... ...
share/openbr/plotting/plot_utils.R
... ... @@ -62,7 +62,7 @@ plotTable &lt;- function(tableData=NULL, name=NULL, labels=NULL) {
62 62 }
63 63 }
64 64  
65   -plotTAR <- function(tableData=NULL, operatingPoint=1e-4) {
  65 +plotFRR <- function(tableData=NULL, operatingPoint=1e-4) {
66 66 if (nrow(tableData) == 0) return()
67 67 major <- majorHeader
68 68 minor <- if(minorHeader == "") majorHeader else minorHeader
... ... @@ -71,8 +71,10 @@ plotTAR &lt;- function(tableData=NULL, operatingPoint=1e-4) {
71 71 colnames(mat) <- tableData[,minor][!duplicated(tableData[,minor])]
72 72 rownames(mat) <- tableData[,major][!duplicated(tableData[,major])]
73 73 table <- as.table(mat)
  74 + options(scipen = 999)
74 75 print(textplot(table))
75   - print(title(paste("True Accept Rate at FAR=", toString(operatingPoint))))
  76 + options(scipen = 0)
  77 + print(title(paste("False Reject Rate at FAR=", toString(operatingPoint))))
76 78 }
77 79  
78 80 plotLandmarkTables <- function(tableData=NULL) {
... ... @@ -179,7 +181,7 @@ formatData &lt;- function(type=&quot;eval&quot;) {
179 181 FAR <<- data[grep("FAR",data$Plot),-c(1)]
180 182 FRR <<- data[grep("FRR",data$Plot),-c(1)]
181 183 SD <<- data[grep("SD",data$Plot),-c(1)]
182   - TF <<- data[grep("TF",data$Plot),-c(1)]
  184 + FF <<- data[grep("FF",data$Plot),-c(1)]
183 185 FT <<- data[grep("FT",data$Plot),-c(1)]
184 186 CT <<- data[grep("CT",data$Plot),-c(1)]
185 187 BC <<- data[grep("BC",data$Plot),-c(1)]
... ... @@ -195,7 +197,7 @@ formatData &lt;- function(type=&quot;eval&quot;) {
195 197 FAR$Y <<- as.numeric(as.character(FAR$Y))
196 198 FRR$Y <<- as.numeric(as.character(FRR$Y))
197 199 SD$Y <<- as.factor(unique(as.character(SD$Y)))
198   - TF$Y <<- as.numeric(as.character(TF$Y))
  200 + FF$Y <<- as.numeric(as.character(FF$Y))
199 201 FT$Y <<- as.numeric(as.character(FT$Y))
200 202 CT$Y <<- as.numeric(as.character(CT$Y))
201 203 BC$Y <<- as.numeric(as.character(BC$Y))
... ...