# --------------------------------------------------------------------------- # initialization pf_line_list = [] b_line_list = [] cov_line_list = [] legend_list = [] cov_at_pf_array_cs = np.zeros(n_sigma, float) pf_mean_array_cs = np.zeros(n_sigma, float) cov_at_pf_array_mmh = np.zeros(n_sigma, float) pf_mean_array_mmh = np.zeros(n_sigma, float) # conditional sampling for i in range(0, n_sigma): b_line_mp, pf_line_list_mp = uutil.get_pf_line_and_b_line_from_MP( g_list_list_cs[i], n_initial_samples) pf_line_mean_mp, pf_line_cov_mp = uutil.get_mean_and_cov_from_pf_lines( pf_line_list_mp) b_line_list.append(b_line_mp) pf_line_list.append(pf_line_mean_mp) cov_line_list.append(pf_line_cov_mp) legend_list.append(r'MP') cov_at_pf_array_cs[i] = pf_line_cov_mp[0] pf_mean_array_cs[i] = pf_line_mean_mp[0] # modified metropolis hastings for i in range(0, n_sigma): b_line_mp, pf_line_list_mp = uutil.get_pf_line_and_b_line_from_MP( g_list_list_mmh[i], n_initial_samples) pf_line_mean_mp, pf_line_cov_mp = uutil.get_mean_and_cov_from_pf_lines(
# --------------------------------------------------------------------------- # POST-PROCESSING # --------------------------------------------------------------------------- b_line_analytical = np.linspace(0, 7, 100) pf_line_analytical = analytical_CDF(b_line_analytical) b_line_mcs, pf_line_mcs = uutil.get_pf_line_and_b_line_from_MCS(g_list_mcs) b_line_sus, pf_line_list_sus = uutil.get_pf_line_and_b_line_from_SUS( g_list_sus, p0, n_samples_per_level) pf_line_mean_sus, pf_line_cov_sus = uutil.get_mean_and_cov_from_pf_lines( pf_line_list_sus) b_line_mp, pf_line_list_mp = uutil.get_pf_line_and_b_line_from_MP( g_list_mp, n_initial_samples) pf_line_mean_mp, pf_line_cov_mp = uutil.get_mean_and_cov_from_pf_lines( pf_line_list_mp) b_line_mp2, pf_line_list_mp2 = uutil.get_pf_line_and_b_line_from_MP( g_list_mp_wSeedSel, n_initial_samples) pf_line_mean_mp2, pf_line_cov_mp2 = uutil.get_mean_and_cov_from_pf_lines( pf_line_list_mp2) # initialization b_line_list = [] pf_line_list = [] cov_line_list = [] legend_list = [] b_line_list.append(b_line_analytical)
cov_at_pf_array_sss2 = np.zeros(len(nsamples_list), float) pf_mean_array_sss2 = np.zeros(len(nsamples_list), float) cov_at_pf_array_sss3 = np.zeros(len(nsamples_list), float) pf_mean_array_sss3 = np.zeros(len(nsamples_list), float) cov_at_pf_array_sss4 = np.zeros(len(nsamples_list), float) pf_mean_array_sss4 = np.zeros(len(nsamples_list), float) cov_at_pf_array_sss5 = np.zeros(len(nsamples_list), float) pf_mean_array_sss5 = np.zeros(len(nsamples_list), float) # seed selection stragegy 0 for i in range(0, len(nsamples_list)): N = nsamples_list[i] b_line_mp, pf_line_list_mp = uutil.get_pf_line_and_b_line_from_MP( g_list_list_sss0[i], N) pf_line_mean_mp, pf_line_cov_mp = uutil.get_mean_and_cov_from_pf_lines( pf_line_list_mp) cov_at_pf_array_sss0[i] = pf_line_cov_mp[0] pf_mean_array_sss0[i] = pf_line_mean_mp[0] # seed selection strategy 1 for i in range(0, len(nsamples_list)): N = nsamples_list[i] b_line_mp, pf_line_list_mp = uutil.get_pf_line_and_b_line_from_MP( g_list_list_sss1[i], N) pf_line_mean_mp, pf_line_cov_mp = uutil.get_mean_and_cov_from_pf_lines( pf_line_list_mp) cov_at_pf_array_sss1[i] = pf_line_cov_mp[0]
pf_mean_mp3, pf_cov_mp3 = uutil.get_mean_and_cov_pf_from_MP( g_list_mp3, N_mp[2]) print('SUS: pf =', pf_mean_sus, '| cov =', pf_cov_sus) print('MP1: pf =', pf_mean_mp1, '| cov =', pf_cov_mp1) print('MP2: pf =', pf_mean_mp2, '| cov =', pf_cov_mp2) print('MP3: pf =', pf_mean_mp3, '| cov =', pf_cov_mp3) b_line_mcs, pf_line_mcs = uutil.get_pf_line_and_b_line_from_MCS(g_list_mcs) b_line_sus, pf_line_list_sus = uutil.get_pf_line_and_b_line_from_SUS( g_list_sus, 0.1, N_sus[0]) pf_line_mean_sus, pf_line_cov_sus = uutil.get_mean_and_cov_from_pf_lines( pf_line_list_sus) b_line_mp1, pf_line_list_mp1 = uutil.get_pf_line_and_b_line_from_MP( g_list_mp1, N_mp[0]) pf_line_mean_mp1, pf_line_cov_mp1 = uutil.get_mean_and_cov_from_pf_lines( pf_line_list_mp1) b_line_mp2, pf_line_list_mp2 = uutil.get_pf_line_and_b_line_from_MP( g_list_mp2, N_mp[1]) pf_line_mean_mp2, pf_line_cov_mp2 = uutil.get_mean_and_cov_from_pf_lines( pf_line_list_mp2) b_line_mp3, pf_line_list_mp3 = uutil.get_pf_line_and_b_line_from_MP( g_list_mp3, N_mp[2]) pf_line_mean_mp3, pf_line_cov_mp3 = uutil.get_mean_and_cov_from_pf_lines( pf_line_list_mp3) # --------------------------------------------------------------------------- # PLOTS
pf_mean_array_sss4 = np.zeros(b_max, float) cov_at_pf_array_sss5 = np.zeros(b_max, float) pf_mean_array_sss5 = np.zeros(b_max, float) # seed selection stragegy 0 # for i in range(0, b_max): # b_line_mp, pf_line_list_mp = uutil.get_pf_line_and_b_line_from_MP(g_list_list_sss0[i], n_initial_samples) # pf_line_mean_mp, pf_line_cov_mp = uutil.get_mean_and_cov_from_pf_lines(pf_line_list_mp) # cov_at_pf_array_sss0[i] = pf_line_cov_mp[0] # pf_mean_array_sss0[i] = pf_line_mean_mp[0] # seed selection strategy 1 for i in range(0, b_max): b_line_mp, pf_line_list_mp = uutil.get_pf_line_and_b_line_from_MP( g_list_list_sss1[i], n_initial_samples) pf_line_mean_mp, pf_line_cov_mp = uutil.get_mean_and_cov_from_pf_lines( pf_line_list_mp) cov_at_pf_array_sss1[i] = pf_line_cov_mp[0] pf_mean_array_sss1[i] = pf_line_mean_mp[0] # seed selection strategy 2 for i in range(0, b_max): b_line_mp, pf_line_list_mp = uutil.get_pf_line_and_b_line_from_MP( g_list_list_sss2[i], n_initial_samples) pf_line_mean_mp, pf_line_cov_mp = uutil.get_mean_and_cov_from_pf_lines( pf_line_list_mp) cov_at_pf_array_sss2[i] = pf_line_cov_mp[0] pf_mean_array_sss2[i] = pf_line_mean_mp[0]
pf_mean_mp2, pf_cov_mp2 = uutil.get_mean_and_cov_pf_from_MP(g_list_mp2, 241) pf_mean_mp3, pf_cov_mp3 = uutil.get_mean_and_cov_pf_from_MP(g_list_mp3, 121) print('SUS: pf =', pf_mean_sus, '| cov =', pf_cov_sus) print('MP1: pf =', pf_mean_mp1, '| cov =', pf_cov_mp1) print('MP2: pf =', pf_mean_mp2, '| cov =', pf_cov_mp2) print('MP3: pf =', pf_mean_mp3, '| cov =', pf_cov_mp3) b_line_mcs, pf_line_mcs = uutil.get_pf_line_and_b_line_from_MCS(g_list_mcs) b_line_sus, pf_line_list_sus = uutil.get_pf_line_and_b_line_from_SUS( g_list_sus, 0.1, 5000) pf_line_mean_sus, pf_line_cov_sus = uutil.get_mean_and_cov_from_pf_lines( pf_line_list_sus) b_line_mp1, pf_line_list_mp1 = uutil.get_pf_line_and_b_line_from_MP( g_list_mp1, 478) pf_line_mean_mp1, pf_line_cov_mp1 = uutil.get_mean_and_cov_from_pf_lines( pf_line_list_mp1) b_line_mp2, pf_line_list_mp2 = uutil.get_pf_line_and_b_line_from_MP( g_list_mp2, 241) pf_line_mean_mp2, pf_line_cov_mp2 = uutil.get_mean_and_cov_from_pf_lines( pf_line_list_mp2) b_line_mp3, pf_line_list_mp3 = uutil.get_pf_line_and_b_line_from_MP( g_list_mp3, 121) pf_line_mean_mp3, pf_line_cov_mp3 = uutil.get_mean_and_cov_from_pf_lines( pf_line_list_mp3) # --------------------------------------------------------------------------- # PLOTS
g_list_mp = np.load(direction + 'mp_example_1_d10_N100_Nsim2_b30_mmh_g_list.npy') theta_list_mp = np.load(direction + 'mp_example_1_d10_N100_Nsim2_b30_mmh_theta_list.npy') # --------------------------------------------------------------------------- # POST-PROCESSING # --------------------------------------------------------------------------- b_line_analytical = np.linspace(0,7,100) pf_line_analytical = analytical_CDF(b_line_analytical) b_line_mcs, pf_line_mcs = uutil.get_pf_line_and_b_line_from_MCS(g_list_mcs) b_line_list_sus, pf_line_sus = uutil.get_pf_line_and_b_line_from_SUS(g_list_sus, p0, n_samples_per_level) b_line_list_mp, pf_line_list_mp = uutil.get_pf_line_and_b_line_from_MP(g_list_mp, n_initial_samples) # initialization b_line_list = [] pf_line_list = [] legend_list = [] b_line_list.append(b_line_analytical) b_line_list.append(b_line_mcs) b_line_list.append(b_line_list_sus[0]) b_line_list.append(b_line_list_mp[0]) pf_line_list.append(pf_line_analytical) pf_line_list.append(pf_line_mcs) pf_line_list.append(pf_line_sus)
pf_mean_mp3, pf_cov_mp3 = uutil.get_mean_and_cov_pf_from_MP(g_list_mp3, 27) print('SUS: pf =', pf_mean_sus, '| cov =', pf_cov_sus) print('MP1: pf =', pf_mean_mp1, '| cov =', pf_cov_mp1) print('MP2: pf =', pf_mean_mp2, '| cov =', pf_cov_mp2) print('MP3: pf =', pf_mean_mp3, '| cov =', pf_cov_mp3) b_line_analytical = np.linspace(0, 5, 100) pf_line_analytical = analytical_CDF(b_line_analytical) b_line_sus, pf_line_list_sus = uutil.get_pf_line_and_b_line_from_SUS( g_list_sus, 0.1, 1000) pf_line_mean_sus, pf_line_cov_sus = uutil.get_mean_and_cov_from_pf_lines( pf_line_list_sus) b_line_mp1, pf_line_list_mp1 = uutil.get_pf_line_and_b_line_from_MP( g_list_mp1, 104) pf_line_mean_mp1, pf_line_cov_mp1 = uutil.get_mean_and_cov_from_pf_lines( pf_line_list_mp1) b_line_mp2, pf_line_list_mp2 = uutil.get_pf_line_and_b_line_from_MP( g_list_mp2, 52) pf_line_mean_mp2, pf_line_cov_mp2 = uutil.get_mean_and_cov_from_pf_lines( pf_line_list_mp2) b_line_mp3, pf_line_list_mp3 = uutil.get_pf_line_and_b_line_from_MP( g_list_mp3, 27) pf_line_mean_mp3, pf_line_cov_mp3 = uutil.get_mean_and_cov_from_pf_lines( pf_line_list_mp3) # --------------------------------------------------------------------------- # PLOTS