3 #ifndef FORPY_LEAFS_ILEAF_H_ 4 #define FORPY_LEAFS_ILEAF_H_ 8 #include "../util/serialization/basics.h" 12 #include "../data_providers/idataprovider.h" 13 #include "../threshold_optimizers/ithreshopt.h" 53 const bool &predict_proba =
false,
54 const bool &for_forest =
false) const
59 const
bool &for_forest = false) const
69 const
bool &predict_proba = false,
70 const
bool &for_forest = false)
const {
74 [&](
const auto &res_mt) {
75 typedef typename get_core<decltype(res_mt.data()[0])>::type RT;
79 this->
get_result(node_id, dref, predict_proba, for_forest);
89 const bool &predict_proba,
99 const std::vector<
Data<Mat>> &leaf_results,
101 const bool &predict_proba =
false)
const {
103 leaf_results[0].match(
104 [&](
const auto &lr0) {
105 typedef typename get_core<decltype(lr0.data())>::type RT;
110 this->
get_result(leaf_results, dref, weights, predict_proba);
131 virtual
bool operator==(const
ILeaf &rhs) const
VIRTUAL(
bool);
138 friend class cereal::access;
139 template <
class Archive>
145 #endif // FORPY_LEAFS_ILEAF_H_ Find an optimal threshold.
virtual bool is_compatible_with(const IDataProvider &)
Checks compatibility with a certain IDataProvider.
virtual void make_leaf(const TodoMark &todo_info, const IDataProvider &data_provider, Desk *desk) const VIRTUAL_VOID
Creates a leaf with the specified node_id and data.
A data provider for the training of one tree.
size_t id_t
Element id type.
DISALLOW_COPY_AND_ASSIGN(ILeaf)
typename mu::variant< Empty, STOT< float >, STOT< double >, STOT< uint >, STOT< uint8_t > > Data
Storing a variant of the provided data container type.
virtual void transfer_or_run_check(ILeaf *other, IThreshOpt *thresh_opt, IDataProvider *dprov) VIRTUAL_VOID
Stores the parameters for one marked tree node.
virtual void finalize_capacity(const size_t &n) VIRTUAL_VOID
Cut down capacity to exactly n leafs.
virtual Data< Mat > get_result_type(const bool &predict_proba, const bool &for_forest=false) const VIRTUAL(Data< Mat >)
virtual Data< Mat > get_result(const std::vector< Data< Mat >> &leaf_results, const Vec< float > &weights=Vec< float >(), const bool &predict_proba=false) const
Combine leaf results of several trees with weights.
Eigen::Ref< Mat< DT > > MatRef
Parameterized standard non-const matrix ref type.
virtual const std::vector< Mat< float > > * get_map() const =0
Get all leafs.
Stores and returns leaf values, and combines them to forest results.
A struct to represent an empty variant.
virtual void ensure_capacity(const size_t &n) VIRTUAL_VOID
Ensure that storage is available for at least n leafs.
virtual Data< Mat > get_result(const id_t &node_id, const bool &predict_proba=false, const bool &for_forest=false) const
Get the leaf data for the leaf with the given id.
Eigen::Matrix< DT, Eigen::Dynamic, 1, Eigen::ColMajor > Vec
Eigen::Matrix< DT, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > Mat
Parameterized Matrix type (row major).
Get the core datatype with removed pointer, reference and const modifiers.
virtual size_t get_result_columns(const size_t &n_trees=1, const bool &predict_proba=false, const bool &for_forest=false) const VIRTUAL(size_t)
virtual std::shared_ptr< ILeaf > create_duplicate() const VIRTUAL_PTR
unsigned int uint
Convenience typedef for unsigned int.
void serialize(Archive &, const uint &)