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

#include <evaluator.h>

Public Member Functions

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

Detailed Description

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

Mean squared 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: ( $\frac{1}{n} \sum_{i=1}^n (target_i - actual_i)^2$).

Note
Real data always have noise (sampling/measurement errors) and this noise tends to follow a Gaussian distribution. It can be shown that when we have a set of data with errors drawn from such a distribution, we're most likely to find the 'correct' underlying model by minimizing the sum of squared errors.
Remarks
When the dataset contains outliers, the mse_error_functor will heavily weight each of them (this is the result of squaring the outliers). mae_error_functor is less sensitive to the presence of outliers (a desirable property in many applications).
See also
mse_evaluator

Constructor & Destructor Documentation

◆ mse_error_functor()

template<Individual P>
mse_error_functor::mse_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 > mse_error_functor::operator() ( const example & example) const
nodiscard
Parameters
[in]examplecurrent training case
Returns
a measurement of the error of the model/program on the the current training case. The value returned is in the [0;+inf[ range

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