Esempio n. 1
0
def moyenneMMD_MC(methodeMMD,
                  kernel,
                  law_p,
                  law_q,
                  m,
                  n,
                  repeat=100,
                  verbose=1):
    mmd_list = np.zeros(repeat)
    for i in range(repeat):
        if verbose > 0:
            print(i / repeat * 100, '% achevé', end='\r', flush=True)
        X_ = law_p(m)
        Y_ = law_q(n)
        MMD = methodeMMD(kernel)
        MMD.fit(Y_, X_)
        mmd_list[i] = MMD.MMD
    return mmd_list.mean()
Esempio n. 2
0
def moyenneMMD_Bt(methodeMMD,
                  kernel,
                  X,
                  Y,
                  n_boot,
                  m_boot,
                  repeat=100,
                  verbose=1):
    mmd_list = np.zeros(repeat)
    for i in range(repeat):
        if verbose > 0:
            print(i / repeat * 100, '% achevé', end='\r', flush=True)
        X_ = utils.bootstrap(X, m_boot)
        Y_ = utils.bootstrap(Y, n_boot)
        MMD = methodeMMD(kernel)
        MMD.fit(Y_, X_)
        mmd_list[i] = MMD.MMD
    return mmd_list.mean()
Esempio n. 3
0
def sampleMMD_MC(methodeMMD,
                 kernel,
                 law_p,
                 law_q,
                 m,
                 n,
                 finalSampleSize=1000,
                 verbose=1):

    Liste_mmdl = []
    for _ in range(finalSampleSize):
        if verbose > 0:
            print(_ / finalSampleSize * 100, '% achevé', end='\r', flush=True)
        X = law_p(m)
        Y = law_q(n)

        MMD = methodeMMD(kernel)
        MMD.fit(Y, X)
        Liste_mmdl.append(MMD.MMD)

    return np.r_[Liste_mmdl]