# Path: tests/context.py

# 
# Path: tests/context.py

# 
# Path: tests/context.py



import numpy as np
import copy
import pdb
import os
import time
import matplotlib
import matplotlib.pylab as plt
from scipy.optimize import check_grad
from .context import vfe, aep
from .context import flatten_dict, unflatten_dict
from .context import PROP_MC, PROP_MM
    d = np.abs(logZ_aep - logZ_vfe)
    print 'gpr gaussian aep %.4f, vfe %.4f, diff %.4f' % (logZ_aep, logZ_vfe, d)   


def test_gpr_probit(nat_param=True):
    N_train = 5
    alpha = 0.000001
    M = 3
    D = 2
    Q = 3
    x_train = np.random.randn(N_train, D)
    y_train = 2 * np.random.randint(0, 2, size=(N_train, Q)) - 1
    model_vfe = vfe.SGPR(x_train, y_train, M, lik='Probit', nat_param=nat_param)
    params = model_vfe.init_hypers(y_train)
    logZ_vfe, _ = model_vfe.objective_function(params, N_train)

    model_aep = aep.SGPR(x_train, y_train, M, lik='Probit', nat_param=nat_param)
    logZ_aep, _ = model_aep.objective_function(params, N_train, alpha=alpha)

    d = np.abs(logZ_aep - logZ_vfe)
    print 'gpr probit aep %.4f, vfe %.4f, diff %.4f' % (logZ_aep, logZ_vfe, d)


def test_gplvm_gaussian(nat_param=True):
    N_train = 5
    alpha = 0.000001
    M = 4
    D = 2
    Q = 3
    y_train = np.random.randn(N_train, Q)

# Path: tests/context.py

# 
# Path: tests/context.py

# 
# Path: tests/context.py



# Path: tests/test_aep_vfe_limits.py
import numpy as np
import copy
import pdb
import os
import time
import matplotlib
import matplotlib.pylab as plt
from scipy.optimize import check_grad
from .context import vfe, aep
from .context import flatten_dict, unflatten_dict
from .context import PROP_MC, PROP_MM

    d = np.abs(logZ_aep - logZ_vfe)
    print 'gpr gaussian aep %.4f, vfe %.4f, diff %.4f' % (logZ_aep, logZ_vfe, d)   


def test_gpr_probit(nat_param=True):
    N_train = 5
    alpha = 0.000001
    M = 3
    D = 2
    Q = 3
    x_train = np.random.randn(N_train, D)
    y_train = 2 * np.random.randint(0, 2, size=(N_train, Q)) - 1
    model_vfe = vfe.SGPR(x_train, y_train, M, lik='Probit', nat_param=nat_param)
    params = model_vfe.init_hypers(y_train)
    logZ_vfe, _ = model_vfe.objective_function(params, N_train)

    model_aep = aep.SGPR(x_train, y_train, M, lik='Probit', nat_param=nat_param)
    logZ_aep, _ = model_aep.objective_function(params, N_train, alpha=alpha)

    d = np.abs(logZ_aep - logZ_vfe)
    print 'gpr probit aep %.4f, vfe %.4f, diff %.4f' % (logZ_aep, logZ_vfe, d)


def test_gplvm_gaussian(nat_param=True):
    N_train = 5
    alpha = 0.000001
    M = 4
    D = 2
    Q = 3
    y_train = np.random.randn(N_train, Q)

    model_vfe = vfe.SGPLVM(y_train, D, M, lik='Gaussian', nat_param=nat_param)