:py:mod:`pycmtensor.functions` ============================== .. py:module:: pycmtensor.functions .. autoapi-nested-parse:: PyCMTensor functions module Module Contents --------------- .. py:function:: logit(utility: list, avail: list = None) Computes the Logit function, with availability conditions. :param utility: List of M utility equations. :type utility: list :param avail: List of M availability conditions. If no availabilities are :type avail: list :param provided: :param defaults to 1 for all availabilities.: :returns: A NxM matrix of probabilities. :rtype: TensorVariable .. py:function:: log_likelihood(prob, y) Symbolic representation of the log likelihood cost function. :param prob: Matrix describing the choice probabilites. :type prob: TensorVariable :param y: The ``TensorVariable`` referencing the choice column. :type y: TensorVariable :returns: a symbolic representation of the log likelihood with ndim=0. :rtype: TensorVariable .. py:function:: errors(prob, y) Symbolic representation of the prediction as a percentage error. :param prob: Matrix describing the choice probabilites. :type prob: TensorVariable :param y: The ``TensorVariable`` referencing the choice column. :type y: TensorVariable :raises TypeError: ``y`` should have the same shape as ``pred``. :raises NotImplementedError: ``y`` should be an ``int`` Type. :returns: a symbolic representation of the prediction error with ndim=0. :rtype: TensorVariable .. py:function:: hessians(ll, params) Symbolic representation of the Hessian matrix given the log likelihood. :param ll: the loglikelihood to compute the gradients over :type ll: TensorVariable :param params: list of params to compute the gradients over :type params: list :returns: the Hessian matrix with ndim=2 :rtype: TensorVariable .. note:: Parameters with status=1 are ignored. .. py:function:: bhhh(ll, params) Symbolic representation of the Berndt-Hall-Hall-Hausman (BHHH) algorithm given the log likelihood. :param ll: the loglikelihood to compute the gradients over :type ll: TensorVariable :param params: list of params to compute the gradients over :type params: list :returns: the outer product of the gradient with ndim=2 :rtype: TensorVariable .. note:: Parameters with status=1 are ignored. .. py:function:: gnorm(cost, params) Symbolic representation of the gradient norm given the cost. :param cost: the cost to compute the gradients over :type cost: TensorVariable :param params: list of params to compute the gradients over :type params: list :returns: the gradient norm value :rtype: TensorVariable .. note:: Parameters with status=1 are ignored.