#include #include #include #include "../CPPFImdlp.h" #include "../tests/ArffFiles.h" using namespace std; using namespace mdlp; int main(int argc, char** argv) { ArffFiles file; string path = "../../tests/datasets/"; map datasets = { {"mfeat-factors", true}, {"iris", true}, {"letter", true}, {"glass", true}, {"kdd_JapaneseVowels", false}, {"test", true} }; if (argc != 2 || datasets.find(argv[1]) == datasets.end()) { cout << "Usage: " << argv[0] << " {mfeat-factors, glass, iris, letter, kdd_JapaneseVowels, test}" << endl; return 1; } file.load(path + argv[1] + ".arff", datasets[argv[1]]); auto attributes = file.getAttributes(); int items = file.getSize(); cout << "Number of lines: " << items << endl; cout << "Attributes: " << endl; for (auto attribute : attributes) { cout << "Name: " << get<0>(attribute) << " Type: " << get<1>(attribute) << endl; } cout << "Class name: " << file.getClassName() << endl; cout << "Class type: " << file.getClassType() << endl; cout << "Data: " << endl; vector& X = file.getX(); labels_t& y = file.getY(); for (int i = 0; i < 50; i++) { for (auto feature : X) { cout << fixed << setprecision(1) << feature[i] << " "; } cout << y[i] << endl; } mdlp::CPPFImdlp test = mdlp::CPPFImdlp(); auto 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; cout << "Min: " << *min_max.first << " Max: " << *min_max.second << endl; cout << "--------------------------" << setprecision(3) << endl; test.fit(X[i], y); for (auto item : test.getCutPoints()) { cout << item << endl; } total += test.getCutPoints().size(); } cout << "Total cut points: " << total << endl; return 0; }