def predict(self, X_test, f_mode=None):
        if f_mode is None:
            f_mode=self.find_mode_newton()
            
        predictions=zeros(len(X_test))    
        
        K = self.gp.K
        K_train_test=self.gp.covariance.compute(self.gp.X, X_test)
        
        w = -self.gp.likelihood.log_lik_hessian_vector(self.gp.y, f_mode)
        w_sqrt = sqrt(w)
        
        # diag(w_sqrt).dot(K.dot(diag(w_sqrt))) == (K.T*w_sqrt).T*w_sqrt
        L = cholesky(eye(len(K)) + (K.T * w_sqrt).T * w_sqrt)

        # iterator for all testing points
        for i in range(len(X_test)):
            k=K_train_test[:,i]
            k_self=self.gp.covariance.compute([X_test[i]], [X_test[i]])[0]
            
            f_mean=k.dot(self.gp.likelihood.log_lik_grad_vector(self.gp.y, f_mode))
            v=solve_triangular(L, w_sqrt*k, lower=True)
            f_var=k_self-v.T.dot(v)
            
            predictions[i]=integrate.quad(lambda x:norm.pdf(x, f_mean, f_var), -inf, inf)[0]
#            # integrate over Gaussian using some crude numerical integration
#            samples=randn(1000)*sqrt(f_var) + f_mean
#            
#            log_liks=self.gp.likelihood.log_lik_vector(1.0, samples)
#            predictions[i]=1.0/len(samples)*GPTools.log_sum_exp(log_liks)
            
            
        return predictions
Makes a variable available everywhere within the scope of the current suite.
dataset/ETHPy150Open karlnapf/kameleon-mcmc/kameleon_mcmc/gp/inference/LaplaceApproximation.py/LaplaceApproximation.predict--crossover with--dataset/ETHPy150Open shellderp/sublime-robot-plugin/lib/robot/libraries/BuiltIn.py/_Variables.set_suite_variable