Пример #1
0
    def conditional(self, name, Xnew, jitter=0.0, **kwargs):
        R"""
        Returns the conditional distribution evaluated over new input
        locations `Xnew`.

        Given a set of function values `f` that
        the TP prior was over, the conditional distribution over a
        set of new points, `f_*` is

        Parameters
        ----------
        name: string
            Name of the random variable
        Xnew: array-like
            Function input values.
        jitter: scalar
            A small correction added to the diagonal of positive semi-definite
            covariance matrices to ensure numerical stability.  For conditionals
            the default value is 0.0.
        **kwargs
            Extra keyword arguments that are passed to `MvNormal` distribution
            constructor.
        """

        X = self.X
        f = self.f
        nu2, mu, cov = self._build_conditional(Xnew, X, f, jitter)
        return pm.MvStudentT(name, nu=nu2, mu=mu, cov=cov, **kwargs)
Пример #2
0
    def conditional(self, name, Xnew, **kwargs):
        R"""
        Returns the conditional distribution evaluated over new input
        locations `Xnew`.

        Given a set of function values `f` that
        the TP prior was over, the conditional distribution over a
        set of new points, `f_*` is

        Parameters
        ----------
        name: string
            Name of the random variable
        Xnew: array-like
            Function input values.
        **kwargs
            Extra keyword arguments that are passed to `MvNormal` distribution
            constructor.
        """

        X = self.X
        f = self.f
        nu2, mu, cov = self._build_conditional(Xnew, X, f)
        shape = infer_shape(Xnew, kwargs.pop("shape", None))
        return pm.MvStudentT(name, nu=nu2, mu=mu, cov=cov, size=shape, **kwargs)
Пример #3
0
 def _build_prior(self, name, X, reparameterize=True, jitter=JITTER_DEFAULT, **kwargs):
     mu = self.mean_func(X)
     cov = stabilize(self.cov_func(X), jitter)
     if reparameterize:
         size = infer_size(X, kwargs.pop("size", None))
         v = pm.StudentT(name + "_rotated_", mu=0.0, sigma=1.0, nu=self.nu, size=size, **kwargs)
         f = pm.Deterministic(name, mu + cholesky(cov).dot(v))
     else:
         f = pm.MvStudentT(name, nu=self.nu, mu=mu, cov=cov, **kwargs)
     return f
Пример #4
0
 def _build_prior(self, name, X, reparameterize=True, **kwargs):
     mu = self.mean_func(X)
     cov = stabilize(self.cov_func(X))
     shape = infer_shape(X, kwargs.pop("shape", None))
     if reparameterize:
         chi2 = pm.ChiSquared(name + "_chi2_", self.nu)
         v = pm.Normal(name + "_rotated_", mu=0.0, sigma=1.0, size=shape, **kwargs)
         f = pm.Deterministic(name, (at.sqrt(self.nu) / chi2) * (mu + cholesky(cov).dot(v)))
     else:
         f = pm.MvStudentT(name, nu=self.nu, mu=mu, cov=cov, size=shape, **kwargs)
     return f