forpy 2

Public Member Functions | Protected Member Functions | Private Member Functions | Friends | List of all members
forpy::IGainCalculator Class Reference
Gains

Interface for a gain calculator class. More...

`#include <igaincalculator.h>`

Inheritance diagram for forpy::IGainCalculator:

## Public Member Functions
virtual | ~IGainCalculator ()
virtual float | operator() (const std::vector< float > &members_numbers_left, const std::vector< float > &members_numbers_right) VIRTUAL(float)
virtual float | operator() (const float &current_entropy, const std::vector< float > &members_numbers_left, const std::vector< float > &members_numbers_right) VIRTUAL(float)
virtual float | approx (const std::vector< float > &members_numbers_left, const std::vector< float > &members_numbers_right) VIRTUAL(float)
virtual bool | operator== (const IGainCalculator &rhs) const VIRTUAL(bool)

## Protected Member Functions
| IGainCalculator ()

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

## Friends
class | cereal::access

## Detailed Description

Interface for a gain calculator class.

A gain calculator must have an overloaded () operator with the according parameters and an approx function that returns a fast approximation of the gain (can return the original gain if no approximation is available). The approximation is used to find the best split position and only for that the actual gain is computed.

Parameters

  counting_dtype | The datatype for counting class members. This might be a float if sample weights are used.

Definition at line 29 of file igaincalculator.h.

## Constructor & Destructor Documentation

## ◆ ~IGainCalculator()

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

Definition at line 31 of file igaincalculator.h.

## ◆ IGainCalculator()

forpy::IGainCalculator::IGainCalculator | ( |  | ) |
| inline protected

Definition at line 57 of file igaincalculator.h.

## Member Function Documentation

## ◆ approx()

virtual float forpy::IGainCalculator::approx | ( | const std::vector< float > & | members_numbers_left,
|  | const std::vector< float > & | members_numbers_right
| ) |  |
| virtual

Calculates an approximation for the gain of the two subsets that can be used inside an `argmax` function.

Reimplemented in forpy::EntropyGain.

## ◆ DISALLOW_COPY_AND_ASSIGN()

forpy::IGainCalculator::DISALLOW_COPY_AND_ASSIGN | ( | IGainCalculator |  | ) |
| private

## ◆ operator()() [1/2]

virtual float forpy::IGainCalculator::operator() | ( | const std::vector< float > & | members_numbers_left,
|  | const std::vector< float > & | members_numbers_right
| ) |  |
| virtual

Calculates the exact gain for the two subsets.

Reimplemented in forpy::EntropyGain.

## ◆ operator()() [2/2]

virtual float forpy::IGainCalculator::operator() | ( | const float & | current_entropy,
|  | const std::vector< float > & | members_numbers_left,
|  | const std::vector< float > & | members_numbers_right
| ) |  |
| virtual

Calculates the exact gain for the two subsets and uses the provided `current_entropy`.

Reimplemented in forpy::EntropyGain.

## ◆ operator==()

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

Deep equality comparison.

Reimplemented in forpy::EntropyGain.

## ◆ serialize()

template<class Archive >

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

Definition at line 64 of file igaincalculator.h.

## Friends And Related Function Documentation

## ◆ cereal::access

friend class cereal::access
| friend

Definition at line 62 of file igaincalculator.h.

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

- /Users/classner/git/forpy/include/forpy/gains/igaincalculator.h