#include "SharedPtr.h"
#include <boost/python.hpp>
+#include <vector>
namespace suanzi {
class PredictorWrapper
{
public:
- static PredictorWrapperPtr create(const std::string& fname);
+ PredictorWrapper(const std::string& module="predictor", const std::string& pydir = "./python");
~PredictorWrapper(){}
- void dump() { this->dump_func(); }
- void predict() { this->predict_func();}
+ void dump();
+ double predict(int index, const std::vector<double>& f);
+ bool load(const std::string& fname); // load pkl file
private:
- PredictorWrapper(const std::string& fname);
- static PredictorWrapperWPtr instance;
-
- PY_FUN dump_func;
- PY_FUN predict_func;
-
+ boost::python::object m_module;
};
}