3 #ifndef FORPY_LEAFS_REGRESSIONLEAF_H_ 4 #define FORPY_LEAFS_REGRESSIONLEAF_H_ 8 #include "../util/serialization/basics.h" 14 #include "../data_providers/idataprovider.h" 15 #include "../impurities/ientropyfunction.h" 17 #include "../util/checks.h" 51 if (cl_ot ==
nullptr) {
61 const bool &predict_proba,
62 const bool & )
const {
63 DLOG(INFO) <<
"Determining result columns. Summarize: " <<
summarize 64 <<
", predict_proba: " << predict_proba
65 <<
", n_trees: " << n_trees;
67 throw ForpyException(
"This leaf manager has not been initialized yet!");
71 "You called `predict_proba` but didn't enable " 72 "storing the variances. Use `store_variance=True` " 73 "for predictor construction!");
75 VLOG(23) <<
"Result columns: " << 2 *
annot_dim;
78 VLOG(23) <<
"Result columns: " << n_trees * 2 *
annot_dim;
82 VLOG(23) <<
"Result columns: " <<
annot_dim;
87 const bool & )
const {
93 const bool &predict_proba,
const bool &for_forest)
const;
94 inline const std::vector<Mat<float>> *
get_map()
const {
100 const bool &predict_proba =
false)
const;
110 stream <<
"forpy::RegressionLeaf[" <<
self.leaf_regression_map.size()
116 friend class cereal::access;
117 template <
class Archive>
119 ar(cereal::make_nvp(
"base", cereal::base_class<ILeaf>(
this)),
131 #endif // FORPY_LEAFS_REGRESSIONLEAF_H_
Find an optimal threshold.
virtual bool is_compatible_with(const IDataProvider &)
Checks compatibility with a certain IDataProvider.
void transfer_or_run_check(ILeaf *other, IThreshOpt *thresh_opt, IDataProvider *dprov)
Interface implementation.
CEREAL_REGISTER_TYPE(forpy::RegressionLeaf)
A data provider for the training of one tree.
size_t id_t
Element id type.
void serialize(Archive &ar, const uint &)
typename mu::variant< Empty, STOT< float >, STOT< double >, STOT< uint >, STOT< uint8_t > > Data
Storing a variant of the provided data container type.
void get_result(const id_t &node_id, Data< MatRef > &target, const bool &predict_proba, const bool &for_forest) const
Interface implementation.
std::shared_ptr< ILeaf > create_duplicate() const
Interface implementation.
friend std::ostream & operator<<(std::ostream &stream, const RegressionLeaf &self)
Stores the parameters for one marked tree node.
size_t get_result_columns(const size_t &n_trees, const bool &predict_proba, const bool &) const
Interface implementation.
size_t get_annot_vec_dim() const
Get the annotation vector dimension.
void ensure_capacity(const size_t &n)
Interface implementation.
const std::vector< Mat< float > > * get_map() const
Interface implementation.
Stores and returns leaf values, and combines them to forest results.
Manages the leaf nodes of regression trees.
RegressionLeaf(const bool &store_variance=false, const bool &summarize=false)
bool is_compatible_with(const IDataProvider &data_provider)
Interface implementation.
Data< Mat > get_result_type(const bool &, const bool &) const
Interface implementation.
void finalize_capacity(const size_t &n)
Interface implementation.
Eigen::Matrix< DT, Eigen::Dynamic, 1, Eigen::ColMajor > Vec
Eigen::Matrix< DT, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > Mat
Parameterized Matrix type (row major).
bool operator==(const ILeaf &rhs) const
std::vector< Mat< float > > leaf_regression_map
bool is_compatible_with(const IThreshOpt &)
Interface implementation.
unsigned int uint
Convenience typedef for unsigned int.
void make_leaf(const TodoMark &todo_info, const IDataProvider &data_provider, Desk *desk) const
Interface implementation.