Esempio n. 1
0
    def gamma(self,
              name,
              alpha,
              beta,
              n_samples=None,
              group_ndims=0,
              check_numerics=False,
              **kwargs):
        """
        Add a stochastic node in this :class:`BayesianNet` that follows the
        Gamma distribution.

        :param name: The name of the stochastic node. Must be unique in a
            :class:`BayesianNet`.

        See
        :class:`~zhusuan.distributions.univariate.Gamma` for more information
        about the other arguments.

        :return: A :class:`StochasticTensor` instance.
        """
        dist = distributions.Gamma(alpha,
                                   beta,
                                   group_ndims=group_ndims,
                                   check_numerics=check_numerics,
                                   **kwargs)
        return self.stochastic(name, dist, n_samples=n_samples, **kwargs)
Esempio n. 2
0
 def __init__(self,
              name,
              alpha,
              beta,
              n_samples=None,
              group_event_ndims=0,
              check_numerics=False):
     gamma = distributions.Gamma(alpha,
                                 beta,
                                 group_event_ndims=group_event_ndims,
                                 check_numerics=check_numerics)
     super(Gamma, self).__init__(name, gamma, n_samples)