diff --git a/.vscode/launch.json b/.vscode/launch.json index fee0574..e70b71d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,7 +5,7 @@ "type": "lldb", "request": "launch", "name": "sample", - "program": "${workspaceFolder}/build/sample/BayesNetSample", + "program": "${workspaceFolder}/build_debug/sample/BayesNetSample", "args": [ "-d", "iris", @@ -14,7 +14,7 @@ "-s", "271", "-p", - "/Users/rmontanana/Code/discretizbench/datasets/", + "/home/rmontanana/Code/discretizbench/datasets/", ], //"cwd": "${workspaceFolder}/build/sample/", }, @@ -22,24 +22,24 @@ "type": "lldb", "request": "launch", "name": "experiment", - "program": "${workspaceFolder}/build/src/Platform/b_main", + "program": "${workspaceFolder}/build_debug/src/Platform/b_main", "args": [ "-m", "STree", "--stratified", "-d", - "zoo", - "--discretize" + "iris", + //"--discretize" // "--hyperparameters", // "{\"repeatSparent\": true, \"maxModels\": 12}" ], - "cwd": "/Users/rmontanana/Code/odtebench", + "cwd": "/home/rmontanana/Code/discretizbench", }, { "type": "lldb", "request": "launch", "name": "best", - "program": "${workspaceFolder}/build/src/Platform/b_best", + "program": "${workspaceFolder}/build_debug/src/Platform/b_best", "args": [ "-m", "BoostAODE", @@ -47,24 +47,24 @@ "accuracy", "--build", ], - "cwd": "/Users/rmontanana/Code/discretizbench", + "cwd": "/home/rmontanana/Code/discretizbench", }, { "type": "lldb", "request": "launch", "name": "manage", - "program": "${workspaceFolder}/build/src/Platform/b_manage", + "program": "${workspaceFolder}/build_debug/src/Platform/b_manage", "args": [ "-n", "20" ], - "cwd": "/Users/rmontanana/Code/discretizbench", + "cwd": "/home/rmontanana/Code/discretizbench", }, { "type": "lldb", "request": "launch", "name": "list", - "program": "${workspaceFolder}/build/src/Platform/b_list", + "program": "${workspaceFolder}/build_debug/src/Platform/b_list", "args": [], //"cwd": "/Users/rmontanana/Code/discretizbench", "cwd": "/home/rmontanana/Code/covbench", @@ -73,7 +73,7 @@ "type": "lldb", "request": "launch", "name": "test", - "program": "${workspaceFolder}/build/tests/unit_tests", + "program": "${workspaceFolder}/build_debug/tests/unit_tests", "args": [ "-c=\"Metrics Test\"", // "-s", @@ -84,7 +84,7 @@ "name": "Build & debug active file", "type": "cppdbg", "request": "launch", - "program": "${workspaceFolder}/build/bayesnet", + "program": "${workspaceFolder}/build_debug/bayesnet", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", diff --git a/src/Platform/Experiment.cc b/src/Platform/Experiment.cc index db8c20a..a8d1842 100644 --- a/src/Platform/Experiment.cc +++ b/src/Platform/Experiment.cc @@ -168,8 +168,8 @@ namespace platform { fold = new StratifiedKFold(nfolds, y, seed); else fold = new KFold(nfolds, y.size(0), seed); + auto clf = Models::instance()->create(model); for (int nfold = 0; nfold < nfolds; nfold++) { - auto clf = Models::instance()->create(model); setModelVersion(clf->getVersion()); if (hyperparameters.size() != 0) { clf->setHyperparameters(hyperparameters); @@ -211,8 +211,8 @@ namespace platform { result.addTimeTrain(train_time[item].item()); result.addTimeTest(test_time[item].item()); item++; - clf.reset(); } + clf.reset(); if (!quiet) std::cout << "end. " << flush; delete fold; diff --git a/src/PyClassifiers/PyWrap.cc b/src/PyClassifiers/PyWrap.cc index 2912749..a50c89e 100644 --- a/src/PyClassifiers/PyWrap.cc +++ b/src/PyClassifiers/PyWrap.cc @@ -5,6 +5,7 @@ #include #include #include +#include namespace pywrap { namespace np = boost::python::numpy; @@ -19,6 +20,7 @@ namespace pywrap { if (wrapper == nullptr) { wrapper = new PyWrap(); pyInstance = new CPyInstance(); + PyRun_SimpleString("import warnings;warnings.filterwarnings('ignore')"); } return wrapper; } @@ -59,6 +61,7 @@ namespace pywrap { void PyWrap::clean(const clfId_t id) { // Remove Python interpreter if no more modules imported left + // std::cout << "*Cleaning module " << id << std::endl; std::lock_guard lock(mutex); auto result = moduleClassMap.find(id); if (result == moduleClassMap.end()) { @@ -72,9 +75,11 @@ namespace pywrap { PyErr_Print(); errorAbort("Error cleaning module "); } - if (moduleClassMap.empty()) { - RemoveInstance(); - } + // if (moduleClassMap.empty()) { + // RemoveInstance(); + // std::cout << "*Python interpreter cleaned" << std::endl; + // } + // std::cout << "*Module " << id << " cleaned" << std::endl; } void PyWrap::errorAbort(const std::string& message) {