<jupyter_start><jupyter_text>Choose sampler type (currently only ULA is maintained)<jupyter_code>d = 2
mu = 0.5*np.ones(d,dtype = float)
#mu_1 = np.array([-1.0])
#mu_2 = np.array([1.0])
#Sigma_1 = np.array([[1.0]])
#Sigma_2 = np.array([[1.0]])
Sigma = GenerateSigma(d,rand_seed = 778,eps = 0.1) #covariance matrix 
p = 0.5
Cur_pot = GausMixtureSame(Sigma,mu,p)
#Cur_pot = GaussMixture(Sigma_1,Sigma_2,mu_1,mu_2,p)
#Cur_pot = GausMixtureIdent(mu,p)
r_seed = 777
x0 = np.array([0.0,0.0])
fixed_start = True
bn = int(np.sqrt(N_train))
W_test = construct_Tukey_Hanning(N_train,bn)<jupyter_output>[0.44449977 3.48642106]<jupyter_text>Generate data<jupyter_code>sampler = {"sampler":"RWM","burn_type":"full","main_type":"full"} # Sampling method

if sampler["sampler"] == "ULA":
    res = Generate_train(n_traj, sampler, Cur_pot, step, N_burn, N_train, d)
    res = np.asarray(res)
    traj,traj_grad = res[:,0,:,:],res[:,1,:,:]
else:
    res = Generate_train(n_traj, sampler, Cur_pot, step, N_burn, N_train, d)
    traj = []
    traj_grad = []
    for i in range(len(res)):
        traj.append(res[i][0])
        traj_grad.append(res[i][1])
        print("accepted = ",res[i][2])
    traj = np.asarray(traj)
    traj_grad = np.asarray(traj_grad)
print(traj.shape)
print(traj_grad.shape)
traj_grad = (-1)*traj_grad
test_seed = 1453
nbcores = multiprocessing.cpu_count()
f_type = "sum_comps"
params = {"ind":0}
trav = Pool(nbcores)
res = trav.starmap(Eval_ZVCV, [(traj[i,:,:],traj_grad[i,:,:],f_type,params,W_test) for i in range (n_traj)])
trav.close()
res_arr = np.asarray(res)
print(res_arr.shape)<jupyter_output>(100, 2, 5)<jupyter_text>VR rates<jupyter_code>#np.save("results/gmm/RWM_quadratic_d_2_mu_05_sigma_mixed_gamma_01_25_06.npy",res_arr)
print("Average vr rates:")
print("ZV-1:",np.mean(res_arr[:,1,0]/res_arr[:,1,1]))
print("CV-1:",np.mean(res_arr[:,1,0]/res_arr[:,1,3]))
print("ZV-2:",np.mean(res_arr[:,1,0]/res_arr[:,1,2]))
print("CV-2:",np.mean(res_arr[:,1,0]/res_arr[:,1,4]))<jupyter_output>Average vr rates:
ZV-1: 99.95102914390111
CV-1: 94.96178465582898
ZV-2: 100.34237344327323
CV-2: 105.14962348741602<jupyter_text>Comparison plots<jupyter_code>title = ""
labels = ['Vanilla\n RWM', 'RWM \nwith ZV-1', 'RWM \nwith CV-1']
data = [res_arr[:,0,0],res_arr[:,0,1],res_arr[:,0,3]] 
boxplot_ind(data, title, labels, path = "results/gmm/rwm_mixed_1.pdf")
title = ""
labels = ['Vanilla\n RWM', 'RWM \nwith ZV-2', 'RWM \nwith CV-2']
data = [res_arr[:,0,0],res_arr[:,0,2],res_arr[:,0,4]] 
boxplot_ind(data, title, labels, path = "results/gmm/rwm_mixed_2.pdf")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.20285383725414577, 'fraction_numerical': 0.07134593135364442, 'mean_word_length': 6.327683615819209, 'pattern_counts': {'":': 5, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '141747', 'license': 'MIT', 'n_tokens_mistral': 1278, 'n_tokens_neox': 1202, 'n_words': 167, 'path': 'Code/Gaussian_Mixture_CV.ipynb', 'repo_name': 'svsamsonov/VR-MCMC', 'size': '2593'}