Fix mistake in comparison

This commit is contained in:
Ricardo Montañana Gómez 2023-09-19 23:46:49 +02:00
parent f69f415b92
commit 925f71166c
Signed by: rmontanana
GPG Key ID: 46064262FD9A7ADE

View File

@ -156,7 +156,6 @@ namespace platform {
{ {
char line[data["title"].get<string>().size() + 1]; char line[data["title"].get<string>().size() + 1];
strcpy(line, data["title"].get<string>().c_str()); strcpy(line, data["title"].get<string>().c_str());
/* Create a properties structure and set some of the fields. */
lxw_doc_properties properties = { lxw_doc_properties properties = {
.title = line, .title = line,
.subject = "Machine learning results", .subject = "Machine learning results",
@ -165,8 +164,6 @@ namespace platform {
.company = "UCLM", .company = "UCLM",
.comments = "Created with libxlsxwriter and c++", .comments = "Created with libxlsxwriter and c++",
}; };
/* Set the properties in the workbook. */
workbook_set_properties(workbook, &properties); workbook_set_properties(workbook, &properties);
} }
@ -289,9 +286,12 @@ namespace platform {
auto numClasses = dt.getNClasses(dataset); auto numClasses = dt.getNClasses(dataset);
if (numClasses == 2) { if (numClasses == 2) {
vector<int> distribution = dt.getClassesCounts(dataset); vector<int> distribution = dt.getClassesCounts(dataset);
double nSamples = dt.getNSamples(dataset);
vector<int>::iterator maxValue = max_element(distribution.begin(), distribution.end()); vector<int>::iterator maxValue = max_element(distribution.begin(), distribution.end());
int maxCategory = distance(distribution.begin(), maxValue); double mark = *maxValue / nSamples * (1 + margin);
double mark = maxCategory * (1 + margin); if (mark > 1) {
mark = 0.9995;
}
status = result < mark ? Symbols::cross : result > mark ? Symbols::upward_arrow : "="; status = result < mark ? Symbols::cross : result > mark ? Symbols::upward_arrow : "=";
auto item = summary.find(status); auto item = summary.find(status);
if (item != summary.end()) { if (item != summary.end()) {
@ -325,11 +325,11 @@ namespace platform {
void ReportExcel::footer(double totalScore, int row) void ReportExcel::footer(double totalScore, int row)
{ {
showSummary(); showSummary();
row += 2 + summary.size(); row += 4 + summary.size();
auto score = data["score_name"].get<string>(); auto score = data["score_name"].get<string>();
if (score == BestResult::scoreName()) { if (score == BestResult::scoreName()) {
worksheet_merge_range(worksheet, row + 2, 1, row + 2, 5, (score + " compared to " + BestResult::title() + " .:").c_str(), styles["text_even"]); worksheet_merge_range(worksheet, row, 1, row, 5, (score + " compared to " + BestResult::title() + " .:").c_str(), efectiveStyle("text"));
writeDouble(row + 2, 6, totalScore / BestResult::score(), "result"); writeDouble(row, 6, totalScore / BestResult::score(), "result");
} }
} }
} }