: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:property:: lr

      Returns the learning rate value

   .. py:property:: history

      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:property:: factor

      Returns the step factor value

   .. py:property:: drop_every

      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:property:: power

      Returns the exponent of the polynomial

   .. py:property:: max_steps

      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:property:: max_lr

      Returns the maximum learning rate value

   .. py:property:: cycle_steps

      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:property:: gamma

      Returns the gamma value

   .. py:method:: scale_fn(k)

      Calculates the cycle amplitude scale



