|
LBANN
0.103.0
LivermoreBigArtificialNeuralNetworkToolkit
|
#include <metric.hpp>
Public Member Functions | |
| metric (lbann_comm *comm) | |
| metric (const metric &other)=default | |
| metric & | operator= (const metric &other)=default |
| virtual | ~metric ()=default |
| virtual metric * | copy () const =0 |
| template<class Archive > | |
| void | serialize (Archive &ar) |
| virtual std::string | name () const =0 |
| virtual std::string | get_unit () const |
| virtual void | setup (model &m) |
| virtual EvalType | evaluate (execution_mode mode, int mini_batch_size)=0 |
| void | reset_statistics () |
| void | reset_statistics (execution_mode mode) |
| EvalType | get_mean_value (execution_mode mode) const |
| int | get_statistics_num_samples (execution_mode mode) const |
| virtual std::vector< ViewingLayerPtr > | get_layer_pointers () const |
| virtual void | set_layer_pointers (std::vector< ViewingLayerPtr > layers) |
| EvalType | get_evaluate_time () const |
| EvalType & | get_evaluate_time () |
| void | reset_counters () |
| virtual bool | save_to_checkpoint_shared (persist &p)=0 |
| virtual bool | load_from_checkpoint_shared (persist &p)=0 |
| virtual bool | save_to_checkpoint_distributed (persist &p)=0 |
| virtual bool | load_from_checkpoint_distributed (persist &p)=0 |
Protected Member Functions | |
| virtual EvalType | evaluate_compute (const AbsDistMat &prediction, const AbsDistMat &ground_truth)=0 |
| lbann_comm & | get_comm () |
| std::map< execution_mode, metric_statistics > & | get_statistics () |
Private Attributes | |
| lbann_comm * | m_comm |
| std::map< execution_mode, metric_statistics > | m_statistics |
| EvalType | m_evaluate_time = 0.0 |
Abstract base class for metric functions. A metric function can be used to evaluate the performance of a model without affecting the training process.
Definition at line 86 of file metric.hpp.
| lbann::metric::metric | ( | lbann_comm * | comm | ) |
Constructor.
|
default |
Copy constructor.
|
virtualdefault |
Destructor.
|
pure virtual |
Copy function.
Implemented in lbann::layer_metric.
|
pure virtual |
Evaluate the metric value. This function takes the model's current mini-batch size. If multiple models are being trained, the current mini-batch size may be different from the effective mini-batch size. The result is stored in history.
Implemented in lbann::layer_metric.
|
protectedpure virtual |
Computation to evaluate the metric function. This should return the sum of metric values across the mini-batch, not the mean value.
Implemented in lbann::layer_metric.
|
inlineprotected |
Get LBANN communicator.
Definition at line 173 of file metric.hpp.
|
inline |
Get the time spent in evaluation for this metric (const).
Definition at line 149 of file metric.hpp.
|
inline |
Get the time spent in evaluation for this metric.
Definition at line 151 of file metric.hpp.
|
virtual |
Get list of pointers to layers.
Reimplemented in lbann::layer_metric.
| EvalType lbann::metric::get_mean_value | ( | execution_mode | mode | ) | const |
Get mean metric value. If mini-batch sizes are not identical, the mean is over the sample values rather than over the mini-batch mean values.
|
inlineprotected |
Get metric statistics.
Definition at line 176 of file metric.hpp.
| int lbann::metric::get_statistics_num_samples | ( | execution_mode | mode | ) | const |
Get number of samples for statistics.
|
inlinevirtual |
Return a display unit for this metric. Default is an empty string. This is overriden if the metric has units, e.g. "%" or "sec".
Reimplemented in lbann::layer_metric.
Definition at line 112 of file metric.hpp.
|
pure virtual |
Implemented in lbann::layer_metric.
|
pure virtual |
Load metric state from checkpoint.
Implemented in lbann::layer_metric.
|
pure virtual |
Return a string name for this metric.
Implemented in lbann::layer_metric.
|
inline |
Reset timing counters.
Definition at line 154 of file metric.hpp.
|
inline |
Clear all statistics.
Definition at line 126 of file metric.hpp.
|
inline |
Clear statistics for an execution mode.
Definition at line 133 of file metric.hpp.
|
pure virtual |
Implemented in lbann::layer_metric.
|
pure virtual |
Save metric state to checkpoint.
Implemented in lbann::layer_metric.
| void lbann::metric::serialize | ( | Archive & | ar | ) |
Archive for checkpoint and restart
|
virtual |
Set list of pointers to layers.
Reimplemented in lbann::layer_metric.
|
inlinevirtual |
|
private |
LBANN communicator.
Definition at line 183 of file metric.hpp.
|
private |
Runtime for the metric evaluation.
Definition at line 189 of file metric.hpp.
|
private |
Metric statistics.
Definition at line 186 of file metric.hpp.