Disable Warning messages in python clfs
Disable removing Python env
This commit is contained in:
@@ -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<double>());
|
||||
result.addTimeTest(test_time[item].item<double>());
|
||||
item++;
|
||||
clf.reset();
|
||||
}
|
||||
clf.reset();
|
||||
if (!quiet)
|
||||
std::cout << "end. " << flush;
|
||||
delete fold;
|
||||
|
@@ -5,6 +5,7 @@
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
#include <boost/python/numpy.hpp>
|
||||
#include <iostream>
|
||||
|
||||
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<std::mutex> 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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user