Compare commits

..

2 Commits

2 changed files with 16 additions and 6 deletions

View File

@@ -32,7 +32,12 @@ namespace platform {
}
sorted_lines.push_back(line);
}
std::stable_sort(sorted_lines.begin(), sorted_lines.end());
sort(sorted_lines.begin(), sorted_lines.end(), [](const auto& lhs, const auto& rhs) {
const auto result = mismatch(lhs.cbegin(), lhs.cend(), rhs.cbegin(), rhs.cend(), [](const auto& lhs, const auto& rhs) {return tolower(lhs) == tolower(rhs);});
return result.second != rhs.cend() && (result.first == lhs.cend() || tolower(*result.first) < tolower(*result.second));
});
for (const auto& line : sorted_lines) {
std::vector<std::string> tokens = split(line, ';');
std::string name = tokens[0];
@@ -76,6 +81,11 @@ namespace platform {
{
std::vector<std::string> result;
transform(datasets.begin(), datasets.end(), back_inserter(result), [](const auto& d) { return d.first; });
sort(result.begin(), result.end(), [](const auto& lhs, const auto& rhs) {
const auto result = mismatch(lhs.cbegin(), lhs.cend(), rhs.cbegin(), rhs.cend(), [](const auto& lhs, const auto& rhs) {return tolower(lhs) == tolower(rhs);});
return result.second != rhs.cend() && (result.first == lhs.cend() || tolower(*result.first) < tolower(*result.second));
});
return result;
}
bool Datasets::isDataset(const std::string& name) const

View File

@@ -28,7 +28,7 @@ namespace platform {
auto datasets_names = datasets.getNames();
int maxName = std::max(size_t(7), (*max_element(datasets_names.begin(), datasets_names.end(), [](const std::string& a, const std::string& b) { return a.size() < b.size(); })).size());
std::vector<std::string> header_labels = { " #", "Dataset", "Sampl.", "Feat.", "#Num.", "Cls", "Balance" };
std::vector<int> header_lengths = { 3, maxName, 6, 5, 5, 3, DatasetsConsole::BALANCE_LENGTH };
std::vector<int> header_lengths = { 3, maxName, 6, 6, 6, 3, DatasetsConsole::BALANCE_LENGTH };
sheader << Colors::GREEN();
for (int i = 0; i < header_labels.size(); i++) {
sheader << setw(header_lengths[i]) << left << header_labels[i] << " ";
@@ -51,14 +51,14 @@ namespace platform {
auto& dataset = datasets.getDataset(dataset_name);
dataset.load();
auto nSamples = dataset.getNSamples();
line << setw(6) << right << nSamples << " ";
line << setw(header_lengths[2]) << right << nSamples << " ";
auto nFeatures = dataset.getFeatures().size();
line << setw(5) << right << nFeatures << " ";
line << setw(header_lengths[3]) << right << nFeatures << " ";
auto numericFeatures = dataset.getNumericFeatures();
auto num = std::count(numericFeatures.begin(), numericFeatures.end(), true);
line << setw(5) << right << num << " ";
line << setw(header_lengths[4]) << right << num << " ";
auto nClasses = dataset.getNClasses();
line << setw(3) << right << nClasses << " ";
line << setw(header_lengths[5]) << right << nClasses << " ";
std::string sep = "";
oss.str("");
for (auto number : dataset.getClassesCounts()) {