(self, X_test)
return m, v
r"""
        Returns the predictive mean and variance of the objective function at
        the given test points.

        Parameters
        ----------
        X_test: np.ndarray (N, D)
            N input test points

        Returns
        ----------
        np.array(N,)
            predictive mean
        np.array(N,)
            predictive variance
r"""
        Returns the predictive mean and variance of the objective function at
        the given test points.
r Returns the predictive mean and variance of the objective function at the given test points .
def predict(self, X_test):
        r"""
        Returns the predictive mean and variance of the objective function at
        the given test points.

        Parameters
        ----------
        X_test: np.ndarray (N, D)
            N input test points

        Returns
        ----------
        np.array(N,)
            predictive mean
        np.array(N,)
            predictive variance

        """
        if self.basis_func is not None:
            X_transformed = self.basis_func(X_test)
        else:
            X_transformed = X_test
            
        # Marginalise predictions over hyperparameters
        mu = np.zeros([len(self.hypers), X_transformed.shape[0]])
        var = np.zeros([len(self.hypers), X_transformed.shape[0]])
    
        for i, h in enumerate(self.hypers):
            mu[i] = np.dot(self.models[i][0].T, X_transformed.T)
            var[i] = 1. / h[1] + np.diag(np.dot(np.dot(X_transformed, self.models[i][1]), X_transformed.T))

        m = mu.mean(axis=0)
        v = var.mean(axis=0)
        # Clip negative variances and set them to the smallest
        # positive float value
        if v.shape[0] == 1:
            v = np.clip(v, np.finfo(v.dtype).eps, np.inf)
        else:
            v = np.clip(v, np.finfo(v.dtype).eps, np.inf)
            v[np.where((v < np.finfo(v.dtype).eps) & (v > -np.finfo(v.dtype).eps))] = 0

        return m, v
def predict ( self , X_test ) : if self . basis_func is not None : X_transformed = self . basis_func ( X_test ) else : X_transformed = X_test # Marginalise predictions over hyperparameters mu = np . zeros ( [ len ( self . hypers ) , X_transformed . shape [ 0 ] ] ) var = np . zeros ( [ len ( self . hypers ) , X_transformed . shape [ 0 ] ] ) for i , h in enumerate ( self . hypers ) : mu [ i ] = np . dot ( self . models [ i ] [ 0 ] . T , X_transformed . T ) var [ i ] = 1. / h [ 1 ] + np . diag ( np . dot ( np . dot ( X_transformed , self . models [ i ] [ 1 ] ) , X_transformed . T ) ) m = mu . mean ( axis = 0 ) v = var . mean ( axis = 0 ) # Clip negative variances and set them to the smallest # positive float value if v . shape [ 0 ] == 1 : v = np . clip ( v , np . finfo ( v . dtype ) . eps , np . inf ) else : v = np . clip ( v , np . finfo ( v . dtype ) . eps , np . inf ) v [ np . where ( ( v < np . finfo ( v . dtype ) . eps ) & ( v > - np . finfo ( v . dtype ) . eps ) ) ] = 0 return m , v