/// <summary> /// Evaluates the test results. /// </summary> /// <param name="testResults">Set of test results.</param> /// <param name="_testName">Descriptive name to be attached at results report.</param> /// <param name="logger">The logger - to log any problems, if occourred.</param> /// <param name="averagingMethod">The averaging method.</param> /// <returns></returns> public classificationReport EvaluateTestResults(List <FeatureVectorWithLabelID> testResults, String _testName, ILogBuilder logger, classificationMetricComputation averagingMethod = classificationMetricComputation.macroAveraging) { //classificationReport report = new classificationReport() classificationReport report = new classificationReport(_testName); classificationEvalMetricSet metric = EvaluateTestResultsToMetricSet(testResults, _testName, logger); report.GetSetMetrics(metric); report.AddValues(metric, averagingMethod); return(report); }
/// <summary> /// Generates the final reports and read me files /// </summary> public void CloseExperiment(ILogBuilder logger, long startOfLog) { if (!testSummaries.Any()) { logger.log("No experiment procedures performes"); return; } DataTableTypeExtended <classificationReport> summaryTable = new DataTableTypeExtended <classificationReport>("Test results", "k-fold cross valudation results"); classificationReport sumRow = new classificationReport(runName); sumRow.Comment = runName + ", " + description; // classificationEvalMetricSet metric = new classificationEvalMetricSet("Total", truthTable.labels_without_unknown); foreach (classificationReport s in testSummaries) { summaryTable.AddRow(s); //metric = metric + s; if (sumRow.Classifier.isNullOrEmpty()) { sumRow.Classifier = s.Classifier; } sumRow.AddValues(s); } sumRow.DivideValues(testSummaries.Count); sumRow.SetReportDataFields(crossValidation, this); summaryTable.SetDescription(description); summaryTable.SetAdditionalInfoEntry("RunName", runName); summaryTable.SetAdditionalInfoEntry("Description", description); summaryTable.SetAdditionalInfoEntry("Averaging", averagingMethod.ToString()); summaryTable.AddRow(sumRow); summaryTable.GetReportAndSave(notes.folder, signature); finalReport = sumRow; //sumRow.ReportToLog(logger); sumRow.ReportToLog(notes); objectSerialization.saveObjectToXML(sumRow, notes.folder.pathFor("results.xml", imbSCI.Data.enums.getWritableFileMode.overwrite, "Experiment results", true)); logger.log("Experiment completed"); notes.SaveNote("note"); String logPrintout = logger.GetContent(startOfLog); String p = notes.folder.pathFor("log.txt", imbSCI.Data.enums.getWritableFileMode.overwrite, "Log printout during experiment execution"); File.WriteAllText(p, logPrintout); experimentRootFolder.generateReadmeFiles(signature); }