Exemplo n.º 1
0
    def multinomial(self,
                    name,
                    logits,
                    n_experiments,
                    normalize_logits=True,
                    n_samples=None,
                    group_ndims=0,
                    dtype=tf.int32,
                    **kwargs):
        """
        Add a stochastic node in this :class:`BayesianNet` that follows the
        Multinomial distribution.

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

        See
        :class:`~zhusuan.distributions.multivariate.Multinomial`
        for more information about the other arguments.

        :return: A :class:`StochasticTensor` instance.
        """
        dist = distributions.Multinomial(logits,
                                         n_experiments,
                                         normalize_logits=normalize_logits,
                                         group_ndims=group_ndims,
                                         dtype=dtype,
                                         **kwargs)
        return self.stochastic(name, dist, n_samples=n_samples, **kwargs)
Exemplo n.º 2
0
 def __init__(self,
              name,
              logits,
              n_experiments,
              n_samples=None,
              group_event_ndims=0,
              dtype=None):
     multinomial = distributions.Multinomial(
         logits,
         n_experiments,
         group_event_ndims=group_event_ndims,
         dtype=dtype,
     )
     super(Multinomial, self).__init__(name, multinomial, n_samples)
Exemplo n.º 3
0
 def __init__(self,
              name,
              logits,
              n_experiments,
              normalize_logits=True,
              n_samples=None,
              group_ndims=0,
              dtype=None,
              **kwargs):
     multinomial = distributions.Multinomial(
         logits,
         n_experiments,
         normalize_logits=normalize_logits,
         group_ndims=group_ndims,
         dtype=dtype,
         **kwargs)
     super(Multinomial, self).__init__(name, multinomial, n_samples)