diff --git a/sample/sample.cpp b/sample/sample.cpp index 49d5d91..4dbce17 100644 --- a/sample/sample.cpp +++ b/sample/sample.cpp @@ -27,7 +27,7 @@ void usage(const char *path) { cout << " -p, --path[=FILENAME]\t folder where the arff dataset is located, default " << PATH << endl; cout << " -m, --max_depth=INT\t max_depth pased to discretizer. Default = MAX_INT" << endl; cout - << " -c, --max_cutpoints=FLOAT\t percentage of lines expressed in decimal or integer number or cut points. Default = 0 = any" + << " -c, --max_cutpoints=FLOAT\t percentage of lines expressed in decimal or integer number or cut points. Default = 0 -> any" << endl; cout << " -n, --min_length=INT\t interval min_length pased to discretizer. Default = 3" << endl; } @@ -38,7 +38,7 @@ tuple parse_arguments(int argc, char **argv) { int max_depth = numeric_limits::max(); int min_length = 3; float max_cutpoints = 0; - const option long_options[] = { + const vector long_options = { {"help", no_argument, nullptr, 'h'}, {"file", required_argument, nullptr, 'f'}, {"path", required_argument, nullptr, 'p'}, @@ -48,7 +48,7 @@ tuple parse_arguments(int argc, char **argv) { {nullptr, no_argument, nullptr, 0} }; while (true) { - const auto c = getopt_long(argc, argv, "hf:p:m:c:n:", long_options, nullptr); + const auto c = getopt_long(argc, argv, "hf:p:m:c:n:", long_options.data(), nullptr); if (c == -1) break; switch (c) { @@ -91,8 +91,8 @@ void process_file(const string &path, const string &file_name, bool class_last, ArffFiles file; file.load(path + file_name + ".arff", class_last); - auto attributes = file.getAttributes(); - auto items = file.getSize(); + const auto attributes = file.getAttributes(); + const auto items = file.getSize(); cout << "Number of lines: " << items << endl; cout << "Attributes: " << endl; for (auto attribute: attributes) { @@ -110,7 +110,7 @@ void process_file(const string &path, const string &file_name, bool class_last, cout << y[i] << endl; } auto test = mdlp::CPPFImdlp(min_length, max_depth, max_cutpoints); - auto total = 0; + size_t total = 0; for (auto i = 0; i < attributes.size(); i++) { auto min_max = minmax_element(X[i].begin(), X[i].end()); cout << "Cut points for " << get<0>(attributes[i]) << endl; @@ -139,7 +139,7 @@ void process_all_files(const map &datasets, const string &path, in vector &X = file.getX(); labels_t &y = file.getY(); size_t timing = 0; - int cut_points = 0; + size_t cut_points = 0; for (auto i = 0; i < attributes.size(); i++) { auto test = mdlp::CPPFImdlp(min_length, max_depth, max_cutpoints); std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now(); @@ -148,7 +148,7 @@ void process_all_files(const map &datasets, const string &path, in timing += std::chrono::duration_cast(end - begin).count(); cut_points += test.getCutPoints().size(); } - printf("%-20s %4lu %4d %8zu\n", dataset.first.c_str(), attributes.size(), cut_points, timing); + printf("%-20s %4lu %4zu %8zu\n", dataset.first.c_str(), attributes.size(), cut_points, timing); } }