class_docstr: Decaying hyperparameter (specification key: `decaying`, `linear`, `exponential`, `polynomial`,
  `inverse_time`, `cosine`, `cosine_restarts`, `linear_cosine`, `linear_cosine_noisy`).
  
  Args:
      decay ("linear" | "exponential" | "polynomial" | "inverse_time" | "cosine" | "cosine_restarts" | "linear_cosine" | "linear_cosine_noisy"):
          Decay type, see also
          `TensorFlow docs <https://www.tensorflow.org/api_docs/python/tf/train>`__
          (<span style="color:#C00000"><b>required</b></span>).
      unit ("timesteps" | "episodes" | "updates"): Unit of decay schedule
          (<span style="color:#C00000"><b>required</b></span>).
      num_steps (int): Number of decay steps
          (<span style="color:#C00000"><b>required</b></span>).
      initial_value (float | int): Initial value
          (<span style="color:#C00000"><b>required</b></span>).
      increasing (bool): Whether to subtract the decayed value from 1.0
          (<span style="color:#00C000"><b>default</b></span>: false).
      inverse (bool): Whether to take the inverse of the decayed value
          (<span style="color:#00C000"><b>default</b></span>: false).
      scale (float): Scaling factor for (inverse) decayed value
          (<span style="color:#00C000"><b>default</b></span>: 1.0).
      kwargs: Additional arguments depend on decay mechanism.<br>
          Linear decay:
          <ul>
          <li><b>final_value</b> (<i>float | int</i>) &ndash; Final value
          (<span style="color:#C00000"><b>required</b></span>).</li>
          </ul>
          Exponential decay:
          <ul>
          <li><b>decay_rate</b> (<i>float</i>) &ndash; Decay rate
          (<span style="color:#C00000"><b>required</b></span>).</li>
          <li><b>staircase</b> (<i>bool</i>) &ndash; Whether to apply decay in a discrete
          staircase, as opposed to continuous, fashion.
          (<span style="color:#00C000"><b>default</b></span>: false).</li>
          </ul>
          Polynomial decay:
          <ul>
          <li><b>final_value</b> (<i>float | int</i>) &ndash; Final value
          (<span style="color:#C00000"><b>required</b></span>).</li>
          <li><b>power</b> (<i>float | int</i>) &ndash; Power of polynomial
          (<span style="color:#00C000"><b>default</b></span>: 1, thus linear).</li>
          <li><b>cycle</b> (<i>bool</i>) &ndash; Whether to cycle beyond num_steps
          (<span style="color:#00C000"><b>default</b></span>: false).</li>
          </ul>
          Inverse time decay:
          <ul>
          <li><b>decay_rate</b> (<i>float</i>) &ndash; Decay rate
          (<span style="color:#C00000"><b>required</b></span>).</li>
          <li><b>staircase</b> (<i>bool</i>) &ndash; Whether to apply decay in a discrete
          staircase, as opposed to continuous, fashion.
          (<span style="color:#00C000"><b>default</b></span>: false).</li>
          </ul>
          Cosine decay:
          <ul>
          <li><b>alpha</b> (<i>float</i>) &ndash; Minimum learning rate value as a fraction of
          learning_rate
          (<span style="color:#00C000"><b>default</b></span>: 0.0).</li>
          </ul>
          Cosine decay with restarts:
          <ul>
          <li><b>t_mul</b> (<i>float</i>) &ndash; Used to derive the number of iterations in the
          i-th period
          (<span style="color:#00C000"><b>default</b></span>: 2.0).</li>
          <li><b>m_mul</b> (<i>float</i>) &ndash; Used to derive the initial learning rate of the
          i-th period
          (<span style="color:#00C000"><b>default</b></span>: 1.0).</li>
          <li><b>alpha</b> (<i>float</i>) &ndash; Minimum learning rate value as a fraction of
          the learning_rate
          (<span style="color:#00C000"><b>default</b></span>: 0.0).</li>
          </ul>
          Linear cosine decay:
          <ul>
          <li><b>num_periods</b> (<i>float</i>) &ndash; Number of periods in the cosine part of
          the decay
          (<span style="color:#00C000"><b>default</b></span>: 0.5).</li>
          <li><b>alpha</b> (<i>float</i>) &ndash; Alpha value
          (<span style="color:#00C000"><b>default</b></span>: 0.0).</li>
          <li><b>beta</b> (<i>float</i>) &ndash; Beta value
          (<span style="color:#00C000"><b>default</b></span>: 0.001).</li>
          </ul>
          Noisy linear cosine decay:
          <ul>
          <li><b>initial_variance</b> (<i>float</i>) &ndash; Initial variance for the noise
          (<span style="color:#00C000"><b>default</b></span>: 1.0).</li>
          <li><b>variance_decay</b> (<i>float</i>) &ndash; Decay for the noise's variance
          (<span style="color:#00C000"><b>default</b></span>: 0.55).</li>
          <li><b>num_periods</b> (<i>float</i>) &ndash; Number of periods in the cosine part of
          the decay
          (<span style="color:#00C000"><b>default</b></span>: 0.5).</li>
          <li><b>alpha</b> (<i>float</i>) &ndash; Alpha value
          (<span style="color:#00C000"><b>default</b></span>: 0.0).</li>
          <li><b>beta</b> (<i>float</i>) &ndash; Beta value
          (<span style="color:#00C000"><b>default</b></span>: 0.001).</li>
          </ul>
      name (string): <span style="color:#0000C0"><b>internal use</b></span>.
      dtype (type): <span style="color:#0000C0"><b>internal use</b></span>.
      min_value (dtype-compatible value): <span style="color:#0000C0"><b>internal use</b></span>.
      max_value (dtype-compatible value): <span style="color:#0000C0"><b>internal use</b></span>.
