forpy 2

Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
forpy::RegressionOpt Class Reference
Threshold Optimizers

Optimize split thresholds to optimize regression results (MSE). More...

`#include <regression_opt.h>`

Inheritance diagram for forpy::RegressionOpt:

## Public Member Functions
| RegressionOpt (const size_t &n_thresholds=0, const float &gain_threshold=1E-7f)
bool | operator== (const IThreshOpt &rhs) const
virtual std::shared_ptr< IThreshOpt > | create_duplicate (const uint &) const
| Interface implementation. More...
void | check_annotations (IDataProvider *dprov)
| Interface implementation. More...
void | transfer_or_run_check (IThreshOpt *other, IDataProvider *dprov)
| Interface implementation. More...
void | full_entropy (const IDataProvider &dprov, Desk *) const
| Interface implementation. More...
void | optimize (Desk *) const
| Interface implementation. More...
float | get_gain_threshold_for (const size_t &)
| Interface implementation. More...
Public Member Functions inherited from forpy::IThreshOpt
virtual | ~IThreshOpt ()
virtual bool | supports_weights () const
| Whether this threshold optimizer can take into account weights during the optimization. More...

## Private Member Functions
SplitOptRes< float > & | optimize__setup (DeciderDesk &d) const
void | optimize__sort (DeciderDesk &d) const
std::unique_ptr< std::vector< float > > | optimize__thresholds (Desk *d) const
template<class Archive >
void | serialize (Archive &ar, const uint &)
| DISALLOW_COPY_AND_ASSIGN (RegressionOpt)

## Private Attributes
size_t | n_thresholds
float | gain_threshold

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

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

## Detailed Description

Optimize split thresholds to optimize regression results (MSE).

This threshold optimizer draws `n_thresholds` random values between the minimum and maximum observed feature value and returns the best one, or finds the perfect split if `n_thresholds == 0`. Multiple annotations (and therefore multiple output regression) are allowed.

The optimizer is robust w.r.t. scaling of the features up to a certain extent. It is important that the least noticable difference is larger than 1E-7 (forpy::REGOPT_EPS).

Definition at line 54 of file regression_opt.h.

## Constructor & Destructor Documentation

## ◆ RegressionOpt()

forpy::RegressionOpt::RegressionOpt | ( | const size_t & | n_thresholds = `0`,
|  | const float & | gain_threshold = `1E-7f`
| ) |  |

Parameters

  n_thresholds | size_t>=0 Number of randomly drawn threshold values that are assessed. If set to 0, the perfect split is determined. Default: 0.
  gain_threshold | float >=0.f The minimum information gain a split has to achieve. Default: 1E-7f.

## Member Function Documentation

## ◆ check_annotations()

void forpy::RegressionOpt::check_annotations | ( | IDataProvider * | dprov | ) |
| virtual

Interface implementation.

Reimplemented from forpy::IThreshOpt.

## ◆ create_duplicate()

virtual std::shared_ptr<IThreshOpt> forpy::RegressionOpt::create_duplicate | ( | const uint & |  | ) | const
| inline virtual

Interface implementation.

Reimplemented from forpy::IThreshOpt.

Definition at line 68 of file regression_opt.h.

## ◆ DISALLOW_COPY_AND_ASSIGN()

forpy::RegressionOpt::DISALLOW_COPY_AND_ASSIGN | ( | RegressionOpt |  | ) |
| private

## ◆ full_entropy()

void forpy::RegressionOpt::full_entropy | ( | const IDataProvider & | dprov,
|  | Desk * |
| ) |  | const
| virtual

Interface implementation.

Reimplemented from forpy::IThreshOpt.

## ◆ get_gain_threshold_for()

float forpy::RegressionOpt::get_gain_threshold_for | ( | const size_t & |  | ) |
| inline virtual

Interface implementation.

Reimplemented from forpy::IThreshOpt.

Definition at line 79 of file regression_opt.h.

## ◆ operator==()

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

Reimplemented from forpy::IThreshOpt.

## ◆ optimize()

void forpy::RegressionOpt::optimize | ( | Desk * |  | ) | const
| virtual

Interface implementation.

Reimplemented from forpy::IThreshOpt.

## ◆ optimize__setup()

SplitOptRes<float>& forpy::RegressionOpt::optimize__setup | ( | DeciderDesk & | d | ) | const
| inline private

## ◆ optimize__sort()

void forpy::RegressionOpt::optimize__sort | ( | DeciderDesk & | d | ) | const
| inline private

## ◆ optimize__thresholds()

std::unique_ptr<std::vector<float> > forpy::RegressionOpt::optimize__thresholds | ( | Desk * | d | ) | const
| inline private

## ◆ serialize()

template<class Archive >

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

Definition at line 98 of file regression_opt.h.

## ◆ transfer_or_run_check()

void forpy::RegressionOpt::transfer_or_run_check | ( | IThreshOpt * | other,
|  | IDataProvider * | dprov
| ) |  |
| inline virtual

Interface implementation.

Reimplemented from forpy::IThreshOpt.

Definition at line 73 of file regression_opt.h.

## Friends And Related Function Documentation

## ◆ cereal::access

friend class cereal::access
| friend

Definition at line 96 of file regression_opt.h.

## ◆ operator<<

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

Definition at line 84 of file regression_opt.h.

## Member Data Documentation

## ◆ gain_threshold

float forpy::RegressionOpt::gain_threshold
| private

Definition at line 104 of file regression_opt.h.

## ◆ n_thresholds

size_t forpy::RegressionOpt::n_thresholds
| private

Definition at line 103 of file regression_opt.h.

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

- /Users/classner/git/forpy/include/forpy/threshold_optimizers/regression_opt.h