Commit 9af936367e843d4504e8bbcb318c05953d2b4307

Authored by bhklein
1 parent 43ddeb86

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