예제 #1
0
    def inverse_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
        InverseGamma distribution.

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

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

        :return: A :class:`StochasticTensor` instance.
        """
        dist = distributions.InverseGamma(alpha,
                                          beta,
                                          group_ndims=group_ndims,
                                          check_numerics=check_numerics,
                                          **kwargs)
        return self.stochastic(name, dist, n_samples=n_samples, **kwargs)
예제 #2
0
 def __init__(self,
              name,
              alpha,
              beta,
              n_samples=None,
              group_ndims=0,
              check_numerics=False,
              **kwargs):
     inv_gamma = distributions.InverseGamma(alpha,
                                            beta,
                                            group_ndims=group_ndims,
                                            check_numerics=check_numerics,
                                            **kwargs)
     super(InverseGamma, self).__init__(name, inv_gamma, n_samples)