|
|
static constexpr std::ptrdiff_t | fast_step = 5 |
|
static constexpr std::size_t | default_min_samples_per_thread = 512 |
◆ aggregate_evaluator()
template<Individual P, class F, class D, aggregation_mode A, evaluation_mode M>
requires ExampleEvaluator<F, D, P>
| aggregate_evaluator::aggregate_evaluator |
( |
D & | d | ) |
|
|
explicitnoexcept |
Constructs the evaluator.
- Parameters
-
◆ fast()
template<Individual P, class F, class D, aggregation_mode A, evaluation_mode M>
requires ExampleEvaluator<F, D, P>
| double aggregate_evaluator::fast |
( |
const P & | prg | ) |
const |
|
nodiscard |
Computes a (possibly approximate) fitness value using subsampling.
- Parameters
-
| [in] | prg | program to evaluate |
- Returns
- fitness value (exact or approximate)
For sufficiently large datasets, the program is evaluated on a subset of the examples (one every step elements) to reduce computation time.
For smaller datasets, the full evaluation is performed, making this function equivalent to operator()().
For average-based evaluators, subsampling yields an estimate of the true average. For sum-based evaluators, the result is rescaled to remain comparable with operator()().
◆ operator()()
template<Individual P, class F, class D, aggregation_mode A, evaluation_mode M>
requires ExampleEvaluator<F, D, P>
| double aggregate_evaluator::operator() |
( |
const P & | prg | ) |
const |
|
nodiscard |
Computes the fitness using all training examples.
- Parameters
-
| [in] | prg | program to evaluate |
- Returns
- fitness value (greater is better)
◆ predictor()
| auto aggregate_evaluator::predictor |
( |
const P & | prg | ) |
const |
|
nodiscard |
Builds a regression predictor associated with a program.
- Parameters
-
| [in] | prg | program to transform into a predictor |
- Returns
- predictor object associated with prg
- Parameters
-
| [in] | prg | program to evaluate |
| [in] | step | sampling step (one example every step) |
- Returns
- fitness value
Values from valid examples are averaged. Missing values incur a heuristic penalty based on the ratio of missing to valid examples. A partially valid program may still outrank a fully valid one. If all values are missing, the function returns std::numeric_limits<double>::lowest().
For opted-in functors and forward-range datasets with enough sampled examples, evaluation is divided into strips across the calling thread and configured helper threads. Each strip constructs its own example functor. Their means are combined by valid-example count before the missing-value penalty and sum scaling are applied. Parallel evaluation may change floating-point rounding. Sets up the environment for error measurement.
- Parameters
-
| [in] | prg | the program to be measured |
◆ set_parallel_evaluation()
| bool aggregate_evaluator::set_parallel_evaluation |
( |
unsigned | n, |
|
|
std::size_t | min_samples = 0 ) |
|
noexcept |
Sets the number of helper threads and workload threshold for parallel evaluation.
- Parameters
-
| [in] | n | number of helper threads; zero disables parallel evaluation |
| [in] | min_samples | minimum number of samples per thread; zero uses the default threshold |
- Returns
- true after applying the configuration
The documentation for this class was generated from the following files: