forpy 2

Public Member Functions | Protected Member Functions | Private Member Functions | Friends | List of all members
forpy::ILeaf Class Referenceabstract
Leafs

Stores and returns leaf values, and combines them to forest results. More...

`#include <ileaf.h>`

Inheritance diagram for forpy::ILeaf:

## Public Member Functions
virtual | ~ILeaf ()
virtual std::shared_ptr< ILeaf > | create_duplicate () const VIRTUAL_PTR
virtual bool | is_compatible_with (const IDataProvider &)
| Checks compatibility with a certain IDataProvider. More...
virtual bool | is_compatible_with (const IThreshOpt &threshopt) VIRTUAL(bool)
virtual void | transfer_or_run_check (ILeaf *other, IThreshOpt *thresh_opt, IDataProvider *dprov) VIRTUAL_VOID
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. More...
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 Data< Mat > | get_result_type (const bool &predict_proba, const bool &for_forest=false) const VIRTUAL(Data< Mat >)
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. More...
virtual void | get_result (const id_t &node_id, Data< MatRef > &target, const bool &predict_proba, const bool &for_forest) const VIRTUAL_VOID
| Get the leaf data for the leaf with the given id. More...
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. More...
virtual void | get_result (const std::vector< Data< Mat >> &leaf_results, Data< MatRef > &target_v, const Vec< float > &weights=Vec< float >(), const bool &predict_proba=false) const VIRTUAL_VOID
| Get the fused forest result. More...
virtual void | ensure_capacity (const size_t &n) VIRTUAL_VOID
| Ensure that storage is available for at least n leafs. More...
virtual void | finalize_capacity (const size_t &n) VIRTUAL_VOID
| Cut down capacity to exactly n leafs. More...
virtual const std::vector< Mat< float > > * | get_map () const =0
| Get all leafs. More...
virtual bool | operator== (const ILeaf &rhs) const VIRTUAL(bool)

## Protected Member Functions
| ILeaf ()

## Private Member Functions
template<class Archive >
void | serialize (Archive &, const uint &)
| DISALLOW_COPY_AND_ASSIGN (ILeaf)

## Friends
class | cereal::access

## Detailed Description

Stores and returns leaf values, and combines them to forest results.

Definition at line 23 of file ileaf.h.

## Constructor & Destructor Documentation

## ◆ ~ILeaf()

virtual forpy::ILeaf::~ILeaf | ( |  | ) |
| inline virtual

Definition at line 25 of file ileaf.h.

## ◆ ILeaf()

forpy::ILeaf::ILeaf | ( |  | ) |
| inline protected

For deserialization.

Definition at line 135 of file ileaf.h.

## Member Function Documentation

## ◆ create_duplicate()

virtual std::shared_ptr<ILeaf> forpy::ILeaf::create_duplicate | ( |  | ) | const
| virtual

Create a similar, but empty, leaf.

Reimplemented in forpy::ClassificationLeaf, and forpy::RegressionLeaf.

## ◆ DISALLOW_COPY_AND_ASSIGN()

forpy::ILeaf::DISALLOW_COPY_AND_ASSIGN | ( | ILeaf |  | ) |
| private

## ◆ ensure_capacity()

virtual void forpy::ILeaf::ensure_capacity | ( | const size_t & | n | ) |
| virtual

Ensure that storage is available for at least n leafs.

Reimplemented in forpy::RegressionLeaf, and forpy::ClassificationLeaf.

## ◆ finalize_capacity()

virtual void forpy::ILeaf::finalize_capacity | ( | const size_t & | n | ) |
| virtual

Cut down capacity to exactly n leafs.

Reimplemented in forpy::RegressionLeaf, and forpy::ClassificationLeaf.

## ◆ get_map()

virtual const std::vector<Mat<float> >* forpy::ILeaf::get_map | ( |  | ) | const
| pure virtual

Get all leafs.

Implemented in forpy::RegressionLeaf, and forpy::ClassificationLeaf.

## ◆ get_result() [1/4]

virtual Data<Mat> forpy::ILeaf::get_result | ( | const id_t & | node_id,
|  | const bool & | predict_proba = `false`,
|  | const bool & | for_forest = `false`
| ) |  | const
| inline virtual

Get the leaf data for the leaf with the given id.

