10#include <tracking/trackFindingCDC/varsets/NamedFloatTuple.h>
11#include <boost/python/object.hpp>
18 namespace TrackFindingCDC {
20 class NamedFloatTuple;
28 explicit PyEstimator(
const std::string& pickleFileName);
31 double predict(
const std::vector<double>& inputVariables);
34 double predict(
const std::vector<NamedFloatTuple*>& floatTuples);
37 double predict(boost::python::object& array);
Class to invoke a pretrained python estimator that follows the sklearn interface.
void expand(size_t nVars)
Reserves space for at least n variable in the input array.
void unpickleEstimator(const std::string &pickleFileName)
Load the estimator object from the pickled file.
std::string m_pickleFileName
File name of the pickle file that contains the trained estimator.
double predict(const std::vector< double > &inputVariables)
Call the predict method of the estimator.
boost::python::object m_estimator
Retrained python estimator object.
boost::python::object m_predict
Python bound prediction method - cached to avoid repeated lookup.
size_t m_nCurrent
Cache for the current length of the input array.
bool m_is_binary_classification
Internal flag to keep track whether a binary classification with predict_proba is evaluated.
boost::python::object m_array
Array to be served to the estimator.
Abstract base class for different kinds of events.