Add Control model rank info to report
This commit is contained in:
parent
93e4ff94db
commit
c4ae3fe429
12
README.md
12
README.md
@ -10,6 +10,18 @@ Before compiling BayesNet.
|
||||
|
||||
[Getting Started](<https://www.boost.org/doc/libs/1_83_0/more/getting_started/index.html>)
|
||||
|
||||
The best option is install the packages that the Linux distribution have in its repository. If this is the case:
|
||||
|
||||
```bash
|
||||
sudo dnf install boost-devel
|
||||
```
|
||||
|
||||
If this is not possible and the compressed packaged is installed, the following environment variable has to be set:
|
||||
|
||||
```bash
|
||||
export BOOST_ROOT=/path/to/library/
|
||||
```
|
||||
|
||||
### libxlswriter
|
||||
|
||||
```bash
|
||||
|
@ -290,6 +290,7 @@ namespace platform {
|
||||
if (excel) {
|
||||
BestResultsExcel excel(score, models, datasets, table, friedman, significance);
|
||||
excel.build();
|
||||
cout << Colors::YELLOW() << "** Excel file generated: " << excel.getFileName() << Colors::RESET() << endl;
|
||||
}
|
||||
}
|
||||
}
|
@ -37,6 +37,10 @@ namespace platform {
|
||||
body();
|
||||
footer();
|
||||
}
|
||||
string BestResultsExcel::getFileName()
|
||||
{
|
||||
return Paths::excel() + fileName;
|
||||
}
|
||||
void BestResultsExcel::header()
|
||||
{
|
||||
row = 0;
|
||||
@ -123,14 +127,27 @@ namespace platform {
|
||||
writeString(row, 6, "Loss", "bodyHeader");
|
||||
writeString(row, 7, "Reject H0", "bodyHeader");
|
||||
row++;
|
||||
bool first = true;
|
||||
for (const auto& item : holmResult.holmLines) {
|
||||
writeString(row, 1, item.model, "text");
|
||||
writeDouble(row, 2, item.pvalue, "result");
|
||||
writeDouble(row, 3, item.rank, "result");
|
||||
writeInt(row, 4, item.wtl.win, "ints");
|
||||
writeInt(row, 5, item.wtl.tie, "ints");
|
||||
writeInt(row, 6, item.wtl.loss, "ints");
|
||||
writeString(row, 7, item.reject ? "Yes" : "No", "textCentered");
|
||||
if (first) {
|
||||
// Control model info
|
||||
first = false;
|
||||
writeString(row, 2, "", "text");
|
||||
writeDouble(row, 3, item.rank, "result");
|
||||
writeString(row, 4, "", "text");
|
||||
writeString(row, 5, "", "text");
|
||||
writeString(row, 6, "", "text");
|
||||
writeString(row, 7, "", "textCentered");
|
||||
} else {
|
||||
// Rest of the models info
|
||||
writeDouble(row, 2, item.pvalue, "result");
|
||||
writeDouble(row, 3, item.rank, "result");
|
||||
writeInt(row, 4, item.wtl.win, "ints");
|
||||
writeInt(row, 5, item.wtl.tie, "ints");
|
||||
writeInt(row, 6, item.wtl.loss, "ints");
|
||||
writeString(row, 7, item.reject ? "Yes" : "No", "textCentered");
|
||||
}
|
||||
row++;
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ namespace platform {
|
||||
BestResultsExcel(string score, vector<string> models, vector<string> datasets, json table, bool friedman, double significance);
|
||||
~BestResultsExcel();
|
||||
void build();
|
||||
string getFileName();
|
||||
private:
|
||||
void header();
|
||||
void body();
|
||||
|
@ -161,10 +161,10 @@ namespace platform {
|
||||
sort(ranksOrder.begin(), ranksOrder.end(), [](const pair<string, float>& a, const pair<string, float>& b) {
|
||||
return a.second < b.second;
|
||||
});
|
||||
// Show the control model info.
|
||||
oss << " " << Colors::BLUE() << left << setw(maxModelName) << ranksOrder.at(0).first << " ";
|
||||
oss << setw(12) << " " << setprecision(7) << fixed << " " << ranksOrder.at(0).second << endl;
|
||||
for (const auto& item : ranksOrder) {
|
||||
if (item.first == models.at(controlIdx)) {
|
||||
continue;
|
||||
}
|
||||
auto idx = distance(models.begin(), find(models.begin(), models.end(), item.first));
|
||||
double pvalue = 0.0;
|
||||
for (const auto& stat : statsOrder) {
|
||||
@ -172,13 +172,17 @@ namespace platform {
|
||||
pvalue = stat.second;
|
||||
}
|
||||
}
|
||||
holmResult.holmLines.push_back({ item.first, pvalue, item.second, wtl.at(idx), pvalue < significance });
|
||||
if (item.first == models.at(controlIdx)) {
|
||||
continue;
|
||||
}
|
||||
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";
|
||||
oss << " " << colorStatus << left << setw(maxModelName) << item.first << " " << setprecision(6) << scientific << pvalue << setprecision(7) << fixed << " " << item.second;
|
||||
oss << " " << colorStatus << left << setw(maxModelName) << item.first << " ";
|
||||
oss << setprecision(6) << scientific << pvalue << setprecision(7) << fixed << " " << item.second;
|
||||
oss << " " << right << setw(3) << wtl.at(idx).win << " " << setw(3) << wtl.at(idx).tie << " " << setw(4) << wtl.at(idx).loss;
|
||||
oss << " " << status << textStatus << endl;
|
||||
holmResult.holmLines.push_back({ item.first, pvalue, item.second, wtl.at(idx), pvalue < significance });
|
||||
}
|
||||
oss << color << " *************************************************************************************************************" << endl;
|
||||
oss << Colors::RESET();
|
||||
|
Loading…
Reference in New Issue
Block a user