nb_threads = 2 # for input queue stddev_init_nn = 0.01 # neural net initialization log_dir = 'logs_svae' verbose = False # log device placement # set size_minibatch=64 schedule = create_schedule({ 'dataset': 'auto', 'method': 'svae-cvi', 'lr': [0.0003], # adam stepsize 'lrcvi': [0.2], # cvi stepsize (convex combination) 'decay_rate': [0.95], 'K': 10, # nb components 'L': [6], # latent dimensionality 'U': 50, # hidden units 'seed': 0 }) # set size_minibatch=100 (as in Johnson+, 2016); initialize phi_gmm with gmm_prior (line 181) schedule = create_schedule({ 'dataset': 'pinwheel', 'method': 'svae-cvi', 'lr': [0.01], # adam stepsize 'lrcvi': [0.1], # cvi stepsize (convex combination) 'K': 10, # nb components 'L': [2], # latent dimensionality 'U': 50, # hidden units
def boxplot_noisy_pinwheel(): # plots performance of latent SMM for increasing noise level path = '../noisy_pinwheel_wu' schedule_svae_smm = create_schedule({ 'dataset': 'noisy-pinwheel', 'method': 'svae-cvi-smm', 'lr': [0.01], # adam stepsize 'lrcvi': [0.005], # cvi stepsize (convex combination) 'K': 10, # nb components 'L': 2, # latent dimensionality 'U': 40, # hidden units 'DoF': 5, 'noise_level': 0.1, 'seed': range(1, 4) }) _, mse1, mse1m, mse1s = load_m_std(path, schedule_svae_smm, 'mse_te') schedule_svae_smm = create_schedule({ 'dataset': 'noisy-pinwheel', 'method': 'svae-cvi-smm', 'lr': [0.01], # adam stepsize 'lrcvi': [0.005], # cvi stepsize (convex combination) 'K': 10, # nb components 'L': 2, # latent dimensionality 'U': 40, # hidden units 'DoF': 5, 'noise_level': 0.3, 'seed': range(1, 4) }) _, mse3, mse3m, mse3s = load_m_std(path, schedule_svae_smm, 'mse_te') schedule_svae_smm = create_schedule({ 'dataset': 'noisy-pinwheel', 'method': 'svae-cvi-smm', 'lr': [0.01], # adam stepsize 'lrcvi': [0.0005], # cvi stepsize (convex combination) 'K': 10, # nb components 'L': 2, # latent dimensionality 'U': 40, # hidden units 'DoF': 5, 'noise_level': 0.5, 'seed': range(1, 4) }) _, mse5, mse5m, mse5s = load_m_std(path, schedule_svae_smm, 'mse_te') schedule_svae_smm = create_schedule({ 'dataset': 'noisy-pinwheel', 'method': 'svae-cvi-smm', 'lr': [0.01], # adam stepsize 'lrcvi': [0.0005], # cvi stepsize (convex combination) 'K': 10, # nb components 'L': 2, # latent dimensionality 'U': 40, # hidden units 'DoF': 5, 'noise_level': 0.7, 'seed': range(1, 4) }) _, mse7, mse7m, mse7s = load_m_std(path, schedule_svae_smm, 'mse_te') lsmm_mean = np.vstack([mse1m[-1], mse3m[-1], mse5m[-1], mse7m[-1]]) lsmm_std = np.vstack([mse1s[-1], mse3s[-1], mse5s[-1], mse7s[-1]]) # extract svae gmm lgmm_mean = np.zeros(4) lgmm_std = np.zeros(4) for i, lvl in enumerate([0.1, 0.3, 0.5, 0.7]): schedule_svae_gmm = create_schedule({ 'dataset': 'noisy-pinwheel', 'method': 'svae-cvi', 'lr': [0.01], # adam stepsize 'lrcvi': [0.005], # cvi stepsize (convex combination) 'K': 10, # nb components 'L': 2, # latent dimensionality 'U': 40, # hidden units 'DoF': 5, 'noise_level': lvl, 'seed': range(1, 4) }) _, mse, mean, std = load_m_std(path, schedule_svae_gmm, 'mse_te') lgmm_mean[i] = mean[-1] lgmm_std[i] = std[-1] # extract simple gmm gmm_mean = np.zeros(4) gmm_std = np.zeros(4) for i, lvl in enumerate([0.1, 0.3, 0.5, 0.7]): schedule_svae_gmm = create_schedule({ 'dataset': 'noisy-pinwheel', 'method': 'gmm', 'K': 10, # nb components 'noise_level': lvl, 'seed': range(1, 4) }) _, mse, mean, std = load_m_std(path, schedule_svae_gmm, 'mse_te') gmm_mean[i] = mean[-1] gmm_std[i] = std[-1] fig, ax = newfig(0.5, ratio_hw=customized_figsize) # ax.set_xscale('log') ax.set_yscale('log') #(4, 3) ax.errorbar(np.transpose([1, 2, 3, 4]), gmm_mean, yerr=gmm_std, color="C0", label="GMM") ax.errorbar(np.transpose([1, 2, 3, 4]), lgmm_mean, yerr=lgmm_std, color="C3", label="SAN-GMM") ax.errorbar(np.transpose([1, 2, 3, 4]), lsmm_mean, yerr=lsmm_std, color="C8", label="SAN-TMM") ax.set_xticklabels(["10%", "30%", "50%", "70%"]) ax.set_xticks([1, 2, 3, 4]) ax.set_xlim([0.7, 4.3]) ax.set_ylim([0.5, 200]) ax.set_xlabel('Ratio Outliers') ax.set_ylabel('MSE') ax.grid(which='both', linewidth=width_gridlines) ax.legend() save_plot('noisy-pinwheel_errorbars', path='./')
def compare_auto(): mpl.rcParams.update({"legend.fontsize": 4}) # path_svae = '../raiden_auto/auto_svae' path_svae_smm = '../auto_svae_smm' path_svae = '../logs_svae' path_vae = '../logs_vae' path_gmm = '../auto_gmm' # load SVAE-GMM schedule_svae = create_schedule({ 'dataset': 'auto', 'method': 'svae-cvi', 'lr': [0.0003], # adam stepsize 'lrcvi': [0.2], # cvi stepsize (convex combination) 'decay_rate': [0.95], 'K': 10, # nb components 'L': [6], # latent dimensionality 'U': 50, # hidden units 'seed': range(0, 10) # todo }) # load SVAE-SMM schedule_svae_smm = create_schedule({ 'dataset': 'auto', 'method': 'svae-cvi-smm', 'lr': [0.0003], # adam stepsize 'lrcvi': [0.2], # cvi stepsize (convex combination) 'decay_rate': [0.95], 'K': 10, # nb components 'L': [6], # latent dimensionality 'U': 50, # hidden units 'DoF': 5, 'seed': range(10) # todo }) # load VAE schedule_vae = create_schedule({ 'dataset': 'auto', 'method': 'vae', 'lr': [0.0003], # adam stepsize 'L': [6], # latent dimensionality 'U': 50, # hidden units 'seed': range(10) }) # load VAE schedule_gmm = create_schedule({ 'method': 'gmm', 'dataset': 'auto', 'K': 5, 'seed': range(10) }) label_svae_smm = 'SAN-SMM' label_svae = 'SAN-GMM' label_vae = 'VAE' label_gmm = 'GMM' fig, ax = newfig(0.5, ratio_hw=customized_figsize) plot_summary(path_gmm, schedule_gmm, 'mse_te', ax, label_gmm, marker='o') plot_summary(path_vae, schedule_vae, 'mse_te', ax, label_vae, marker='+') plot_summary(path_svae, schedule_svae, 'mse_te', ax, label_svae, marker='D') plot_summary(path_svae_smm, schedule_svae_smm, 'mse_te', ax, label_svae_smm, marker='s') ax.set_xscale('log') ax.set_yscale('log') ax.set_xlim([400, 100000]) ax.set_ylim([1, 200]) ax.grid(which='both', linewidth=width_gridlines) ax.set_xlabel('Iterations') ax.set_ylabel('MSE') # import matplotlib.lines as mlines # handles, labels = ax.get_legend_handles_labels() # handles.insert(2, mlines.Line2D([], [], color='C1', marker='x', markersize=7)) # labels.insert(2, 'SVAE (Johnson et. al.)') # ax.legend(handles, labels, loc='lower left') ax.legend() save_plot('auto_mse_te_smm', path='./')
def compare_pinwheel(): # path = '../pinwheel' path_san = '../pinwheel_new' path_mjj = '../../svae/experiments/pinwheel_new' # load SVAE schedule_svae = create_schedule({ 'dataset': 'pinwheel', 'method': 'svae-cvi', 'lr': [0.01], # adam stepsize 'lrcvi': [0.1], # cvi stepsize (convex combination) 'decay_rate': 1, 'delay': 0, 'K': 10, # nb components 'L': 2, # latent dimensionality 'U': 40, # hidden units 'seed': range(10) }) # load VAE schedule_vae = create_schedule({ 'dataset': 'pinwheel', 'method': 'vae', 'lr': [0.005], # adam stepsize 'L': 2, # latent dimensionality 'U': 40, # hidden units 'seed': range(10) }) # load GMM schedule_gmm = create_schedule({ 'method': 'gmm', 'dataset': 'pinwheel', 'K': 10, 'seed': range(10) }) # load SVAE-Johnson schedule_mjj = create_schedule({ 'method': 'svae_mjj', 'dataset': 'pinwheel', 'inner_loop': [100], 'sgd_step_size': [10], 'adam_step_size': [0.005], 'K': 10, 'seed': range(10) }) label_svae = 'SAN-GMM' label_mjj = 'SVAE (Johnson et. al.)' label_vae = 'VAE' label_gmm = 'GMM' # ax = ax3 fig, ax = newfig(0.5, ratio_hw=customized_figsize) ax.set_xscale('log') ax.set_yscale('log') ax.grid(which='both', linewidth=width_gridlines) ax.set_xlim([100, 10000]) ax.set_ylim([0.5, 100]) plot_summary(path_san, schedule_gmm, 'mse_te', ax, label_gmm, marker='o', start=1) plot_summary(path_san, schedule_vae, 'mse_te', ax, label_vae, marker='+', start=1) plot_summary(path_mjj, schedule_mjj, 'test_rmse_100', ax, label_mjj, marker='x', start=1) plot_summary(path_san, schedule_svae, 'mse_te', ax, label_svae, marker='D', start=1) ax.set_xlabel('Iterations') ax.set_ylabel('MSE') ax.grid(which='both', linewidth=width_gridlines) # ax.legend() # plt.show() save_plot('pinwheel_mse_te', path='./')
measurement_freq = 2500 imputation_freq = 50000 checkpoint_freq = 25000 seed_data = 0 log_dir = '../logs_vae' nb_threads = 5 # for input queue stddev_init = 0.01 schedule = create_schedule({ 'dataset': 'auto', 'method': 'vae', 'lr': [0.0003], # adam stepsize 'L': [6], # latent dimensionality 'U': 50, # hidden units 'seed': range(0, 10) }) # schedule = create_schedule({ # 'dataset': 'mnist-small', # 'method': 'vae', # 'lr': [0.001], # adam stepsize # 'L': [10], # latent dimensionality # 'U': 50, # hidden units # 'seed': 0 # }) ####################################################################################################################
path_dataset = '../datasets' ratio_tr = 0.7 ratio_val = None missing_data_ratio = 0.1 nb_iters = 200 seed = 0 seed_data = 0 log_dir = '../debug' schedule = create_schedule({ 'method': 'smm', 'dataset': 'aggregation', # 't4.8k', 'K': 10, 'kappa': 9999, 'seed': 0 }) #################################################################################################################### for config_id, config in enumerate(schedule): K = config['K'] kappa = config['kappa'] seed = config['seed'] dataset = config['dataset'] print("Experiment %d with config\n%s\n" % (config_id, str(config)))
ratio_val = None missing_data_ratio = 0.1 nb_iters = 500 measurement_freq = 10 K = 10 # nb components seed = 0 seed_data = 0 log_dir = '../pinwheel_new' schedule = create_schedule({ 'method': 'gmm', 'dataset': 'pinwheel', 'K': 8, 'seed': range(10) }) # # schedule = create_schedule({ # 'method': 'gmm', # 'dataset': 'auto', # 'K': 10, # 'seed': 10 # }) schedule = create_schedule({ 'method': 'gmm', 'dataset': 'aggregation', 'K': 10, 'seed': 0
ratio_val = None missing_data_ratio = 0.1 nb_iters = 500 measurement_freq = 10 K = 10 # nb components seed = 0 seed_data = 0 log_dir = '../pinwheel_new' schedule = create_schedule({ 'method': 'gmm', 'dataset': 'pinwheel', 'K': 8, 'seed': range(10) }) # # schedule = create_schedule({ # 'method': 'gmm', # 'dataset': 'auto', # 'K': 10, # 'seed': 10 # }) #################################################################################################################### for config_id, config in enumerate(schedule): K = config['K'] seed = config['seed']