Ultra 0.9.4
Loading...
Searching...
No Matches
ultra::src::rmae_error_functor< P > Class Template Reference

#include <evaluator.h>

Public Member Functions

 rmae_error_functor (const P &)
std::optional< double > operator() (const example &) const

Detailed Description

template<Individual P>
class ultra::src::rmae_error_functor< P >

Relative mean absolute error functor for evaluating a program on a single example.

Template Parameters
Pindividual type

The functor owns an oracle initialised from the program and computes a scalar error value for each training example.

Computes a scaled relative difference between target and predicted values:

\‍[\frac{1}{n} \sum_{i=1}^n \frac{|target_i - actual_i|}{|target_i| + |actual_i|}
\‍]

This is similar to mae_error_functor but here we sum the relative errors. The idea is that the absolute difference of 1 between 6 and 5 is more significant than the same absolute difference between 1000001 and 1000000. The mathematically precise way to express this notion is to calculate the relative difference.

See also

Constructor & Destructor Documentation

◆ rmae_error_functor()

template<Individual P>
rmae_error_functor::rmae_error_functor ( const P & prg)
explicit

Sets up the environment for error measurement.

Parameters
[in]prgthe program to be measured

Member Function Documentation

◆ operator()()

template<Individual P>
std::optional< double > rmae_error_functor::operator() ( const example & example) const
nodiscard
Parameters
[in]examplecurrent training case
Returns
measurement of the error of the model/program on the current training case. The value returned is in the [0;1] range

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