# Path: examples/context.py



import matplotlib
import numpy as np
import pdb
import matplotlib.pylab as plt
from scipy import special
from .context import vfe, compute_kernel, compute_psi_weave
            print "Training model %d" % i
            # model.set_fixed_params(['sn'])
            np.random.seed(i)
            model.optimise(method='L-BFGS-B', alpha=alpha, maxiter=5000)

    def predict_f(self, X_test, alpha, use_mean_only=True):
        N_test = X_test.shape[0]
        mf = np.zeros((N_test, self.Dout))
        vf = np.zeros((N_test, self.Dout))
        for i, model in enumerate(self.models):
            if i == 0:
                res = model.predict_f(X_test, alpha=alpha)
                mf[:, i], vf[:, i] = res[0][:, 0], res[1]
            else:
                if use_mean_only:
                    X_test_i = np.hstack(
                        (X_test, mf[:, :i].reshape((N_test, i))))
                    res = model.predict_f(X_test_i, alpha=alpha)
                    mf[:, i], vf[:, i] = res[0][:, 0], res[1]
                else:
                    mu, Su = model.predict_f(
                        model.zu, alpha=alpha, marginal=False)
                    m_X_test_i = np.hstack(
                        (X_test, mf[:, :i].reshape((N_test, i))))
                    v_X_test_i = np.hstack(
                        (np.zeros_like(X_test), vf[:, :i].reshape((N_test, i))))
                    res = self.forward_prop_random_thru_post_mm(
                        model, m_X_test_i, v_X_test_i, mu, Su)
                    mf[:, i], vf[:, i] = res[0][:, 0], res[1][:, 0]


# Path: examples/context.py



# Path: examples/gpr_autoreg_example.py
import matplotlib
import numpy as np
import pdb
import matplotlib.pylab as plt
from scipy import special
from .context import vfe, compute_kernel, compute_psi_weave

            print "Training model %d" % i
            # model.set_fixed_params(['sn'])
            np.random.seed(i)
            model.optimise(method='L-BFGS-B', alpha=alpha, maxiter=5000)

    def predict_f(self, X_test, alpha, use_mean_only=True):
        N_test = X_test.shape[0]
        mf = np.zeros((N_test, self.Dout))
        vf = np.zeros((N_test, self.Dout))
        for i, model in enumerate(self.models):
            if i == 0:
                res = model.predict_f(X_test, alpha=alpha)
                mf[:, i], vf[:, i] = res[0][:, 0], res[1]
            else:
                if use_mean_only:
                    X_test_i = np.hstack(
                        (X_test, mf[:, :i].reshape((N_test, i))))
                    res = model.predict_f(X_test_i, alpha=alpha)
                    mf[:, i], vf[:, i] = res[0][:, 0], res[1]
                else:
                    mu, Su = model.predict_f(
                        model.zu, alpha=alpha, marginal=False)
                    m_X_test_i = np.hstack(
                        (X_test, mf[:, :i].reshape((N_test, i))))
                    v_X_test_i = np.hstack(
                        (np.zeros_like(X_test), vf[:, :i].reshape((N_test, i))))
                    res = self.forward_prop_random_thru_post_mm(
                        model, m_X_test_i, v_X_test_i, mu, Su)
                    mf[:, i], vf[:, i] = res[0][:, 0], res[1][:, 0]


        return mf, vf