forpy 2

Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
forpy::RegressionTree Class Reference

`#include <tree.h>`

Inheritance diagram for forpy::RegressionTree:

## Public Member Functions
| RegressionTree (const std::string &filename)
| RegressionTree (const uint &max_depth=std::numeric_limits< uint >::max(), const uint &min_samples_at_leaf=1, const uint &min_samples_at_node=2, const uint &n_valid_features_to_use=0, const bool &autoscale_valid_features=false, const uint &random_seed=1, const size_t &n_thresholds=0, const float &gain_threshold=1E-7f, const bool &store_variance=false, const bool &summarize=false)
std::unordered_map< std::string, mu::variant< uint, size_t, float, bool > > | get_params (const bool &=false) const
std::shared_ptr< RegressionTree > | set_params (const std::unordered_map< std::string, mu::variant< uint, size_t, float, bool >> &params)
Public Member Functions inherited from forpy::Tree
| Tree (const uint &max_depth=std::numeric_limits< uint >::max(), const uint &min_samples_at_leaf=1, const uint &min_samples_at_node=2, const std::shared_ptr< IDecider > &decider=nullptr, const std::shared_ptr< ILeaf > &leaf_manager=nullptr, const uint &random_seed=1)
| The standard constructor for the forpy trees. More...
| Tree (std::string filename)
| Deserialization constructor for the forpy trees. More...
void | make_node (const IDataProvider *data_provider, Desk *d)
| Handle the creation of one tree node. More...
void | DFS (const IDataProvider *data_provider, const ECompletionLevel &completion, Desk *d)
| Do one DFS step with given completion level. More...
void | parallel_DFS (Desk *d, TodoMark &mark, IDataProvider *data_provider, const bool &finalize=true)
void | DFS_and_store (Desk *d, TodoMark &mark, const IDataProvider *dprov, const ECompletionLevel &comp)
size_t | get_depth () const
Tree * | fit (const Data< MatCRef > &data_v, const Data< MatCRef > &annotation_v, const size_t &n_threads, const bool &complete_dfs=true, const std::vector< float > &weights=std::vector< float >())
| Standard fitting function. More...
Tree * | fit_dprov (std::shared_ptr< IDataProvider > data_provider, const bool &complete_dfs=true)
| The fitting function for a single tree. More...
id_t | predict_leaf (const Data< MatCRef > &data, const id_t &start_node=0, const std::function< void(void *)> &dptf=nullptr) const
| Get the leaf id of the leaf where the given data will arrive. More...
Data< Mat > | predict (const Data< MatCRef > &data_v, const int &num_threads=1, const bool &use_fast_prediction_if_available=true, const bool &predict_proba=false, const bool &for_forest=false)
Data< Mat > | predict_proba (const Data< MatCRef > &data_v, const int &num_threads=1, const bool &use_fast_prediction_if_available=true)
| Overload for consistency with the sklearn interface. More...
Data< Mat > | predict_leaf_result (const Data< MatCRef > &data, const id_t &start_node=0, const std::function< void(void *)> &dptf=nullptr) const
| Get the data prediction result for the given data. More...
Data< Mat > | combine_leaf_results (const std::vector< Data< Mat >> &leaf_results, const Vec< float > &weights=Vec< float >(), const bool &predict_proba=false) const
bool | is_initialized () const
| Whether the trees fit method has been called and its DFS and BFS methods can now be used. More...
float | get_weight () const
| The tree weight. More...
size_t | get_n_nodes () const
| The number of tree nodes. More...
void | set_weight (const float &new_weight)
| Sets the tree weight. More...
size_t | get_input_data_dimensions () const
| The data dimension that is required by this tree. More...
std::shared_ptr< const IDecider > | get_decider () const
| The classifier manager used by this tree. More...
std::shared_ptr< const ILeaf > | get_leaf_manager () const
| The leaf manager used by this tree. More...
size_t | get_samples_stored () const
| The number of samples stored in leafs. More...
const std::vector< std::pair< id_t, id_t > > | get_tree () const
void | enable_fast_prediction ()
void | disable_fast_prediction ()
bool | operator== (Tree const &rhs) const
void | save (const std::string &filename) const
| Save the tree. More...

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

## Private Attributes
std::unordered_map< std::string, mu::variant< uint, size_t, float, bool > > | params

## Friends
class | cereal::access
std::ostream & | operator<< (std::ostream &stream, const RegressionTree &self)

## Detailed Description

Definition at line 426 of file tree.h.

## Constructor & Destructor Documentation

## ◆ RegressionTree() [1/2]

forpy::RegressionTree::RegressionTree | ( | const std::string & | filename | ) |
| inline

Definition at line 428 of file tree.h.

## ◆ RegressionTree() [2/2]

forpy::RegressionTree::RegressionTree | ( | const uint & | max_depth = `std::numeric_limits< uint >::max()`,
|  | const uint & | min_samples_at_leaf = `1`,
|  | const uint & | min_samples_at_node = `2`,
|  | const uint & | n_valid_features_to_use = `0`,
|  | const bool & | autoscale_valid_features = `false`,
|  | const uint & | random_seed = `1`,
|  | const size_t & | n_thresholds = `0`,
|  | const float & | gain_threshold = `1E-7f`,
|  | const bool & | store_variance = `false`,
|  | const bool & | summarize = `false`
| ) |  |

## Member Function Documentation

## ◆ DISALLOW_COPY_AND_ASSIGN()

forpy::RegressionTree::DISALLOW_COPY_AND_ASSIGN | ( | RegressionTree |  | ) |
| private

## ◆ get_params()

std::unordered_map<std::string, mu::variant<uint, size_t, float, bool> > forpy::RegressionTree::get_params | ( | const bool & | = `false` | ) | const
| inline

Definition at line 440 of file tree.h.

## ◆ serialize()

template<class Archive >

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

Definition at line 472 of file tree.h.

## ◆ set_params()

std::shared_ptr<RegressionTree> forpy::RegressionTree::set_params | ( | const std::unordered_map< std::string, mu::variant< uint, size_t, float, bool >> & | params | ) |
| inline

Definition at line 444 of file tree.h.

## Friends And Related Function Documentation

## ◆ cereal::access

friend class cereal::access
| friend

Definition at line 470 of file tree.h.

## ◆ operator<<

std::ostream& operator<< | ( | std::ostream & | stream,
|  | const RegressionTree & | self
| ) |  |
| friend

Definition at line 461 of file tree.h.

## Member Data Documentation

## ◆ params

std::unordered_map<std::string, mu::variant<uint, size_t, float, bool> > forpy::RegressionTree::params
| private

Definition at line 465 of file tree.h.

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

- /Users/classner/git/forpy/include/forpy/tree.h