<jupyter_start><jupyter_text>Sample discretized diffusion<jupyter_code>x0 = 5*np.array([1.0,1.0],dtype = float)
r_seed = 1812
X_train, noise_train = generate_traj(x0,n,gamma,r_seed,d,cov)
#set target function
Y_train = np.sum(X_train**2,axis=1)
X_train = X_train.reshape((1,-1,d))
Y_train = Y_train.reshape((1,-1,1))<jupyter_output><empty_output><jupyter_text>Bernoulli:: Optimize coefficients by solving regression with polynomial features<jupyter_code>#polynomial coefficients
coefs_poly = approx_q(X_train,Y_train,n_traj,lag,S_max)
#print(coefs_poly.shape)
print(coefs_poly)
regr_vals = np.zeros((lag,X_train.shape[1]),dtype=float)
features = np.zeros((X_train.shape[1],6),dtype=float)
features[:,0] = 1.0
features[:,1:3] = X_train[0,:,:]
features[:,3] = X_train[0,:,0]**2 
features[:,4] = X_train[0,:,0]*X_train[0,:,1]
features[:,5] = X_train[0,:,1]**2
for i in range(len(regr_vals)):
    regr_vals[i,:] = np.sum(coefs_poly[i,:]*features,axis=1)<jupyter_output><empty_output><jupyter_text>Test our regressors<jupyter_code>cur_lag = 1
N_pts = 500
plt.figure(figsize=(10, 10))
plt.title("Testing regression model",fontsize=20)
plt.plot(Y_train[0,cur_lag:N_pts+cur_lag,0],color='r',label='true function')
plt.plot(regr_vals[cur_lag,:N_pts],color='g',label = 'practical approximation')
plt.legend(loc = 'upper left',fontsize = 16)
plt.show()
test_seed = 1453
nbcores = multiprocessing.cpu_count()
trav = Pool(nbcores)
res = trav.starmap(test_traj, [(coefs_poly,gamma,test_seed+i,lag,d,cov,N_test,x0) for i in range (n_traj_test)])
#res = trav.starmap(test_traj, [(Cur_pot,coefs_poly,step,test_seed+i,lag,K_max,S_max,N_burn,N_test,d,f_type,inds_arr,params,x0,fixed_start) for i in range (n_traj_test)])
trav.close()
res_new = np.asarray(res)
print(res_new.shape)<jupyter_output><empty_output><jupyter_text>Comparison plots<jupyter_code>title = ""
labels = ['Vanilla\n Euler scheme', 'Euler scheme \nwith MDCV-1']
#labels = ['Vanilla\n ULA', 'ULA \nwith MDCV-1', 'ULA \nwith MDCV-2']
data = [res_new[:,0],res_new[:,1]]#,res_new[:,2]] 
boxplot_ind(data, title, labels,path="./2d_diffusion_quadratic.pdf")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18066635382449553, 'fraction_numerical': 0.031909901454716096, 'mean_word_length': 9.82233502538071, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '542668', 'license': 'MIT', 'n_tokens_mistral': 966, 'n_tokens_neox': 926, 'n_words': 121, 'path': 'Code/Cox_Ross_discretized_multidimensional.ipynb', 'repo_name': 'svsamsonov/VR-MCMC', 'size': '2131'}