Shortcuts

BaseParamScheduler#

class ignite.handlers.param_scheduler.BaseParamScheduler(param_name, save_history=False)[source]#

An abstract class for updating an engine state or optimizer’s parameter value during training.

Parameters
  • param_name (str) – name of engine state or optimizer’s parameter to update.

  • save_history (bool) – whether to log the parameter values to engine.state.param_history, (default=False).

New in version 0.4.7.

Methods

get_param

Method to get current parameter values

load_state_dict

Copies parameters from state_dict into this BaseParamScheduler.

plot_values

Method to plot simulated scheduled values during num_events events.

simulate_values

Method to simulate scheduled values during num_events events.

state_dict

Returns a dictionary containing a whole state of BaseParamScheduler.

abstract get_param()[source]#

Method to get current parameter values

Returns

list of params, or scalar param

Return type

Union[List[float], float]

load_state_dict(state_dict)[source]#

Copies parameters from state_dict into this BaseParamScheduler.

Parameters

state_dict (Mapping) – a dict containing parameters.

Return type

None

classmethod plot_values(num_events, **scheduler_kwargs)[source]#

Method to plot simulated scheduled values during num_events events.

This class requires matplotlib package to be installed:

pip install matplotlib
Parameters
  • num_events (int) – number of events during the simulation.

  • scheduler_kwargs (Mapping) – parameter scheduler configuration kwargs.

Returns

matplotlib.lines.Line2D

Return type

Any

Examples

import matplotlib.pylab as plt

plt.figure(figsize=(10, 7))
LinearCyclicalScheduler.plot_values(num_events=50, param_name='lr',
                                    start_value=1e-1, end_value=1e-3, cycle_size=10))
abstract classmethod simulate_values(num_events, **scheduler_kwargs)[source]#

Method to simulate scheduled values during num_events events.

Parameters
  • num_events (int) – number of events during the simulation.

  • scheduler_kwargs (Any) – parameter scheduler configuration kwargs.

Returns

event_index, value

Return type

List[List[int]]

state_dict()[source]#

Returns a dictionary containing a whole state of BaseParamScheduler.

Returns

a dictionary containing a whole state of BaseParamScheduler

Return type

dict