Schedule
Schedule() -> NoneMethods
change_after
change_after(steps: int, new_value: float) -> SelfChange the current value to a new value after the specified number of steps.
Parameters:
steps(int) – The number of steps to change after.new_value(float) – The new value after the number of steps specified. As a result, if starting at 0 after 10 steps (0-9), then the value at step 10 will benew_value.
Returns:
Self– The Schedule.
constant_for
constant_for(steps: int) -> SelfKeep the current value for the specified number of steps.
Parameters:
steps(int) – The number of steps to keep constant for.
Returns:
Self– The Schedule.
critical_steps
critical_steps() -> set[int]Get every step at which this schedule's value can change.
Returns:
set[int]– The start step of each section, plus the end step of each interpolating section.
from_list
from_list(schedule_list: list[list[float]]) -> SelfCreates a schedule from a list of [step, value] pairs. It assumes the value should be interpolated between steps.
get_value_at
get_value_at(step: int) -> floatis_constant
is_constant() -> boolCheck whether this schedule holds one fixed value for its entire duration.
Returns:
bool– True if the value at every section never differs from the value at step 0.
linear
linear(steps: int, end_value: float) -> SelfChange the current value smoothly over the specified number of steps.
Parameters:
steps(int) – The number of steps to change over.end_value(float) – The end value after the specified number of steps. As a result, if starting at 0 after 10 steps (0-9), then the value at step 10 will beend_value.
Returns:
Self– The Schedule.
minimum
minimum() -> floatGet the smallest value this schedule can produce over its entire duration.
Returns:
float– The minimum over every section.
sections
sections() -> tuple[Section, ...]Get the schedule's sections in order.
Returns:
tuple[Section, ...]– The ordered sections making up this schedule.
starting
starting(value: float) -> Selfto_flat_params
to_flat_params(prefix: str = '') -> dict[str, float | int | str]Flatten this schedule into single-level metric-parameter key/value pairs.
Each section becomes {prefix}.{index}.* entries describing its type, step range and values, suitable for logging as run parameters.
Parameters:
prefix(str) – The prefix to prepend to keys.
Returns:
dict[str, float | int | str]– A flattened dictionary of parameters.
to_schedule
to_schedule(schedule_or_value: Self | float | list[list[float]]) -> Selfvalidate_zero_to_one
validate_zero_to_one() -> None