pybdt C++ API Reference¶
-
class BDTLearner : public Learner¶
- #include <bdtlearner.hpp>
Public Functions
-
explicit BDTLearner(const std::vector<std::string> &feature_names, const std::string &weight_name = "")¶
-
BDTLearner(const std::vector<std::string> &feature_names, const std::string &sig_weight_name, const std::string &bg_weight_name)¶
-
BDTLearner(const boost::python::list &feature_names, const std::string &sig_weight_name, const std::string &bg_weight_name)¶
-
virtual ~BDTLearner()¶
-
double beta() const¶
-
double frac_random_events() const¶
-
int num_trees() const¶
-
bool use_purity() const¶
-
bool quiet() const¶
-
boost::python::list after_pruners() const¶
-
boost::python::list before_pruners() const¶
-
void beta(double beta)¶
-
void frac_random_events(double n)¶
-
void num_trees(int n)¶
-
void use_purity(bool purity)¶
-
void quiet(bool val)¶
-
void clear_after_pruners()¶
-
void clear_before_pruners()¶
-
void set_defaults()¶
Protected Attributes
-
double m_beta¶
-
double m_frac_random_events¶
-
int m_num_trees¶
-
bool m_use_purity¶
-
bool m_quiet¶
Friends
- friend class BDTLearner_pickle_suite
-
explicit BDTLearner(const std::vector<std::string> &feature_names, const std::string &weight_name = "")¶
-
class BDTModel : public Model¶
- #include <bdtmodel.hpp>
Public Functions
-
virtual ~BDTModel()¶
-
BDTModel(const boost::python::list &feature_names, const boost::python::list &dtmodels, const boost::python::list &alphas)¶
-
double get_alpha(int n) const¶
-
int n_dtmodels() const¶
-
std::vector<double> event_variable_importance(const Scoreable &s, bool sep_weighted, bool tree_weighted) const¶
-
boost::python::dict event_variable_importance_py(const boost::python::list &vals, bool sep_weighted, bool tree_weighted) const¶
-
boost::python::dict variable_importance_py(bool sep_weighted, bool tree_weighted) const¶
Friends
- friend struct BDTModel_pickle_suite
-
virtual ~BDTModel()¶
-
struct BDTModel_pickle_suite : public pickle_suite¶
- #include <bdtmodel.hpp>
-
class CostComplexityPruner : public Pruner¶
- #include <pruner.hpp>
Public Functions
-
explicit CostComplexityPruner(double strength)¶
-
virtual ~CostComplexityPruner()¶
-
double strength() const¶
-
void strength(double s)¶
Public Static Functions
Private Members
-
double m_strength¶
-
explicit CostComplexityPruner(double strength)¶
-
class DataSet¶
- #include <dataset.hpp>
Public Functions
-
inline double livetime() const¶
-
boost::python::list names_py() const¶
-
inline int n_features() const¶
-
inline int n_events() const¶
-
boost::python::dict to_dict() const¶
-
inline void livetime(const double t)¶
Friends
- friend class Event
-
inline double livetime() const¶
-
class DTLearner : public Learner¶
- #include <dtlearner.hpp>
Public Functions
-
explicit DTLearner(const std::vector<std::string> &feature_names, const std::string &weight_name = "")¶
-
DTLearner(const std::vector<std::string> &feature_names, const std::string &sig_weight_name, const std::string &bg_weight_name)¶
-
virtual ~DTLearner()¶
-
DTLearner(const boost::python::list &feature_names, const std::string &sig_weight_name, const std::string &bg_weight_name)¶
-
bool linear_cuts() const¶
-
int max_depth() const¶
-
int min_split() const¶
-
int num_cuts() const¶
-
int num_random_variables() const¶
-
void max_depth(int n)¶
-
void min_split(int n)¶
-
void num_cuts(int n)¶
-
void linear_cuts(bool value)¶
-
void num_random_variables(int n)¶
-
void set_defaults()¶
Protected Functions
Protected Attributes
-
int m_min_split¶
-
int m_max_depth¶
-
int m_num_cuts¶
-
bool m_linear_cuts¶
-
int m_num_random_variables¶
-
mutable RandomSampler m_random_sampler¶
Protected Static Functions
Friends
- friend class BDTLearner
- friend class BDTLearner_pickle_suite
-
explicit DTLearner(const std::vector<std::string> &feature_names, const std::string &weight_name = "")¶
-
class DTModel : public Model¶
- #include <dtmodel.hpp>
Public Functions
-
virtual ~DTModel()¶
-
boost::python::dict event_variable_importance_py(const boost::python::list &vals, bool sep_weighted) const¶
-
boost::python::dict variable_importance_py(bool sep_weighted) const¶
Friends
- friend struct DTModel_pickle_suite
-
virtual ~DTModel()¶
-
struct DTModel_pickle_suite : public pickle_suite¶
- #include <dtmodel.hpp>
-
class DTNode : public boost::enable_shared_from_this<DTNode>¶
- #include <dtmodel.hpp>
Public Functions
-
DTNode(double sep_index, double w_sig, double w_bg, int n_sig, int n_bg)¶
-
virtual ~DTNode()¶
-
inline int feature_id() const¶
-
inline double feature_val() const¶
-
inline bool is_leaf() const¶
-
int max_depth() const¶
-
inline double n_bg() const¶
-
int n_leaves() const¶
-
int n_total() const¶
-
inline double n_sig() const¶
-
inline double purity() const¶
-
inline double sep_index() const¶
-
inline double sep_gain() const¶
-
int tree_size() const¶
-
inline double w_bg() const¶
-
inline double w_sig() const¶
-
double w_total() const¶
-
void prune()¶
Protected Functions
-
void calc_aux()¶
Protected Attributes
-
double m_sep_gain¶
-
double m_sep_index¶
-
int m_feature_id¶
-
double m_feature_val¶
-
double m_w_sig¶
-
double m_w_bg¶
-
int m_n_sig¶
-
int m_n_bg¶
-
double m_purity¶
Friends
- friend struct DTNode_pickle_suite
-
DTNode(double sep_index, double w_sig, double w_bg, int n_sig, int n_bg)¶
-
struct DTNode_pickle_suite : public pickle_suite¶
- #include <dtmodel.hpp>
-
class ErrorPruner : public Pruner¶
- #include <pruner.hpp>
Public Functions
-
explicit ErrorPruner(double factor)¶
-
virtual ~ErrorPruner()¶
-
double strength() const¶
-
void strength(double s)¶
Private Functions
Private Members
-
double m_strength¶
-
explicit ErrorPruner(double factor)¶
-
class Event¶
- #include <dataset.hpp>
Public Functions
-
inline bool all_finite() const¶
-
inline bool all_finite() const¶
-
class Histogram¶
- #include <histogram.hpp>
Subclassed by LinearHistogram, NonlinearHistogram
-
class Learner¶
- #include <learner.hpp>
Subclassed by BDTLearner, DTLearner, VineLearner
Public Functions
-
explicit Learner(const std::vector<std::string> &feature_names, const std::string &weight_name = "")¶
-
Learner(const std::vector<std::string> &feature_names, const std::string &sig_weight_name, const std::string &bg_weight_name)¶
-
virtual ~Learner()¶
-
Learner(const boost::python::list &feature_names, const std::string &sig_weight_name, const std::string &bg_weight_name)¶
Protected Attributes
Private Functions
-
void init()¶
-
explicit Learner(const std::vector<std::string> &feature_names, const std::string &weight_name = "")¶
-
class LinearHistogram : public Histogram¶
- #include <linear_histogram.hpp>
Public Functions
-
LinearHistogram(double min_val, double max_val, int n_bins)¶
-
~LinearHistogram()¶
-
virtual double count(int i) const¶
-
virtual double min_val() const¶
-
virtual double max_val() const¶
-
virtual int n_bins() const¶
-
void fill(double value, double weight = 1.0)¶
-
virtual int index_for_value(double value) const¶
-
virtual double value_for_index(int i) const¶
-
LinearHistogram(double min_val, double max_val, int n_bins)¶
-
class Model
- #include <model.hpp>
Subclassed by BDTModel, DTModel, VineModel
Public Functions
-
Model(boost::python::list feature_names)¶
-
virtual ~Model()¶
-
boost::python::list feature_names_py() const¶
-
std::vector<double> score(const std::vector<Event> &events, bool use_purity = false, bool quiet = false)¶
-
double score_one(const boost::python::list &vals, bool use_purity)¶
Protected Static Attributes
-
static double m_EPS = numeric_limits<double>::epsilon()¶
Friends
- friend struct DTModel_pickle_suite
- friend struct BDTModel_pickle_suite
-
Model(boost::python::list feature_names)¶
-
class NonlinearHistogram : public Histogram¶
- #include <nonlinear_histogram.hpp>
Public Functions
-
NonlinearHistogram(const int n, const std::vector<double> values, const std::vector<double> weights, bool presorted = false)¶
-
~NonlinearHistogram()¶
-
virtual double count(int i) const¶
-
virtual double min_val() const¶
-
virtual double max_val() const¶
-
virtual int n_bins() const¶
-
void fill_presorted(const std::vector<double> &sorted_values, const std::vector<double> &sorted_weights)¶
-
virtual int index_for_value(double value) const¶
-
virtual double value_for_index(int i) const¶
Public Static Functions
-
static std::vector<std::pair<double, double>> get_sorted_values_weights(const std::vector<double> values, const std::vector<double> weights)¶
Private Types
-
NonlinearHistogram(const int n, const std::vector<double> values, const std::vector<double> weights, bool presorted = false)¶
-
template<typename T>
class Notifier¶ - #include <notifier.hpp>
-
class Pruner¶
- #include <pruner.hpp>
Subclassed by CostComplexityPruner, ErrorPruner, SameLeafPruner
-
class RandomSampler¶
- #include <random_sampler.hpp>
Public Functions
-
RandomSampler(int seed = 0)¶
Private Members
-
gsl_rng *m_rng¶
-
RandomSampler(int seed = 0)¶
-
class SameLeafPruner : public Pruner¶
- #include <pruner.hpp>
Private Functions
-
class Scoreable¶
- #include <model.hpp>
Subclassed by RealScoreable< EventType >
-
struct SepCrossEntropy : public SepFunc¶
- #include <dtlearner.hpp>
-
struct SepFunc¶
- #include <dtlearner.hpp>
Subclassed by SepCrossEntropy, SepGini, SepMisclassError
-
struct SepGini : public SepFunc¶
- #include <dtlearner.hpp>
-
struct SepMisclassError : public SepFunc¶
- #include <dtlearner.hpp>
-
class VineLearner : public Learner¶
- #include <vinelearner.hpp>
Public Functions
-
virtual ~VineLearner()¶
-
bool quiet() const¶
-
double vine_feature_min() const¶
-
double vine_feature_max() const¶
-
double vine_feature_width() const¶
-
double vine_feature_step() const¶
-
void quiet(bool val)¶
-
void vine_feature_min(const double vine_feature_min)¶
-
void vine_feature_max(const double vine_feature_max)¶
-
void vine_feature_width(const double vine_feature_width)¶
-
void vine_feature_step(const double vine_feature_step)¶
Protected Attributes
-
double m_vine_feature_min¶
-
double m_vine_feature_max¶
-
double m_vine_feature_width¶
-
double m_vine_feature_step¶
-
size_t m_vine_feature_i¶
-
bool m_quiet¶
Friends
- friend class VineLearner_pickle_suite
-
virtual ~VineLearner()¶
-
class VineModel : public Model¶
- #include <vinemodel.hpp>
Public Functions
-
virtual ~VineModel()¶
-
VineModel(const boost::python::list &feature_names, const std::string &vine_feature, const boost::python::list &bin_mins, const boost::python::list &bin_maxs, const boost::python::list &models)¶
-
boost::python::dict variable_importance_py(bool sep_weighted) const¶
Protected Attributes
-
size_t m_vine_feature_i¶
Friends
- friend struct VineModel_pickle_suite
-
virtual ~VineModel()¶
-
struct VineModel_pickle_suite : public pickle_suite¶
- #include <vinemodel.hpp>
-
namespace np¶
Functions
-
template<typename func, typename T>
vector<typename func::result_type> operate(const vector<T> &a, const vector<T> &b)¶
-
template<typename func, typename T, typename T2>
vector<typename func::result_type> operate(const vector<T> &a, const T2 &b)¶
-
template<typename func, typename T>
-
namespace std
STL namespace.
- file bdtlearner.cpp
- #include <Python.h>#include “bdtlearner.hpp”#include “np.hpp”#include “notifier.hpp”#include <iostream>#include <limits>#include <boost/make_shared.hpp>#include <boost/pointer_cast.hpp>
Functions
-
void export_bdtlearner()¶
-
void export_bdtlearner()¶
- file bdtlearner.hpp
- #include <string>#include <vector>#include <boost/shared_ptr.hpp>#include <boost/tuple/tuple.hpp>#include “boost_python.hpp”#include “bdtmodel.hpp”#include “dataset.hpp”#include “dtlearner.hpp”#include “learner.hpp”#include “pruner.hpp”
Functions
-
void export_bdtlearner()
-
void export_bdtlearner()
- file bdtmodel.cpp
- #include <Python.h>#include “bdtmodel.hpp”#include “np.hpp”#include <cmath>#include <boost/make_shared.hpp>
Functions
-
void export_bdtmodel()¶
-
void export_bdtmodel()¶
- file bdtmodel.hpp
- #include <string>#include <vector>#include <boost/shared_ptr.hpp>#include <boost/tuple/tuple.hpp>#include “boost_python.hpp”#include “dtmodel.hpp”#include “model.hpp”
Functions
-
void export_bdtmodel()
-
void export_bdtmodel()
- file boost_python.hpp
- #include <boost/python.hpp>
- file dataset.cpp
- #include “dataset.hpp”#include “np.hpp”#include <cmath>#include <boost/make_shared.hpp>#include <numpy/ndarrayobject.h>
Functions
-
void export_dataset()¶
-
void export_dataset()¶
- file dataset.hpp
- #include <cmath>#include <iostream>#include <vector>#include <string>#include “boost_python.hpp”
Functions
-
void export_dataset()
-
void export_dataset()
- file dtlearner.cpp
- #include <Python.h>#include <boost/shared_ptr.hpp>#include <boost/make_shared.hpp>#include “dtlearner.hpp”#include “linear_histogram.hpp”#include “nonlinear_histogram.hpp”#include “np.hpp”#include <limits>#include <map>
Functions
-
void export_dtlearner()¶
-
void export_dtlearner()¶
- file dtlearner.hpp
- #include <string>#include <vector>#include <boost/make_shared.hpp>#include <boost/shared_ptr.hpp>#include <boost/tuple/tuple.hpp>#include “boost_python.hpp”#include “dataset.hpp”#include “dtmodel.hpp”#include “learner.hpp”#include “random_sampler.hpp”
Functions
-
void export_dtlearner()
-
void export_dtlearner()
- file dtmodel.cpp
- #include <Python.h>#include “dtmodel.hpp”#include “np.hpp”#include <algorithm>#include <iostream>#include <limits>#include <numeric>#include <queue>#include <boost/make_shared.hpp>#include <boost/math/special_functions/fpclassify.hpp>
Functions
-
void export_dtmodel()¶
-
void export_dtmodel()¶
- file dtmodel.hpp
- #include <string>#include <vector>#include “boost_python.hpp”#include <boost/enable_shared_from_this.hpp>#include <boost/shared_ptr.hpp>#include “model.hpp”
Functions
-
void export_dtmodel()
-
void export_dtmodel()
- file histogram.cpp
- #include “linear_histogram.hpp”#include <vector>#include “np.hpp”
- file histogram.hpp
- #include <cmath>#include <vector>
- file learner.cpp
- #include <Python.h>#include “learner.hpp”#include “np.hpp”#include <algorithm>
Functions
-
void export_learner()¶
-
void export_learner()¶
- file learner.hpp
- #include <vector>#include <string>#include “boost_python.hpp”#include “dataset.hpp”#include “model.hpp”
Functions
-
void export_learner()
-
void export_learner()
- file linear_histogram.cpp
- #include “linear_histogram.hpp”#include “np.hpp”
- file linear_histogram.hpp
- #include <cmath>#include <vector>#include “histogram.hpp”
- file model.cpp
- #include <Python.h>#include “model.hpp”#include <cmath>#include <limits>#include <boost/shared_ptr.hpp>#include <boost/make_shared.hpp>#include “np.hpp”#include “notifier.hpp”
Functions
-
void export_model()¶
-
void export_model()¶
- file model.hpp
- #include <cstdlib>#include <string>#include <vector>#include <boost/shared_ptr.hpp>#include “boost_python.hpp”#include “dataset.hpp”
Functions
-
void export_model()
-
template<typename EventType>
RealScoreable<EventType> make_scoreable(const EventType &event)¶
-
void export_model()
- file nonlinear_histogram.cpp
- #include “nonlinear_histogram.hpp”#include <iostream>#include “np.hpp”
- file nonlinear_histogram.hpp
- #include <algorithm>#include <cassert>#include <cmath>#include <ostream>#include <vector>#include <utility>#include “histogram.hpp”
- file notifier.hpp
- #include <iomanip>#include <iostream>#include <sstream>
- file np.hpp
- #include <cstdlib>#include <algorithm>#include <fstream>#include <iomanip>#include <iostream>#include <numeric>#include <queue>#include <sstream>#include <string>#include <vector>#include “boost_python.hpp”#include <numpy/ndarrayobject.h>
- file pruner.cpp
- #include <Python.h>#include “pruner.hpp”#include <map>#include <numeric>#include <queue>
Functions
-
void export_pruners()¶
-
void export_pruners()¶
- file pruner.hpp
- #include <boost/shared_ptr.hpp>#include “dtmodel.hpp”
Functions
-
void export_pruners()
-
void export_pruners()
- file pybdt.cpp
- #include <cstdlib>#include <algorithm>#include <fstream>#include <iomanip>#include <iostream>#include <numeric>#include <queue>#include <sstream>#include <string>#include <vector>#include <boost/assign/list_of.hpp>#include <boost/assign/std/vector.hpp>#include <boost/shared_ptr.hpp>#include <boost/make_shared.hpp>#include <boost/tuple/tuple.hpp>#include “boost_python.hpp”#include <numpy/ndarrayobject.h>#include “np.hpp”#include “dataset.hpp”#include “model.hpp”#include “learner.hpp”#include “dtmodel.hpp”#include “dtlearner.hpp”#include “bdtmodel.hpp”#include “bdtlearner.hpp”#include “vinemodel.hpp”#include “vinelearner.hpp”
Defines
-
NPY_NO_DEPRECATED_API
-
PY_ARRAY_UNIQUE_SYMBOL
Functions
-
static PyObject *hack_import_array()¶
-
NPY_NO_DEPRECATED_API
- file random_sampler.cpp
- #include “random_sampler.hpp”
- file random_sampler.hpp
- #include <set>#include <vector>#include <gsl/gsl_randist.h>#include <gsl/gsl_rng.h>#include “np.hpp”
- file vinelearner.cpp
- #include <Python.h>#include <stdexcept>#include “vinelearner.hpp”#include “np.hpp”#include “notifier.hpp”#include <boost/shared_ptr.hpp>#include <boost/make_shared.hpp>#include <boost/pointer_cast.hpp>#include “vinemodel.hpp”
Functions
-
void export_vinelearner()¶
-
void export_vinelearner()¶
- file vinelearner.hpp
- #include <string>#include <vector>#include <boost/shared_ptr.hpp>#include <boost/tuple/tuple.hpp>#include “boost_python.hpp”#include “dataset.hpp”#include “learner.hpp”
Functions
-
void export_vinelearner()
-
void export_vinelearner()
- file vinemodel.cpp
- #include <Python.h>#include “vinemodel.hpp”#include “np.hpp”#include <iostream>#include <limits>#include <boost/math/special_functions/fpclassify.hpp>
Functions
-
void export_vinemodel()¶
-
void export_vinemodel()¶
- file vinemodel.hpp
- #include <string>#include <vector>#include <utility>#include “boost_python.hpp”#include <boost/enable_shared_from_this.hpp>#include <boost/shared_ptr.hpp>#include “model.hpp”
Functions
-
void export_vinemodel()
-
void export_vinemodel()
- dir icetray
- dir private
- dir pybdt
- dir pybdt