class_docstr_tok: ["Decaying","hyperparameter","(","specification","key",":","`","decaying","`",",","`","linear","`",",","`","exponential","`",",","`","polynomial","`",",","`","inverse_time","`",",","`","cosine","`",",","`","cosine_restarts","`",",","`","linear_cosine","`",",","`","linear_cosine_noisy","`",")",".","Args",":","decay","(","``","linear","''","|","``","exponential","''","|","``","polynomial","''","|","``","inverse_time","''","|","``","cosine","''","|","``","cosine_restarts","''","|","``","linear_cosine","''","|","``","linear_cosine_noisy","''",")",":","Decay","type",",","see","also","`","TensorFlow","docs","<","https",":","\/\/www.tensorflow.org\/api_docs\/python\/tf\/train",">","`","__","(","<","span","style=","''","color",":","#","C00000","''",">","<","b",">","required","<","\/b",">","<","\/span",">",")",".","unit","(","``","timesteps","''","|","``","episodes","''","|","``","updates","''",")",":","Unit","of","decay","schedule","(","<","span","style=","''","color",":","#","C00000","''",">","<","b",">","required","<","\/b",">","<","\/span",">",")",".","num_steps","(","int",")",":","Number","of","decay","steps","(","<","span","style=","''","color",":","#","C00000","''",">","<","b",">","required","<","\/b",">","<","\/span",">",")",".","initial_value","(","float","|","int",")",":","Initial","value","(","<","span","style=","''","color",":","#","C00000","''",">","<","b",">","required","<","\/b",">","<","\/span",">",")",".","increasing","(","bool",")",":","Whether","to","subtract","the","decayed","value","from","1.0","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","false",")",".","inverse","(","bool",")",":","Whether","to","take","the","inverse","of","the","decayed","value","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","false",")",".","scale","(","float",")",":","Scaling","factor","for","(","inverse",")","decayed","value","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","1.0",")",".","kwargs",":","Additional","arguments","depend","on","decay","mechanism.","<","br",">","Linear","decay",":","<","ul",">","<","li",">","<","b",">","final_value","<","\/b",">","(","<","i",">","float","|","int","<","\/i",">",")","&","ndash",";","Final","value","(","<","span","style=","''","color",":","#","C00000","''",">","<","b",">","required","<","\/b",">","<","\/span",">",")",".","<","\/li",">","<","\/ul",">","Exponential","decay",":","<","ul",">","<","li",">","<","b",">","decay_rate","<","\/b",">","(","<","i",">","float","<","\/i",">",")","&","ndash",";","Decay","rate","(","<","span","style=","''","color",":","#","C00000","''",">","<","b",">","required","<","\/b",">","<","\/span",">",")",".","<","\/li",">","<","li",">","<","b",">","staircase","<","\/b",">","(","<","i",">","bool","<","\/i",">",")","&","ndash",";","Whether","to","apply","decay","in","a","discrete","staircase",",","as","opposed","to","continuous",",","fashion",".","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","false",")",".","<","\/li",">","<","\/ul",">","Polynomial","decay",":","<","ul",">","<","li",">","<","b",">","final_value","<","\/b",">","(","<","i",">","float","|","int","<","\/i",">",")","&","ndash",";","Final","value","(","<","span","style=","''","color",":","#","C00000","''",">","<","b",">","required","<","\/b",">","<","\/span",">",")",".","<","\/li",">","<","li",">","<","b",">","power","<","\/b",">","(","<","i",">","float","|","int","<","\/i",">",")","&","ndash",";","Power","of","polynomial","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","1",",","thus","linear",")",".","<","\/li",">","<","li",">","<","b",">","cycle","<","\/b",">","(","<","i",">","bool","<","\/i",">",")","&","ndash",";","Whether","to","cycle","beyond","num_steps","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","false",")",".","<","\/li",">","<","\/ul",">","Inverse","time","decay",":","<","ul",">","<","li",">","<","b",">","decay_rate","<","\/b",">","(","<","i",">","float","<","\/i",">",")","&","ndash",";","Decay","rate","(","<","span","style=","''","color",":","#","C00000","''",">","<","b",">","required","<","\/b",">","<","\/span",">",")",".","<","\/li",">","<","li",">","<","b",">","staircase","<","\/b",">","(","<","i",">","bool","<","\/i",">",")","&","ndash",";","Whether","to","apply","decay","in","a","discrete","staircase",",","as","opposed","to","continuous",",","fashion",".","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","false",")",".","<","\/li",">","<","\/ul",">","Cosine","decay",":","<","ul",">","<","li",">","<","b",">","alpha","<","\/b",">","(","<","i",">","float","<","\/i",">",")","&","ndash",";","Minimum","learning","rate","value","as","a","fraction","of","learning_rate","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","0.0",")",".","<","\/li",">","<","\/ul",">","Cosine","decay","with","restarts",":","<","ul",">","<","li",">","<","b",">","t_mul","<","\/b",">","(","<","i",">","float","<","\/i",">",")","&","ndash",";","Used","to","derive","the","number","of","iterations","in","the","i-th","period","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","2.0",")",".","<","\/li",">","<","li",">","<","b",">","m_mul","<","\/b",">","(","<","i",">","float","<","\/i",">",")","&","ndash",";","Used","to","derive","the","initial","learning","rate","of","the","i-th","period","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","1.0",")",".","<","\/li",">","<","li",">","<","b",">","alpha","<","\/b",">","(","<","i",">","float","<","\/i",">",")","&","ndash",";","Minimum","learning","rate","value","as","a","fraction","of","the","learning_rate","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","0.0",")",".","<","\/li",">","<","\/ul",">","Linear","cosine","decay",":","<","ul",">","<","li",">","<","b",">","num_periods","<","\/b",">","(","<","i",">","float","<","\/i",">",")","&","ndash",";","Number","of","periods","in","the","cosine","part","of","the","decay","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","0.5",")",".","<","\/li",">","<","li",">","<","b",">","alpha","<","\/b",">","(","<","i",">","float","<","\/i",">",")","&","ndash",";","Alpha","value","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","0.0",")",".","<","\/li",">","<","li",">","<","b",">","beta","<","\/b",">","(","<","i",">","float","<","\/i",">",")","&","ndash",";","Beta","value","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","0.001",")",".","<","\/li",">","<","\/ul",">","Noisy","linear","cosine","decay",":","<","ul",">","<","li",">","<","b",">","initial_variance","<","\/b",">","(","<","i",">","float","<","\/i",">",")","&","ndash",";","Initial","variance","for","the","noise","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","1.0",")",".","<","\/li",">","<","li",">","<","b",">","variance_decay","<","\/b",">","(","<","i",">","float","<","\/i",">",")","&","ndash",";","Decay","for","the","noise","'s","variance","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","0.55",")",".","<","\/li",">","<","li",">","<","b",">","num_periods","<","\/b",">","(","<","i",">","float","<","\/i",">",")","&","ndash",";","Number","of","periods","in","the","cosine","part","of","the","decay","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","0.5",")",".","<","\/li",">","<","li",">","<","b",">","alpha","<","\/b",">","(","<","i",">","float","<","\/i",">",")","&","ndash",";","Alpha","value","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","0.0",")",".","<","\/li",">","<","li",">","<","b",">","beta","<","\/b",">","(","<","i",">","float","<","\/i",">",")","&","ndash",";","Beta","value","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","0.001",")",".","<","\/li",">","<","\/ul",">","name","(","string",")",":","<","span","style=","''","color",":","#","0000C0","''",">","<","b",">","internal","use","<","\/b",">","<","\/span",">",".","dtype","(","type",")",":","<","span","style=","''","color",":","#","0000C0","''",">","<","b",">","internal","use","<","\/b",">","<","\/span",">",".","min_value","(","dtype-compatible","value",")",":","<","span","style=","''","color",":","#","0000C0","''",">","<","b",">","internal","use","<","\/b",">","<","\/span",">",".","max_value","(","dtype-compatible","value",")",":","<","span","style=","''","color",":","#","0000C0","''",">","<","b",">","internal","use","<","\/b",">","<","\/span",">","."]
code: def __init__(
      self,
      *,
      decay,
      unit,
      num_steps,
      initial_value,
      increasing=False,
      inverse=False,
      scale=1.0,
      name=None,
      dtype=None,
      min_value=None,
      max_value=None,
      **kwargs,
  ):
      assert decay in (
          "cosine",
          "cosine_restarts",
          "exponential",
          "inverse_time",
          "linear",
          "linear_cosine",
          "linear_cosine_noisy",
          "polynomial",
      )
      assert unit in ("timesteps", "episodes", "updates")
      assert (
          isinstance(num_steps, int) or num_steps % 10.0 == 0.0
      ) and num_steps > 0
      assert isinstance(initial_value, (float, int))
  
      if isinstance(initial_value, int):
          if dtype != "int":
              raise TensorforceError.dtype(
                  name="Decaying",
                  argument="initial_value",
                  dtype=type(initial_value),
              )
      elif isinstance(initial_value, float):
          if dtype != "float":
              raise TensorforceError.dtype(
                  name="Decaying",
                  argument="initial_value",
                  dtype=type(initial_value),
              )
      else:
          raise TensorforceError.unexpected()
  
      if decay == "linear":
          assert len(kwargs) == 1 and "final_value" in kwargs
          decay = "polynomial"
  
      self.decay = decay
      self.num_steps = int(num_steps)
      self.initial_value = initial_value
      self.increasing = increasing
      self.inverse = inverse
      self.scale = scale
      self.kwargs = kwargs
  
      super().__init__(
          unit=unit,
          name=name,
          dtype=dtype,
          min_value=min_value,
          max_value=max_value,
      )
  
file_path: tensorforce/tensorforce/core/parameters/decaying.py
imports: import tensorflow
  from tensorforce import TensorforceError, util
  from tensorforce.core import tf_util
  from tensorforce.core.parameters import Parameter
label_desc: Use image node_id 1 to create a new Decaying object from inherited base classes: Parameter with example: obj = Decaying()