| 347 | } |
| 348 | |
| 349 | bool PlotKNN(const QStringList &files, const File &destination, bool show) |
| 350 | { |
| 351 | qDebug("Plotting %d k-NN file(s) to %s", files.size(), qPrintable(destination)); |
| 352 | RPlot p(files, destination); |
| 353 | p.file.write("\nformatData(type=\"knn\")\n\n"); |
| 354 | |
| 355 | QMap<QString,File> optMap; |
| 356 | optMap.insert("rocOptions", File(QString("[xTitle=False Positive Identification Rate (FPIR),yTitle=True Positive Identification Rate (TPIR),xLog=true,yLog=false]"))); |
| 357 | optMap.insert("ietOptions", File(QString("[xTitle=False Positive Identification Rate (FPIR),yTitle=False Negative Identification Rate (FNIR),xLog=true,yLog=true]"))); |
| 358 | optMap.insert("cmcOptions", File(QString("[xTitle=Rank,yTitle=Retrieval Rate,xLog=true,yLog=false,size=1,xLabels=(1,5,10,50,100),xBreaks=(1,5,10,50,100)]"))); |
| 359 | |
| 360 | foreach (const QString &key, optMap.keys()) { |
| 361 | const QStringList options = destination.get<QStringList>(key, QStringList()); |
| 362 | foreach (const QString &option, options) { |
| 363 | QStringList words = QtUtils::parse(option, '='); |
| 364 | QtUtils::checkArgsSize(words[0], words, 1, 2); |
| 365 | optMap[key].set(words[0], words[1]); |
| 366 | } |
| 367 | } |
| 368 | |
| 369 | QString plot = "plot <- plotLine(lineData=%1, options=list(%2), flipY=%3)\nplot\n"; |
| 370 | p.file.write(qPrintable(QString(plot).arg("IET", toRList(optMap["rocOptions"]), "TRUE"))); |
| 371 | p.file.write(qPrintable(QString(plot).arg("IET", toRList(optMap["ietOptions"]), "FALSE"))); |
| 372 | p.file.write(qPrintable(QString(plot).arg("CMC", toRList(optMap["cmcOptions"]), "FALSE"))); |
| 373 | |
| 374 | return p.finalize(show); |
| 375 | } |
| 376 | |
| 377 | } // namespace br |