# 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
            mf, vf = model.predict_f(xx, alpha, use_mean_only=True)

        colors = ['r', 'b']
        plt.figure()
        for i in range(model.Dout):
            plt.subplot(model.Dout, 1, i + 1)
            plt.plot(X, Y[:, i], 'x', color=colors[i], mew=2)
            zu = model.models[i].zu
            mean_u, var_u = model.models[i].predict_f(zu, alpha)
            plt.plot(xx, mf[:, i], '-', color=colors[i], lw=2)
            plt.fill_between(
                xx[:, 0],
                mf[:, i] - 2 * np.sqrt(vf[:, i]),
                mf[:, i] + 2 * np.sqrt(vf[:, i]),
                color=colors[i], alpha=0.3)
            # plt.errorbar(zu[:, 0], mean_u, yerr=2*np.sqrt(var_u), fmt='ro')
            plt.xlim(-1.2, 1.2)
        plt.savefig(fname)

    # inference
    print "create independent output model and optimize ..."
    M = N
    alpha = 0.01
    indep_model = IndepSGPR(X, Y, M)
    indep_model.train(alpha=alpha)
    plot(indep_model, alpha, '/tmp/reg_indep_multioutput.pdf')

    print "create correlated output model and optimize ..."
    M = N
    ar_model = AutoSGPR(X, Y, M)

# 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

            mf, vf = model.predict_f(xx, alpha, use_mean_only=True)

        colors = ['r', 'b']
        plt.figure()
        for i in range(model.Dout):
            plt.subplot(model.Dout, 1, i + 1)
            plt.plot(X, Y[:, i], 'x', color=colors[i], mew=2)
            zu = model.models[i].zu
            mean_u, var_u = model.models[i].predict_f(zu, alpha)
            plt.plot(xx, mf[:, i], '-', color=colors[i], lw=2)
            plt.fill_between(
                xx[:, 0],
                mf[:, i] - 2 * np.sqrt(vf[:, i]),
                mf[:, i] + 2 * np.sqrt(vf[:, i]),
                color=colors[i], alpha=0.3)
            # plt.errorbar(zu[:, 0], mean_u, yerr=2*np.sqrt(var_u), fmt='ro')
            plt.xlim(-1.2, 1.2)
        plt.savefig(fname)

    # inference
    print "create independent output model and optimize ..."
    M = N
    alpha = 0.01
    indep_model = IndepSGPR(X, Y, M)
    indep_model.train(alpha=alpha)
    plot(indep_model, alpha, '/tmp/reg_indep_multioutput.pdf')

    print "create correlated output model and optimize ..."
    M = N
    ar_model = AutoSGPR(X, Y, M)

    ar_model.train(alpha=alpha)