Exemple #1
0
    def fold_normal(self,
                    name,
                    mean=0.,
                    _sentinel=None,
                    std=None,
                    logstd=None,
                    n_samples=None,
                    group_ndims=0,
                    is_reparameterized=True,
                    check_numerics=False,
                    **kwargs):
        """
        Add a stochastic node in this :class:`BayesianNet` that follows the
        FoldNormal distribution.

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

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

        :return: A :class:`StochasticTensor` instance.
        """
        dist = distributions.FoldNormal(mean,
                                        _sentinel=_sentinel,
                                        std=std,
                                        logstd=logstd,
                                        group_ndims=group_ndims,
                                        is_reparameterized=is_reparameterized,
                                        check_numerics=check_numerics,
                                        **kwargs)
        return self.stochastic(name, dist, n_samples=n_samples, **kwargs)
Exemple #2
0
 def __init__(self,
              name,
              mean=0.,
              logstd=None,
              std=None,
              n_samples=None,
              group_ndims=0,
              is_reparameterized=True,
              check_numerics=False,
              **kwargs):
     norm = distributions.FoldNormal(mean,
                                     logstd=logstd,
                                     std=std,
                                     group_ndims=group_ndims,
                                     is_reparameterized=is_reparameterized,
                                     check_numerics=check_numerics,
                                     **kwargs)
     super(FoldNormal, self).__init__(name, norm, n_samples)