Skip to content

Schedule ​

python
Schedule() -> None

Source

Methods ​

change_after ​

python
change_after(steps: int, new_value: float) -> Self

Change 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 be new_value.

Returns:

  • Self – The Schedule.

Source

constant_for ​

python
constant_for(steps: int) -> Self

Keep the current value for the specified number of steps.

Parameters:

  • steps (int) – The number of steps to keep constant for.

Returns:

  • Self – The Schedule.

Source

critical_steps ​

python
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.

Source

from_list ​

python
from_list(schedule_list: list[list[float]]) -> Self

Creates a schedule from a list of [step, value] pairs. It assumes the value should be interpolated between steps.

Source

get_value_at ​

python
get_value_at(step: int) -> float

Source

is_constant ​

python
is_constant() -> bool

Check 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.

Source

linear ​

python
linear(steps: int, end_value: float) -> Self

Change 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 be end_value.

Returns:

  • Self – The Schedule.

Source

minimum ​

python
minimum() -> float

Get the smallest value this schedule can produce over its entire duration.

Returns:

  • float – The minimum over every section.

Source

sections ​

python
sections() -> tuple[Section, ...]

Get the schedule's sections in order.

Returns:

  • tuple[Section, ...] – The ordered sections making up this schedule.

Source

starting ​

python
starting(value: float) -> Self

Source

to_flat_params ​

python
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.

Source

to_schedule ​

python
to_schedule(schedule_or_value: Self | float | list[list[float]]) -> Self

Source

validate_zero_to_one ​

python
validate_zero_to_one() -> None

Source