Compare commits
6 Commits
libxlsxwri
...
5fa0b957dd
Author | SHA1 | Date | |
---|---|---|---|
5fa0b957dd
|
|||
67252fc41d
|
|||
94ae9456a0
|
|||
781993e326
|
|||
8257a6ae39
|
|||
fc81730dfc |
@@ -54,6 +54,7 @@ endif (ENABLE_CLANG_TIDY)
|
||||
add_git_submodule("lib/mdlp")
|
||||
add_git_submodule("lib/argparse")
|
||||
add_git_submodule("lib/json")
|
||||
find_library(XLSXWRITER_LIB libxlsxwriter.dylib PATHS /usr/local/lib)
|
||||
|
||||
# Subdirectories
|
||||
# --------------
|
||||
|
@@ -4,6 +4,7 @@ include_directories(${BayesNet_SOURCE_DIR}/lib/Files)
|
||||
include_directories(${BayesNet_SOURCE_DIR}/lib/mdlp)
|
||||
include_directories(${BayesNet_SOURCE_DIR}/lib/argparse/include)
|
||||
include_directories(${BayesNet_SOURCE_DIR}/lib/json/include)
|
||||
include_directories(${BayesNet_SOURCE_DIR}/lib/libxlsxwriter/include)
|
||||
add_executable(main main.cc Folding.cc platformUtils.cc Experiment.cc Datasets.cc Models.cc ReportConsole.cc ReportBase.cc)
|
||||
add_executable(manage manage.cc Results.cc ReportConsole.cc ReportExcel.cc ReportBase.cc Datasets.cc platformUtils.cc)
|
||||
add_executable(list list.cc platformUtils Datasets.cc)
|
||||
@@ -11,6 +12,6 @@ target_link_libraries(main BayesNet ArffFiles mdlp "${TORCH_LIBRARIES}")
|
||||
if (${CMAKE_HOST_SYSTEM_NAME} MATCHES "Linux")
|
||||
target_link_libraries(manage "${TORCH_LIBRARIES}" libxlsxwriter.so ArffFiles mdlp stdc++fs)
|
||||
else()
|
||||
target_link_libraries(manage "${TORCH_LIBRARIES}" libxlsxwriter.so ArffFiles mdlp)
|
||||
target_link_libraries(manage "${TORCH_LIBRARIES}" "${XLSXWRITER_LIB}" ArffFiles mdlp)
|
||||
endif()
|
||||
target_link_libraries(list ArffFiles mdlp "${TORCH_LIBRARIES}")
|
@@ -94,6 +94,8 @@ namespace platform {
|
||||
ifstream resultData(Paths::results() + "/" + fileName);
|
||||
if (resultData.is_open()) {
|
||||
bestResults = json::parse(resultData);
|
||||
} else {
|
||||
existBestFile = false;
|
||||
}
|
||||
}
|
||||
try {
|
||||
@@ -101,7 +103,12 @@ namespace platform {
|
||||
}
|
||||
catch (exception) {
|
||||
value = 1.0;
|
||||
|
||||
}
|
||||
return value;
|
||||
}
|
||||
bool ReportBase::getExistBestFile()
|
||||
{
|
||||
return existBestFile;
|
||||
}
|
||||
}
|
@@ -28,6 +28,7 @@ namespace platform {
|
||||
json data;
|
||||
string fromVector(const string& key);
|
||||
string fVector(const string& title, const json& data, const int width, const int precision);
|
||||
bool getExistBestFile();
|
||||
virtual void header() = 0;
|
||||
virtual void body() = 0;
|
||||
virtual void showSummary() = 0;
|
||||
@@ -35,10 +36,11 @@ namespace platform {
|
||||
map<string, int> summary;
|
||||
double margin;
|
||||
map<string, string> meaning;
|
||||
bool compare;
|
||||
private:
|
||||
double bestResult(const string& dataset, const string& model);
|
||||
bool compare;
|
||||
json bestResults;
|
||||
bool existBestFile = true;
|
||||
};
|
||||
};
|
||||
#endif
|
@@ -104,6 +104,9 @@ namespace platform {
|
||||
oss << score << " compared to " << BestResult::title() << " .: " << totalScore / BestResult::score();
|
||||
cout << headerLine(oss.str());
|
||||
}
|
||||
if (!getExistBestFile() && compare) {
|
||||
cout << headerLine("*** Best Results File not found. Couldn't compare any result!");
|
||||
}
|
||||
cout << string(MAXL, '*') << endl << Colors::RESET();
|
||||
}
|
||||
}
|
@@ -18,7 +18,7 @@ namespace platform {
|
||||
void header() override;
|
||||
void body() override;
|
||||
void footer(double totalScore);
|
||||
void showSummary();
|
||||
void showSummary() override;
|
||||
};
|
||||
};
|
||||
#endif
|
@@ -162,11 +162,11 @@ namespace platform {
|
||||
strcpy(line, data["title"].get<string>().c_str());
|
||||
lxw_doc_properties properties = {
|
||||
.title = line,
|
||||
.subject = "Machine learning results",
|
||||
.author = "Ricardo Montañana Gómez",
|
||||
.manager = "Dr. J. A. Gámez, Dr. J. M. Puerta",
|
||||
.company = "UCLM",
|
||||
.comments = "Created with libxlsxwriter and c++",
|
||||
.subject = (char*)"Machine learning results",
|
||||
.author = (char*)"Ricardo Montañana Gómez",
|
||||
.manager = (char*)"Dr. J. A. Gámez, Dr. J. M. Puerta",
|
||||
.company = (char*)"UCLM",
|
||||
.comments = (char*)"Created with libxlsxwriter and c++",
|
||||
};
|
||||
workbook_set_properties(workbook, &properties);
|
||||
}
|
||||
@@ -326,5 +326,8 @@ namespace platform {
|
||||
worksheet_merge_range(worksheet, row, 1, row, 5, (score + " compared to " + BestResult::title() + " .:").c_str(), efectiveStyle("text"));
|
||||
writeDouble(row, 6, totalScore / BestResult::score(), "result");
|
||||
}
|
||||
if (!getExistBestFile() && compare) {
|
||||
worksheet_write_string(worksheet, row + 1, 0, "*** Best Results File not found. Couldn't compare any result!", styles["summaryStyle"]);
|
||||
}
|
||||
}
|
||||
}
|
@@ -21,7 +21,6 @@ namespace platform {
|
||||
void setProperties();
|
||||
void createFile();
|
||||
void closeFile();
|
||||
void showSummary();
|
||||
lxw_workbook* workbook;
|
||||
lxw_worksheet* worksheet;
|
||||
map<string, lxw_format*> styles;
|
||||
@@ -33,6 +32,7 @@ namespace platform {
|
||||
const string fileName = "some_results.xlsx";
|
||||
void header() override;
|
||||
void body() override;
|
||||
void showSummary() override;
|
||||
void footer(double totalScore, int row);
|
||||
void createStyle(const string& name, lxw_format* style, bool odd);
|
||||
void addColor(lxw_format* style, bool odd);
|
||||
|
@@ -48,6 +48,9 @@ namespace platform {
|
||||
files.push_back(result);
|
||||
}
|
||||
}
|
||||
if (max == 0) {
|
||||
max = files.size();
|
||||
}
|
||||
}
|
||||
string Result::to_string() const
|
||||
{
|
||||
@@ -164,7 +167,7 @@ namespace platform {
|
||||
if (indexList) {
|
||||
// The value is about the files list
|
||||
index = idx;
|
||||
if (index >= 0 && index < files.size()) {
|
||||
if (index >= 0 && index < max) {
|
||||
report(index, false);
|
||||
indexList = false;
|
||||
continue;
|
||||
@@ -300,7 +303,7 @@ namespace platform {
|
||||
if (openExcel) {
|
||||
workbook_close(workbook);
|
||||
}
|
||||
cout << "Done!" << endl;
|
||||
cout << Colors::RESET() << "Done!" << endl;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user