Enhance output info in Statistics
This commit is contained in:
parent
3b06534327
commit
71704e3547
@ -2,7 +2,6 @@
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <set>
|
||||
#include "BestResults.h"
|
||||
#include "Result.h"
|
||||
#include "Colors.h"
|
||||
|
@ -3,22 +3,13 @@
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include "Paths.h"
|
||||
#include "Symbols.h"
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
namespace platform {
|
||||
using namespace std;
|
||||
class Symbols {
|
||||
public:
|
||||
inline static const string check_mark{ "\u2714" };
|
||||
inline static const string exclamation{ "\u2757" };
|
||||
inline static const string black_star{ "\u2605" };
|
||||
inline static const string cross{ "\u2717" };
|
||||
inline static const string upward_arrow{ "\u27B6" };
|
||||
inline static const string down_arrow{ "\u27B4" };
|
||||
inline static const string equal_best{ check_mark };
|
||||
inline static const string better_best{ black_star };
|
||||
};
|
||||
|
||||
class ReportBase {
|
||||
public:
|
||||
explicit ReportBase(json data_, bool compare);
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "Statistics.h"
|
||||
#include "Colors.h"
|
||||
#include "Symbols.h"
|
||||
#include <boost/math/distributions/chi_squared.hpp>
|
||||
#include <boost/math/distributions/normal.hpp>
|
||||
|
||||
@ -24,7 +25,7 @@ namespace platform {
|
||||
computeWTL();
|
||||
fitted = true;
|
||||
}
|
||||
map<string, float> assignRanks2(vector<pair<string, double>>& ranksOrder)
|
||||
map<string, float> assignRanks(vector<pair<string, double>>& ranksOrder)
|
||||
{
|
||||
// sort the ranksOrder vector by value
|
||||
sort(ranksOrder.begin(), ranksOrder.end(), [](const pair<string, double>& a, const pair<string, double>& b) {
|
||||
@ -62,7 +63,7 @@ namespace platform {
|
||||
ranksOrder.push_back({ model, value });
|
||||
}
|
||||
// Assign the ranks
|
||||
ranksLine = assignRanks2(ranksOrder);
|
||||
ranksLine = assignRanks(ranksOrder);
|
||||
if (ranks.size() == 0) {
|
||||
ranks = ranksLine;
|
||||
} else {
|
||||
@ -139,13 +140,13 @@ namespace platform {
|
||||
p_value = max(before, p_value);
|
||||
statsOrder[i] = { item.first, p_value };
|
||||
}
|
||||
auto color = friedmanResult ? Colors::GREEN() : Colors::YELLOW();
|
||||
auto color = friedmanResult ? Colors::CYAN() : Colors::YELLOW();
|
||||
cout << color;
|
||||
cout << " *************************************************************************************************************" << endl;
|
||||
cout << " Post-hoc Holm test: H0: 'There is no significant differences between the control model and the other models.'" << endl;
|
||||
cout << " Control model: " << models[controlIdx] << endl;
|
||||
cout << " Model p-value rank win tie loss" << endl;
|
||||
cout << " ============ ============ ========= === === ====" << endl;
|
||||
cout << " Model p-value rank win tie loss Status" << endl;
|
||||
cout << " ============ ============ ========= === === ==== =============" << endl;
|
||||
// sort ranks from lowest to highest
|
||||
vector<pair<string, float>> ranksOrder;
|
||||
for (const auto& rank : ranks) {
|
||||
@ -165,10 +166,14 @@ namespace platform {
|
||||
pvalue = stat.second;
|
||||
}
|
||||
}
|
||||
cout << " " << left << setw(12) << item.first << " " << setprecision(10) << fixed << pvalue << setprecision(7) << " " << item.second;
|
||||
cout << " " << right << setw(3) << wtl.at(idx).win << " " << setw(3) << wtl.at(idx).tie << " " << setw(4) << wtl.at(idx).loss << endl;
|
||||
auto colorStatus = pvalue > significance ? Colors::GREEN() : Colors::MAGENTA();
|
||||
auto status = pvalue > significance ? Symbols::check_mark : Symbols::cross;
|
||||
auto textStatus = pvalue > significance ? " accepted H0" : " rejected H0";
|
||||
cout << " " << colorStatus << left << setw(12) << item.first << " " << setprecision(6) << scientific << pvalue << setprecision(7) << fixed << " " << item.second;
|
||||
cout << " " << right << setw(3) << wtl.at(idx).win << " " << setw(3) << wtl.at(idx).tie << " " << setw(4) << wtl.at(idx).loss;
|
||||
cout << " " << status << textStatus << endl;
|
||||
}
|
||||
cout << " *************************************************************************************************************" << endl;
|
||||
cout << color << " *************************************************************************************************************" << endl;
|
||||
cout << Colors::RESET();
|
||||
}
|
||||
bool Statistics::friedmanTest()
|
||||
|
18
src/Platform/Symbols.h
Normal file
18
src/Platform/Symbols.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef SYMBOLS_H
|
||||
#define SYMBOLS_H
|
||||
#include <string>
|
||||
using namespace std;
|
||||
namespace platform {
|
||||
class Symbols {
|
||||
public:
|
||||
inline static const string check_mark{ "\u2714" };
|
||||
inline static const string exclamation{ "\u2757" };
|
||||
inline static const string black_star{ "\u2605" };
|
||||
inline static const string cross{ "\u2717" };
|
||||
inline static const string upward_arrow{ "\u27B6" };
|
||||
inline static const string down_arrow{ "\u27B4" };
|
||||
inline static const string equal_best{ check_mark };
|
||||
inline static const string better_best{ black_star };
|
||||
};
|
||||
}
|
||||
#endif // !SYMBOLS_H
|
Loading…
Reference in New Issue
Block a user