This function allocates space for storing the result. If the memory is already prepared, use other overloads.

Definition at line 68 of file ileaf.h.

## ◆ get_result() [2/4]

virtual void forpy::ILeaf::get_result | ( | const id_t & | node_id,
|  | Data< MatRef > & | target,
|  | const bool & | predict_proba,
|  | const bool & | for_forest
| ) |  | const
| virtual

Get the leaf data for the leaf with the given id.

Reimplemented in forpy::RegressionLeaf, and forpy::ClassificationLeaf.

## ◆ get_result() [3/4]

virtual Data<Mat> forpy::ILeaf::get_result | ( | const std::vector< Data< Mat >> & | leaf_results,
|  | const Vec< float > & | weights = `Vec<float>()`,
|  | const bool & | predict_proba = `false`
| ) |  | const
| inline virtual

Combine leaf results of several trees with weights.

This function allocates space for the result. If the memory is already allocated, use another overload of this function.

Definition at line 98 of file ileaf.h.

## ◆ get_result() [4/4]

virtual void forpy::ILeaf::get_result | ( | const std::vector< Data< Mat >> & | leaf_results,
|  | Data< MatRef > & | target_v,
|  | const Vec< float > & | weights = `Vec< float >()`,
|  | const bool & | predict_proba = `false`
| ) |  | const
| virtual

Get the fused forest result.

Reimplemented in forpy::RegressionLeaf, and forpy::ClassificationLeaf.

## ◆ get_result_columns()

virtual size_t forpy::ILeaf::get_result_columns | ( | const size_t & | n_trees = `1`,
|  | const bool & | predict_proba = `false`,
|  | const bool & | for_forest = `false`
| ) |  | const
| virtual

Get the number of summary dimensions per sample.

Reimplemented in forpy::ClassificationLeaf, and forpy::RegressionLeaf.

## ◆ get_result_type()

virtual Data<Mat> forpy::ILeaf::get_result_type | ( | const bool & | predict_proba,
|  | const bool & | for_forest = `false`
| ) |  | const
| virtual

Get the result data type (a 0x0 mat within in appropriate variant).

Reimplemented in forpy::RegressionLeaf, and forpy::ClassificationLeaf.

## ◆ is_compatible_with() [1/2]

virtual bool forpy::ILeaf::is_compatible_with | ( | const IDataProvider & |  | ) |
| inline virtual

Checks compatibility with a certain IDataProvider.

This method is guaranteed to be called at the beginning of a training.

Reimplemented in forpy::ClassificationLeaf, and forpy::RegressionLeaf.

Definition at line 34 of file ileaf.h.

## ◆ is_compatible_with() [2/2]

virtual bool forpy::ILeaf::is_compatible_with | ( | const IThreshOpt & | threshopt | ) |
| virtual

Reimplemented in forpy::ClassificationLeaf, and forpy::RegressionLeaf.

## ◆ make_leaf()

virtual void forpy::ILeaf::make_leaf | ( | const TodoMark & | todo_info,
|  | const IDataProvider & | data_provider,
|  | Desk * | desk
| ) |  | const
| virtual

Creates a leaf with the specified node_id and data.

Reimplemented in forpy::ClassificationLeaf, and forpy::RegressionLeaf.

## ◆ operator==()

virtual bool forpy::ILeaf::operator== | ( | const ILeaf & | rhs | ) | const
| virtual

Reimplemented in forpy::RegressionLeaf, and forpy::ClassificationLeaf.

## ◆ serialize()

template<class Archive >

void forpy::ILeaf::serialize | ( | Archive & | ,
|  | const uint & |
| ) |  |
| inline private

Definition at line 140 of file ileaf.h.

## ◆ transfer_or_run_check()

virtual void forpy::ILeaf::transfer_or_run_check | ( | ILeaf * | other,
|  | IThreshOpt * | thresh_opt,
|  | IDataProvider * | dprov
| ) |  |
| virtual

Reimplemented in forpy::RegressionLeaf, and forpy::ClassificationLeaf.

## Friends And Related Function Documentation

## ◆ cereal::access

friend class cereal::access
| friend

Definition at line 135 of file ileaf.h.

The documentation for this class was generated from the following file:

- /Users/classner/git/forpy/include/forpy/leafs/ileaf.h