mirror of
https://github.com/rmontanana/mdlp.git
synced 2025-08-15 15:35:55 +00:00
Change some types in sample
This commit is contained in:
@@ -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 << " -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 << " -m, --max_depth=INT\t max_depth pased to discretizer. Default = MAX_INT" << endl;
|
||||||
cout
|
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;
|
<< endl;
|
||||||
cout << " -n, --min_length=INT\t interval min_length pased to discretizer. Default = 3" << endl;
|
cout << " -n, --min_length=INT\t interval min_length pased to discretizer. Default = 3" << endl;
|
||||||
}
|
}
|
||||||
@@ -38,7 +38,7 @@ tuple<string, string, int, int, float> parse_arguments(int argc, char **argv) {
|
|||||||
int max_depth = numeric_limits<int>::max();
|
int max_depth = numeric_limits<int>::max();
|
||||||
int min_length = 3;
|
int min_length = 3;
|
||||||
float max_cutpoints = 0;
|
float max_cutpoints = 0;
|
||||||
const option long_options[] = {
|
const vector<struct option> long_options = {
|
||||||
{"help", no_argument, nullptr, 'h'},
|
{"help", no_argument, nullptr, 'h'},
|
||||||
{"file", required_argument, nullptr, 'f'},
|
{"file", required_argument, nullptr, 'f'},
|
||||||
{"path", required_argument, nullptr, 'p'},
|
{"path", required_argument, nullptr, 'p'},
|
||||||
@@ -48,7 +48,7 @@ tuple<string, string, int, int, float> parse_arguments(int argc, char **argv) {
|
|||||||
{nullptr, no_argument, nullptr, 0}
|
{nullptr, no_argument, nullptr, 0}
|
||||||
};
|
};
|
||||||
while (true) {
|
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)
|
if (c == -1)
|
||||||
break;
|
break;
|
||||||
switch (c) {
|
switch (c) {
|
||||||
@@ -91,8 +91,8 @@ void process_file(const string &path, const string &file_name, bool class_last,
|
|||||||
ArffFiles file;
|
ArffFiles file;
|
||||||
|
|
||||||
file.load(path + file_name + ".arff", class_last);
|
file.load(path + file_name + ".arff", class_last);
|
||||||
auto attributes = file.getAttributes();
|
const auto attributes = file.getAttributes();
|
||||||
auto items = file.getSize();
|
const auto items = file.getSize();
|
||||||
cout << "Number of lines: " << items << endl;
|
cout << "Number of lines: " << items << endl;
|
||||||
cout << "Attributes: " << endl;
|
cout << "Attributes: " << endl;
|
||||||
for (auto attribute: attributes) {
|
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;
|
cout << y[i] << endl;
|
||||||
}
|
}
|
||||||
auto test = mdlp::CPPFImdlp(min_length, max_depth, max_cutpoints);
|
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++) {
|
for (auto i = 0; i < attributes.size(); i++) {
|
||||||
auto min_max = minmax_element(X[i].begin(), X[i].end());
|
auto min_max = minmax_element(X[i].begin(), X[i].end());
|
||||||
cout << "Cut points for " << get<0>(attributes[i]) << endl;
|
cout << "Cut points for " << get<0>(attributes[i]) << endl;
|
||||||
@@ -139,7 +139,7 @@ void process_all_files(const map<string, bool> &datasets, const string &path, in
|
|||||||
vector<samples_t> &X = file.getX();
|
vector<samples_t> &X = file.getX();
|
||||||
labels_t &y = file.getY();
|
labels_t &y = file.getY();
|
||||||
size_t timing = 0;
|
size_t timing = 0;
|
||||||
int cut_points = 0;
|
size_t cut_points = 0;
|
||||||
for (auto i = 0; i < attributes.size(); i++) {
|
for (auto i = 0; i < attributes.size(); i++) {
|
||||||
auto test = mdlp::CPPFImdlp(min_length, max_depth, max_cutpoints);
|
auto test = mdlp::CPPFImdlp(min_length, max_depth, max_cutpoints);
|
||||||
std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now();
|
std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now();
|
||||||
@@ -148,7 +148,7 @@ void process_all_files(const map<string, bool> &datasets, const string &path, in
|
|||||||
timing += std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count();
|
timing += std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count();
|
||||||
cut_points += test.getCutPoints().size();
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user