metaheuristic_designer.parameter_schedules.exponential_decay_schedule module#

Schedule that decays a value exponentially, either continuously or iteratively.

class ExponentialDecaySchedule(init_value, final_value=0, alpha=0.9, iterative=True)[source]#

Bases: SchedulableParameter

Schedule that exponentially decays a value from init_value towards final_value.

In iterative mode (iterative=True, the default), the current value is multiplied by alpha each time the schedule is evaluated. In continuous mode, the decay follows the function final_value + (init_value - final_value) * exp(-alpha * progress).

Parameters:
init_valuefloat

Starting value at progress 0.

final_valuefloat, optional

Asymptotic value (default 0).

alphafloat, optional

Decay factor. In iterative mode it must be in (0, 1); in continuous mode it controls the rate of decay.

iterativebool, optional

If True (default), the value is updated step-by-step. If False, decay is computed directly from progress.

Parameters:
  • init_value (float)

  • final_value (float)

  • alpha (float)

  • iterative (bool)

Methods

__call__(progress)

Shorthand for evaluate().

evaluate(progress)

Return the parameter value at the given progress.

evaluate(progress)[source]#

Return the parameter value at the given progress.

Return type:

float

Parameters:
progressfloat

Current progress, a number between 0 (start) and 1 (end).

Returns:
Any

The parameter value at this stage of the optimization.

Parameters:

progress (float)

Notes

The return value is not restricted to numbers. You can return: * a float (e.g., a linearly decaying mutation strength), * an int (e.g., a discrete number of mutated components), * a bool (e.g., switching on/off a feature after a threshold), * a string (e.g., switching between strategies), or * any other object that the consuming component expects.

This makes schedules suitable for changing discrete algorithm choices as well as continuous numerical parameters.