hexed 0.4.0
 
Loading...
Searching...
No Matches
hexed::History_stats Class Reference

Computes statistics about the convergence history of some variable. More...

#include <History_stats.hpp>

Public Member Functions

 History_stats (double iteration_fraction)
 
void add_sample (Int iter, double value)
 Adds a new sample point and updates the curve fit to include it.
 
double iteration_fraction () const
 Retrieves the iteration_fraction argument passed to the constructor.
 
Int n_sample () const
 The number of sample points added with add_sample() (Not the number of iterations!)
 
Int last_iter () const
 The value of iter passed to the last add_sample() call.
 
double last_value () const
 The value passed to the last add_sample() call.
 
double smoothed () const
 The value of the curve fit at the last iteration (last_iter()).
 
double trend () const
 The derivative of the curve fit with respect to iteration count at the last iteration (last_iter())
 
double curvature () const
 The second derivative of the curve fit with respect to iteration count at the last iteration (last_iter())
 
void reset ()
 Clears the sample history.
 

Detailed Description

Computes statistics about the convergence history of some variable.

Computes a quadratic curve fit to the entire convergence history with a weighted least squares error metric. The weights are exponentially decaying such that the last iteration_fraction iterations should dominate the error metric. This formulation only needs O(1) memory because each time a new sample point is added, the new weighted normal equations can be computed directly from the previous normal equations and the data from the latest sample point.

Constructor & Destructor Documentation

◆ History_stats()

hexed::History_stats::History_stats ( double iteration_fraction)
Parameters
iteration_fractionWhat fraction of the iterations should have a significant impact on the curve fit

Member Function Documentation

◆ add_sample()

void hexed::History_stats::add_sample ( Int iter,
double value )

Adds a new sample point and updates the curve fit to include it.

iter must be nonnegative and strictly greater than the iter value passed to the last add_sample call.


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