def test_auto_init_opt_fssd(self):
    '\n        Test FSSD-opt test with automatic parameter initialization.\n        '
    seed = 5
    n = 191
    alpha = 0.01
    for d in [1, 4]:
        mean = np.zeros(d)
        variance = 1.0
        p = density.IsotropicNormal(mean, variance)
        ds = data.DSIsotropicNormal((mean + 4), (variance + 0))
        dat = ds.sample(n, seed=seed)
        for J in [1, 3]:
            opts = {'reg': 0.01, 'max_iter': 10, 'tol_fun': 0.001, 'disp': False}
            (tr, te) = dat.split_tr_te(tr_proportion=0.3, seed=(seed + 1))
            (V_opt, gw_opt, opt_result) = gof.GaussFSSD.optimize_auto_init(p, tr, J, **opts)
            k_opt = kernel.KGauss(gw_opt)
            null_sim = gof.FSSDH0SimCovObs(n_simulate=2000, seed=10)
            fssd_opt = gof.FSSD(p, k_opt, V_opt, null_sim=null_sim, alpha=alpha)
            fssd_opt_result = fssd_opt.perform_test(te, return_simulated_stats=True)
            assert fssd_opt_result['h0_rejected']
Test FSSD-opt test with automatic parameter initialization.
def test_auto_init_opt_fssd(self):
    '\n        \n        '
    seed = 5
    n = 191
    alpha = 0.01
    for d in [1, 4]:
        mean = np.zeros(d)
        variance = 1.0
        p = density.IsotropicNormal(mean, variance)
        ds = data.DSIsotropicNormal((mean + 4), (variance + 0))
        dat = ds.sample(n, seed=seed)
        for J in [1, 3]:
            opts = {'reg': 0.01, 'max_iter': 10, 'tol_fun': 0.001, 'disp': False}
            (tr, te) = dat.split_tr_te(tr_proportion=0.3, seed=(seed + 1))
            (V_opt, gw_opt, opt_result) = gof.GaussFSSD.optimize_auto_init(p, tr, J, **opts)
            k_opt = kernel.KGauss(gw_opt)
            null_sim = gof.FSSDH0SimCovObs(n_simulate=2000, seed=10)
            fssd_opt = gof.FSSD(p, k_opt, V_opt, null_sim=null_sim, alpha=alpha)
            fssd_opt_result = fssd_opt.perform_test(te, return_simulated_stats=True)
            assert fssd_opt_result['h0_rejected']