# 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
        psi1, psi2 = compute_psi_weave(
            2 * model.ls, 2 * model.sf, mx, vx, model.zu)
        mout = np.einsum('nm,md->nd', psi1, A)
        Bpsi2 = np.einsum('ab,nab->n', B_sto, psi2)[:, np.newaxis]
        vout = psi0 + Bpsi2 - mout**2
        return mout, vout


class IndepSGPR(object):

    def __init__(self, X_train, Y_train, M):
        self.N_train = Y_train.shape[0]
        self.Dout = Y_train.shape[1]
        self.Din = Y_train.shape[1]
        self.M = M
        models = []
        for i in range(self.Dout):
            X_train_i = X_train
            y_train_i = Y_train[:, [i]]
            model_i = vfe.SGPR(X_train_i, y_train_i, M)
            models.append(model_i)
        self.models = models

    def train(self, alpha=0.5):
        for i, model in enumerate(self.models):
            print "Training model %d" % i
            # model.set_fixed_params(['sn'])
            np.random.seed(i)
            model.optimise(method='L-BFGS-B', alpha=alpha, maxiter=5000)


# 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

        psi1, psi2 = compute_psi_weave(
            2 * model.ls, 2 * model.sf, mx, vx, model.zu)
        mout = np.einsum('nm,md->nd', psi1, A)
        Bpsi2 = np.einsum('ab,nab->n', B_sto, psi2)[:, np.newaxis]
        vout = psi0 + Bpsi2 - mout**2
        return mout, vout


class IndepSGPR(object):

    def __init__(self, X_train, Y_train, M):
        self.N_train = Y_train.shape[0]
        self.Dout = Y_train.shape[1]
        self.Din = Y_train.shape[1]
        self.M = M
        models = []
        for i in range(self.Dout):
            X_train_i = X_train
            y_train_i = Y_train[:, [i]]
            model_i = vfe.SGPR(X_train_i, y_train_i, M)
            models.append(model_i)
        self.models = models

    def train(self, alpha=0.5):
        for i, model in enumerate(self.models):
            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):