:py:mod:`pycmtensor.expressions`
================================

.. py:module:: pycmtensor.expressions

.. autoapi-nested-parse::

   PyCMTensor expressions module



Module Contents
---------------


.. py:class:: Param(name: str, value=None)


   Bases: :py:obj:`Expressions`

   Base class for expression objects

   Constructor for model param object

   .. py:property:: name

      Returns the name of the object

   .. py:property:: init_value


   .. py:property:: shape


   .. py:method:: get_value()

      Returns the numpy representation of the parameter value


   .. py:method:: reset_value()

      Resets the value of the shared variable to the initial value



.. py:class:: Beta(name, value=0.0, lb=None, ub=None, status=0)


   Bases: :py:obj:`Param`

   Base class for expression objects

   Class object for Beta parameters

   :param name: name of the Beta class object
   :type name: str
   :param value: initial starting value. Defaults to ``0``
   :type value: float
   :param lb: lowerbound value. Defaults to ``None``
   :type lb: float
   :param ub: upperbound value. Defaults to ``None``
   :type ub: float
   :param status: whether to estimate (0) this Beta expression or not (1).
   :type status: int

   .. py:property:: status



.. py:class:: Sigma(name, value=1.0, ub=None, status=0, dist='NORMAL')


   Bases: :py:obj:`Beta`

   Base class for expression objects

   Class object for Beta parameters

   :param name: name of the Beta class object
   :type name: str
   :param value: initial starting value. Defaults to ``0``
   :type value: float
   :param lb: lowerbound value. Defaults to ``None``
   :type lb: float
   :param ub: upperbound value. Defaults to ``None``
   :type ub: float
   :param status: whether to estimate (0) this Beta expression or not (1).
   :type status: int

   .. py:property:: dist



.. py:class:: Bias(name: str, size: tuple, init_value=None)


   Bases: :py:obj:`Param`

   Base class for expression objects

   Constructor for model param object


.. py:class:: Weight(name: str, size: tuple, init_type=None, init_value=None, rng=None)


   Bases: :py:obj:`Param`

   Base class for expression objects

   Class object for Neural Network weights

   :param name: name of the parameter
   :type name: str
   :param size: array size of the parameter
   :type size: tuple, list
   :param init_type: initialization type, see notes
   :type init_type: str
   :param init_value: initial values of the parameter
   :type init_value: numpy.ndarray, optional
   :param rng: random number generator
   :type rng: numpy.random.Generator, optional

   .. note::

      Initialization types are one of the following:

      * 'zeros': a 2-D array of zeros

      * 'he': initialization method for neural networks that takes into account
        the non-linearity of activation functions, e.g. ReLU or Softplus [#]_

      * 'glorot': initialization method that maintains the variance for
        symmetric activation functions, e.g. sigm, tanh [#]_

      .. [#] He, K., Zhang, X., Ren, S. and Sun, J., 2015. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In Proceedings of the IEEE international conference on computer vision (pp. 1026-1034).
      .. [#] Glorot, X. and Bengio, Y., 2010, March. Understanding the difficulty of training deep feedforward neural networks. In Proceedings of the thirteenth international conference on artificial intelligence and statistics (pp. 249-256). JMLR Workshop and Conference Proceedings.

   .. hint::
       Initialization of Weights:

       .. code-block:: python

          w = expressions.Weight(name="w_1", size=(3, 10), init_type="he")

   .. py:property:: init_type



