From 925f71166cec25effdbc18cd9a0b74d5b936a1aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Monta=C3=B1ana?= Date: Tue, 19 Sep 2023 23:46:49 +0200 Subject: [PATCH] Fix mistake in comparison --- src/Platform/ReportExcel.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Platform/ReportExcel.cc b/src/Platform/ReportExcel.cc index acb2eaa..50293bf 100644 --- a/src/Platform/ReportExcel.cc +++ b/src/Platform/ReportExcel.cc @@ -156,7 +156,6 @@ namespace platform { { char line[data["title"].get().size() + 1]; strcpy(line, data["title"].get().c_str()); - /* Create a properties structure and set some of the fields. */ lxw_doc_properties properties = { .title = line, .subject = "Machine learning results", @@ -165,8 +164,6 @@ namespace platform { .company = "UCLM", .comments = "Created with libxlsxwriter and c++", }; - - /* Set the properties in the workbook. */ workbook_set_properties(workbook, &properties); } @@ -289,9 +286,12 @@ namespace platform { auto numClasses = dt.getNClasses(dataset); if (numClasses == 2) { vector distribution = dt.getClassesCounts(dataset); + double nSamples = dt.getNSamples(dataset); vector::iterator maxValue = max_element(distribution.begin(), distribution.end()); - int maxCategory = distance(distribution.begin(), maxValue); - double mark = maxCategory * (1 + margin); + double mark = *maxValue / nSamples * (1 + margin); + if (mark > 1) { + mark = 0.9995; + } status = result < mark ? Symbols::cross : result > mark ? Symbols::upward_arrow : "="; auto item = summary.find(status); if (item != summary.end()) { @@ -325,11 +325,11 @@ namespace platform { void ReportExcel::footer(double totalScore, int row) { showSummary(); - row += 2 + summary.size(); + row += 4 + summary.size(); auto score = data["score_name"].get(); if (score == BestResult::scoreName()) { - worksheet_merge_range(worksheet, row + 2, 1, row + 2, 5, (score + " compared to " + BestResult::title() + " .:").c_str(), styles["text_even"]); - writeDouble(row + 2, 6, totalScore / BestResult::score(), "result"); + worksheet_merge_range(worksheet, row, 1, row, 5, (score + " compared to " + BestResult::title() + " .:").c_str(), efectiveStyle("text")); + writeDouble(row, 6, totalScore / BestResult::score(), "result"); } } } \ No newline at end of file