# Path: geepee/config.py
# PROP_MC = 'MC'
# 
# PROP_MM = 'MM'


import matplotlib
import sys
import numpy as np
import scipy.stats
import matplotlib.pylab as plt
import os, sys
import geepee.aep_models as aep
import geepee.vfe_models as vfe
import geepee.ep_models as ep
import pdb
from geepee.config import PROP_MC, PROP_MM
    # ax.plot(x_test[:,0], kink_true(x_test[:,0]), '-', color='k')
    ax.plot(C*x_test[:,0], my[:,0], '-', color='r', label='y')
    ax.fill_between(
        C*x_test[:,0], 
        my[:,0] + 2*np.sqrt(vy[:, 0]), 
        my[:,0] - 2*np.sqrt(vy[:, 0]), 
        alpha=0.2, edgecolor='r', facecolor='r')
    # ax.plot(zu, mu, 'ob')
    # ax.errorbar(zu, mu, yerr=3*np.sqrt(vu), fmt='ob')
    # ax.plot(x_test[:,0], mf[:,0], '-', color='b')
    # ax.fill_between(
    #     x_test[:,0], 
    #     mf[:,0] + 2*np.sqrt(vf[:,0]), 
    #     mf[:,0] - 2*np.sqrt(vf[:,0]), 
    #     alpha=0.2, edgecolor='b', facecolor='b')
    ax.plot(
        y[0:model.N-1], 
        y[1:model.N], 
        'r+', alpha=0.5)
    mx, vx = model.get_posterior_x()
    ax.set_xlabel(r'$x_{t-1}$')
    ax.set_ylabel(r'$x_{t}$')
    ax.set_xlim([-4, 6])
    # ax.set_ylim([-7, 7])
    plt.title(plot_title)
    # plt.savefig('/tmp/kink_'+plot_title+'.pdf')
    plt.savefig('/tmp/kink_'+plot_title+'.png')

def plot_prediction_MM(model, y_train, y_test, plot_title=''):
    T = y_test.shape[0]

# Path: geepee/config.py
# PROP_MC = 'MC'
# 
# PROP_MM = 'MM'


# Path: exps/gpssm/kink_exp.py
import matplotlib
import sys
import numpy as np
import scipy.stats
import matplotlib.pylab as plt
import os, sys
import geepee.aep_models as aep
import geepee.vfe_models as vfe
import geepee.ep_models as ep
import pdb
from geepee.config import PROP_MC, PROP_MM

    # ax.plot(x_test[:,0], kink_true(x_test[:,0]), '-', color='k')
    ax.plot(C*x_test[:,0], my[:,0], '-', color='r', label='y')
    ax.fill_between(
        C*x_test[:,0], 
        my[:,0] + 2*np.sqrt(vy[:, 0]), 
        my[:,0] - 2*np.sqrt(vy[:, 0]), 
        alpha=0.2, edgecolor='r', facecolor='r')
    # ax.plot(zu, mu, 'ob')
    # ax.errorbar(zu, mu, yerr=3*np.sqrt(vu), fmt='ob')
    # ax.plot(x_test[:,0], mf[:,0], '-', color='b')
    # ax.fill_between(
    #     x_test[:,0], 
    #     mf[:,0] + 2*np.sqrt(vf[:,0]), 
    #     mf[:,0] - 2*np.sqrt(vf[:,0]), 
    #     alpha=0.2, edgecolor='b', facecolor='b')
    ax.plot(
        y[0:model.N-1], 
        y[1:model.N], 
        'r+', alpha=0.5)
    mx, vx = model.get_posterior_x()
    ax.set_xlabel(r'$x_{t-1}$')
    ax.set_ylabel(r'$x_{t}$')
    ax.set_xlim([-4, 6])
    # ax.set_ylim([-7, 7])
    plt.title(plot_title)
    # plt.savefig('/tmp/kink_'+plot_title+'.pdf')
    plt.savefig('/tmp/kink_'+plot_title+'.png')

def plot_prediction_MM(model, y_train, y_test, plot_title=''):
    T = y_test.shape[0]

    mx, vx, my, vy_noiseless, vy = model.predict_forward(T, prop_mode=PROP_MM)