In [ ]:
%load_ext autoreload
%autoreload 2
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import freqopttest.util as util
import freqopttest.data as data
import freqopttest.kernel as kernel
import freqopttest.tst as tst
import freqopttest.glo as glo
import sys

In [ ]:
# sample source 
m = 500
dim = 2
n = m
ss = data.SSGaussMeanDiff(dim, my=3.5)
tst_data = ss.sample(m, seed=2)
tr, te = tst_data.split_tr_te(tr_proportion=0.5, seed=10)

In [ ]:
# Gamma MMD test 
alpha = 0.01
sig2 = util.meddistance(te.stack_xy())
ker = kernel.KGauss(sig2)
gam_test = tst.GammaMMDKGaussTest(sig2, alpha=alpha)

In [ ]:
gam_test.perform_test(te)

grid search for the best Gaussian width


In [ ]:
#med = util.meddistance(tr.stack_xy())
#list_gwidth2 = (med*(2.0**np.linspace(-5, 5, 11)))**2
#tst.GammaMMDKGaussTest.grid_search_gwidth2(tr, list_gwidth2, alpha)

In [ ]: