# 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
from .context import flatten_dict, unflatten_dict
from .context import PROP_MC, PROP_MM
from test_utils import kink, check_grad
matplotlib.use('Agg')


np.random.seed(42)
        
def test_gplvm_vfe_gaussian(nat_param=True, stoc=False, prop_mode=PROP_MM):
    N_train = 10
    M = 5
    D = 2
    Q = 3
    y_train = np.random.randn(N_train, Q)
    lvm = vfe.SGPLVM(y_train, D, M, lik='Gaussian', nat_param=nat_param)
    params = lvm.init_hypers(y_train)
    print 'gplvm vfe gaussian nat_param %r stoc %r prop_mode %s' % (nat_param, stoc, prop_mode)
    check_grad(params, lvm, stochastic=stoc, prop_mode=prop_mode)



# Path: tests/context.py

# 
# Path: tests/context.py

# 
# Path: tests/context.py



# Path: tests/test_grads_vfe.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
from .context import flatten_dict, unflatten_dict
from .context import PROP_MC, PROP_MM
from test_utils import kink, check_grad

matplotlib.use('Agg')


np.random.seed(42)
        
def test_gplvm_vfe_gaussian(nat_param=True, stoc=False, prop_mode=PROP_MM):
    N_train = 10
    M = 5
    D = 2
    Q = 3
    y_train = np.random.randn(N_train, Q)
    lvm = vfe.SGPLVM(y_train, D, M, lik='Gaussian', nat_param=nat_param)
    params = lvm.init_hypers(y_train)
    print 'gplvm vfe gaussian nat_param %r stoc %r prop_mode %s' % (nat_param, stoc, prop_mode)
    check_grad(params, lvm, stochastic=stoc, prop_mode=prop_mode)



def test_gplvm_vfe_probit(nat_param=False, stoc=False, prop_mode=PROP_MM):