:py:mod:`pycmtensor.scheduler` ============================== .. py:module:: pycmtensor.scheduler .. autoapi-nested-parse:: PyCMTensor scheduler module Module Contents --------------- .. py:class:: Scheduler Base class for Scheduler object Constructor for Scheduler class object .. py:class:: ConstantLR(lr=0.01) Bases: :py:obj:`Scheduler` Base class for constant learning rate scheduler Constructor for ConstantLR class object :param lr: learning rate value :type lr: float, optional .. py:method:: lr() :property: Returns the learning rate value .. py:method:: history() :property: Returns the histroy of the learning rate .. py:method:: _record(step, lr) Saves the history of the learning rate and returns the current rate .. py:class:: StepLR(lr=0.01, factor=0.25, drop_every=10) Bases: :py:obj:`ConstantLR` Base class for step learning rate scheduler Constructor for StepLR class object :param lr: initial learning rate value :type lr: float :param factor: percentage reduction to the learning rate :type factor: float, optional :param drop_every: step down the learning rate after every n steps :type drop_every: int, optional .. py:method:: factor() :property: Returns the step factor value .. py:method:: drop_every() :property: Returns the step distance value .. py:class:: PolynomialLR(max_steps, lr=0.01, power=1.0) Bases: :py:obj:`ConstantLR` Base class for polynomial decay learning rate scheduler Constructor for PolynomialLR class object :param lr: initial learning rate value :type lr: float :param max_steps: the max number of training steps to take :type max_steps: int :param power: the exponential factor to decay :type power: float, optional .. py:method:: power() :property: Returns the exponent of the polynomial .. py:method:: max_steps() :property: Returns the max steps value .. py:class:: CyclicLR(lr=0.01, max_lr=0.1, cycle_steps=16, scale_fn=None) Bases: :py:obj:`ConstantLR` Base class for cyclical learning rate scheduler Constructor for ConstantLR class object :param lr: the base learning rate value :type lr: float, optional :param max_lr: the maximum learning rate value :type max_lr: float, optional :param cycle_steps: the number of steps to complete a cycle :type cycle_steps: int, optional :param scale_fn: custom scaling policy defined by a single arg :type scale_fn: func, optional .. py:method:: max_lr() :property: Returns the maximum learning rate value .. py:method:: cycle_steps() :property: Returns the cycle steps value .. py:method:: scale_fn(k) Custom scaling policy .. py:class:: Triangular2CLR(lr=0.01, max_lr=0.1, cycle_steps=16) Bases: :py:obj:`CyclicLR` Class object for the Triangular2 Cyclic LR scheduler Constructor for Triangular2CLR class object :param lr: the base learning rate value :type lr: float, optional :param max_lr: the maximum learning rate value :type max_lr: float, optional :param cycle_steps: the number of steps to complete a cycle :type cycle_steps: int, optional .. py:method:: scale_fn(k) Calculates the cycle amplitude scale .. py:class:: ExpRangeCLR(lr=0.01, max_lr=0.1, cycle_steps=16, gamma=0.5) Bases: :py:obj:`CyclicLR` Class object for the exponential range Cyclic LR scheduler Constructor for Triangular2CLR class object :param lr: the base learning rate value :type lr: float, optional :param max_lr: the maximum learning rate value :type max_lr: float, optional :param cycle_steps: the number of steps to complete a cycle :type cycle_steps: int, optional .. py:method:: gamma() :property: Returns the gamma value .. py:method:: scale_fn(k) Calculates the cycle amplitude scale