forpy 2

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

Stores the probability distributions for n_classes at a leaf. More...

`#include <classificationleaf.h>`

Inheritance diagram for forpy::ClassificationLeaf:

## Public Member Functions
| ClassificationLeaf (const uint &n_classes=0)
bool | operator== (const ILeaf &rhs) const
const std::vector< Vec< float > > & | get_stored_dists () const
const std::vector< Mat< float > > * | get_map () const
| Get all leafs. More...
std::shared_ptr< ILeaf > | create_duplicate () const
| Interface implementation. More...
bool | is_compatible_with (const IDataProvider &)
| Interface implementation. More...
bool | is_compatible_with (const IThreshOpt &threshopt)
| Interface implementation. More...
void | transfer_or_run_check (ILeaf *other, IThreshOpt *thresh_opt, IDataProvider *dprov)
| Interface implementation. More...
void | make_leaf (const TodoMark &todo_info, const IDataProvider &data_provider, Desk *desk) const
| Interface implementation. More...
size_t | get_result_columns (const size_t &n_trees=1, const bool &predict_proba=false, const bool &for_forest=false) const
| Interface implementation. More...
Data< Mat > | get_result_type (const bool &predict_proba, const bool &for_forest=false) const
| Interface implementation. More...
void | get_result (const id_t &node_id, Data< MatRef > &target_v, const bool &predict_proba, const bool &for_forest) const
| Interface implementation. More...
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
| Interface implementation. More...
void | ensure_capacity (const size_t &n)
| Interface implementation. More...
void | finalize_capacity (const size_t &n)
| Interface implementation. More...
Public Member Functions inherited from forpy::ILeaf
virtual | ~ILeaf ()
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 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...

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

## Private Attributes
uint | n_classes
std::shared_ptr< std::vector< uint > > | class_transl_ptr
uint | true_max_class
std::vector< Vec< float > > | stored_distributions

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

## Additional Inherited Members
Protected Member Functions inherited from forpy::ILeaf
| ILeaf ()

## Detailed Description

Stores the probability distributions for n_classes at a leaf.

Definition at line 26 of file classificationleaf.h.

## Constructor & Destructor Documentation

## ◆ ClassificationLeaf()

forpy::ClassificationLeaf::ClassificationLeaf | ( | const uint & | n_classes = `0` | ) |
| inline explicit

Parameters

  n_classes | uint The number of classes. If set to 0, they're automatically inferred.

Definition at line 32 of file classificationleaf.h.

## Member Function Documentation

## ◆ create_duplicate()

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

Interface implementation.

Reimplemented from forpy::ILeaf.

Definition at line 40 of file classificationleaf.h.

## ◆ ensure_capacity()

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

Interface implementation.

Reimplemented from forpy::ILeaf.

Definition at line 72 of file classificationleaf.h.

## ◆ finalize_capacity()

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

Interface implementation.

Reimplemented from forpy::ILeaf.

Definition at line 75 of file classificationleaf.h.

## ◆ get_map()

const std::vector<Mat<float> >* forpy::ClassificationLeaf::get_map | ( |  | ) | const
| inline virtual

Get all leafs.

Implements forpy::ILeaf.

Definition at line 88 of file classificationleaf.h.

## ◆ get_result() [1/2]

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

Interface implementation.

Reimplemented from forpy::ILeaf.

## ◆ get_result() [2/2]

void forpy::ClassificationLeaf::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

Interface implementation.

Reimplemented from forpy::ILeaf.

## ◆ get_result_columns()

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

Interface implementation.

Reimplemented from forpy::ILeaf.

## ◆ get_result_type()

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

Interface implementation.

Reimplemented from forpy::ILeaf.

## ◆ get_stored_dists()

const std::vector<Vec<float> >& forpy::ClassificationLeaf::get_stored_dists | ( |  | ) | const

## ◆ is_compatible_with() [1/2]

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

Interface implementation.

Reimplemented from forpy::ILeaf.

Definition at line 43 of file classificationleaf.h.

## ◆ is_compatible_with() [2/2]

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

Interface implementation.

Reimplemented from forpy::ILeaf.

## ◆ make_leaf()

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

Interface implementation.

Reimplemented from forpy::ILeaf.

## ◆ operator==()

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

Reimplemented from forpy::ILeaf.

## ◆ serialize()

template<class Archive >

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

Definition at line 93 of file classificationleaf.h.

## ◆ transfer_or_run_check()

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

Interface implementation.

Reimplemented from forpy::ILeaf.

Definition at line 47 of file classificationleaf.h.

## Friends And Related Function Documentation

## ◆ cereal::access

friend class cereal::access
| friend

Definition at line 88 of file classificationleaf.h.

## ◆ operator<<

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

Definition at line 79 of file classificationleaf.h.

## Member Data Documentation

## ◆ class_transl_ptr

std::shared_ptr<std::vector<uint> > forpy::ClassificationLeaf::class_transl_ptr
| private

Definition at line 99 of file classificationleaf.h.

## ◆ n_classes

uint forpy::ClassificationLeaf::n_classes
| private

Definition at line 96 of file classificationleaf.h.

## ◆ stored_distributions

std::vector<Vec<float> > forpy::ClassificationLeaf::stored_distributions
| private

Definition at line 101 of file classificationleaf.h.

## ◆ true_max_class

uint forpy::ClassificationLeaf::true_max_class
| private

Definition at line 100 of file classificationleaf.h.

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

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