(self, Xnew, full_cov=False)
return fmean, fvar
Predict mean and variance of the GP at locations in Xnew.

        Parameters
        ----------
        Xnew : ndarray
            The points at which to evaluate the function. One row for each
            data points.
        full_cov : bool
            if False returns only the diagonal of the covariance matrix

        Returns
        -------
        mean : ndarray
            The expected function values at the points.
        error_bounds : ndarray
            Diagonal of the covariance matrix (or full matrix).
Predict mean and variance of the GP at locations in Xnew.
Predict mean and variance of the GP at locations in Xnew .
def build_predict(self, Xnew, full_cov=False):
        """Predict mean and variance of the GP at locations in Xnew.

        Parameters
        ----------
        Xnew : ndarray
            The points at which to evaluate the function. One row for each
            data points.
        full_cov : bool
            if False returns only the diagonal of the covariance matrix

        Returns
        -------
        mean : ndarray
            The expected function values at the points.
        error_bounds : ndarray
            Diagonal of the covariance matrix (or full matrix).

        """
        # Scaled kernel and mean
        Kx = (self._scale ** 2) * self.kern.K(self.X, Xnew)
        mx = self._scale * self.mean_function(Xnew)

        a = tf.matrix_triangular_solve(self.cholesky, Kx, lower=True)
        fmean = (tf.matmul(a, self.alpha, transpose_a=True) + mx)

        if full_cov:
            Knew = (self._scale ** 2) * self.kern.K(Xnew)
            fvar = Knew - tf.matmul(a, a, transpose_a=True)
            shape = tf.stack([1, 1, tf.shape(self.Y)[1]])
            fvar = tf.tile(tf.expand_dims(fvar, 2), shape)
        else:
            Knew = (self._scale ** 2) * self.kern.Kdiag(Xnew)
            fvar = Knew - tf.reduce_sum(tf.square(a), 0)
            fvar = tf.tile(tf.reshape(fvar, (-1, 1)), [1, tf.shape(self.Y)[1]])

        # Apply inverse-scaling to mean and variance before returning
        fmean /= self._scale
        fvar /= (self._scale ** 2)

        return fmean, fvar
def build_predict ( self , Xnew , full_cov = False ) : # Scaled kernel and mean Kx = ( self . _scale ** 2 ) * self . kern . K ( self . X , Xnew ) mx = self . _scale * self . mean_function ( Xnew ) a = tf . matrix_triangular_solve ( self . cholesky , Kx , lower = True ) fmean = ( tf . matmul ( a , self . alpha , transpose_a = True ) + mx ) if full_cov : Knew = ( self . _scale ** 2 ) * self . kern . K ( Xnew ) fvar = Knew - tf . matmul ( a , a , transpose_a = True ) shape = tf . stack ( [ 1 , 1 , tf . shape ( self . Y ) [ 1 ] ] ) fvar = tf . tile ( tf . expand_dims ( fvar , 2 ) , shape ) else : Knew = ( self . _scale ** 2 ) * self . kern . Kdiag ( Xnew ) fvar = Knew - tf . reduce_sum ( tf . square ( a ) , 0 ) fvar = tf . tile ( tf . reshape ( fvar , ( - 1 , 1 ) ) , [ 1 , tf . shape ( self . Y ) [ 1 ] ] ) # Apply inverse-scaling to mean and variance before returning fmean /= self . _scale fvar /= ( self . _scale ** 2 ) return fmean , fvar