Averaging Prediction Mechanism in Fast Branch and Bound & Branch and Bound with Partial Prediction. More...
#include <branch_and_bound_predictor_averaging.hpp>
Public Member Functions | |
| virtual void | initialize (const DIMTYPE features) override |
(re)initializes the per-feature sum/count accumulators to zero for features features; call before use for each new search | |
| virtual bool | learn (const DIMTYPE feature, const RETURNTYPE value) override |
adds one observed value (non-negative, asserted) to feature 's running sum and increments its sample count; always returns true | |
| virtual bool | predict (const DIMTYPE feature, RETURNTYPE &value) const override |
sets value to the gamma-scaled running average learned for feature and returns true, but only once at least _delta samples have been learned for it; returns false otherwise | |
| unsigned long | get_count (const DIMTYPE feature) const |
the number of learn() calls recorded so far for feature - a diagnostic accessor, telling how well founded the feature's prediction is (predict() succeeds once this reaches the delta set by set_delta()) | |
| void | set_gamma (const RETURNTYPE gamma=1.0) |
| sets the scaling factor applied to the averaged value in predict() (asserted >=0.0); default 1.0 = plain average | |
| void | set_delta (const unsigned int delta=1) |
| sets the minimum sample count a feature must reach before predict() returns a value (asserted >=1); default 1 = predict as soon as one sample is learned | |
| virtual std::ostream & | print (std::ostream &os) const override |
| writes gamma/delta plus, for every feature with at least one learned sample, its current predicted value and sample count, and the total sample count across all features | |
Protected Attributes | |
| std::vector< RETURNTYPE > | _value |
| sums up 'learned' values | |
| std::vector< unsigned long > | _count |
| records the number of summed up values | |
| RETURNTYPE | _gamma |
| scaling factor applied to the averaged prediction; see set_gamma() | |
| unsigned int | _delta |
| minimum sample count before predict() returns a value; see set_delta() | |
Averaging Prediction Mechanism in Fast Branch and Bound & Branch and Bound with Partial Prediction.
Caller convention (see Search_Branch_And_Bound_Fast/_Partial_Prediction): the "value" learned for a feature is the nonnegative criterion-value drop caused by removing that feature from a node's parent (parent value - child value), and the "value" predicted for a feature is used the same way to estimate an unevaluated child's value as parent value - predicted drop. This class itself is agnostic to that interpretation; it just accumulates and averages whatever per-feature values it is given.
|
overridevirtual |
(re)initializes the per-feature sum/count accumulators to zero for features features; call before use for each new search
Implements FST::Branch_And_Bound_Predictor< RETURNTYPE, DIMTYPE >.
|
overridevirtual |
adds one observed value (non-negative, asserted) to feature 's running sum and increments its sample count; always returns true
Implements FST::Branch_And_Bound_Predictor< RETURNTYPE, DIMTYPE >.
|
overridevirtual |
sets value to the gamma-scaled running average learned for feature and returns true, but only once at least _delta samples have been learned for it; returns false otherwise
Implements FST::Branch_And_Bound_Predictor< RETURNTYPE, DIMTYPE >.
|
overridevirtual |
writes gamma/delta plus, for every feature with at least one learned sample, its current predicted value and sample count, and the total sample count across all features
Reimplemented from FST::Branch_And_Bound_Predictor< RETURNTYPE, DIMTYPE >.