# Path: examples/context.py



import itertools
import numpy as np
import scipy.stats
import matplotlib.pylab as plt
import pdb
from .context import ep
    C = 1 * np.ones((1, 1))
    R = np.ones(1) * np.log(obs_noise) / 2
    lls = np.reshape(np.log(2), [Dlatent, ])
    lsf = np.reshape(np.log(2), [1, ])
    zu = np.linspace(-7, 7, M)
    zu = np.reshape(zu, [M, 1])
    lsn = np.log(process_noise) / 2
    params = {'ls': lls, 'sf': lsf, 'sn': lsn, 'R': R, 'C': C, 'zu': zu}

    # create model
    model = ep.SGPSSM(y_train, Dlatent, M,
                      lik='Gaussian', prior_mean=0, prior_var=1)
    # update hypers
    model.update_hypers(params)
    # run EP
    model.inference(no_epochs=30, alpha=alpha, parallel=True, decay=0.99)

    # make prediction on some test inputs
    N_test = 200
    x_test = np.linspace(-7, 8, N_test)
    x_test = np.reshape(x_test, [N_test, 1])
    mf, vf = model.predict_f(x_test)

    # plot function
    fig = plt.figure()
    ax = fig.add_subplot(111)
    ax.plot(x_test[:, 0], kink_true(x_test[:, 0]), '-', color='k')
    ax.plot(x_test[:, 0], mf[:, 0],
            '-', color='b', label='alpha=%.2f' % alpha)
    ax.fill_between(

# Path: examples/context.py



# Path: examples/gpssm_ep_examples.py
import itertools
import numpy as np
import scipy.stats
import matplotlib.pylab as plt
import pdb
from .context import ep

    C = 1 * np.ones((1, 1))
    R = np.ones(1) * np.log(obs_noise) / 2
    lls = np.reshape(np.log(2), [Dlatent, ])
    lsf = np.reshape(np.log(2), [1, ])
    zu = np.linspace(-7, 7, M)
    zu = np.reshape(zu, [M, 1])
    lsn = np.log(process_noise) / 2
    params = {'ls': lls, 'sf': lsf, 'sn': lsn, 'R': R, 'C': C, 'zu': zu}

    # create model
    model = ep.SGPSSM(y_train, Dlatent, M,
                      lik='Gaussian', prior_mean=0, prior_var=1)
    # update hypers
    model.update_hypers(params)
    # run EP
    model.inference(no_epochs=30, alpha=alpha, parallel=True, decay=0.99)

    # make prediction on some test inputs
    N_test = 200
    x_test = np.linspace(-7, 8, N_test)
    x_test = np.reshape(x_test, [N_test, 1])
    mf, vf = model.predict_f(x_test)

    # plot function
    fig = plt.figure()
    ax = fig.add_subplot(111)
    ax.plot(x_test[:, 0], kink_true(x_test[:, 0]), '-', color='k')
    ax.plot(x_test[:, 0], mf[:, 0],
            '-', color='b', label='alpha=%.2f' % alpha)
    ax.fill_between(

        x_test[:, 0],