diff --git a/EIVPackage/EIVData/cubic.py b/EIVPackage/EIVData/cubic.py index dce6ea452fba08280d457e995295d5fe87d46d6d..9d5e3979db7af0e236536a9b4e8f6052fa43874e 100644 --- a/EIVPackage/EIVData/cubic.py +++ b/EIVPackage/EIVData/cubic.py @@ -9,8 +9,8 @@ total_number_of_datapoints = 1000 input_range = [-1,1] slope = 1.0 intercept = 0.0 -x_noise_strength = 0.1 -y_noise_strength = 0.1 +x_noise_strength = 0.2 +y_noise_strength = 0.05 func = lambda true_x: slope * true_x**3 + intercept def load_data(seed=0, splitting_part=0.8, normalize=True, diff --git a/EIVPackage/EIVData/linear.py b/EIVPackage/EIVData/linear.py index 97d2cd951e0d86650c9ab85af17d5ceb96312375..2a1b0d7a4da8e81db9c90376ec3386d2f466aec3 100644 --- a/EIVPackage/EIVData/linear.py +++ b/EIVPackage/EIVData/linear.py @@ -10,7 +10,7 @@ input_range = [-1,1] slope = 1.0 intercept = 0.0 x_noise_strength = 0.1 -y_noise_strength = 0.1 +y_noise_strength = 0.2 func = lambda true_x: slope * true_x + intercept def load_data(seed=0, splitting_part=0.8, normalize=True, diff --git a/EIVPackage/EIVData/sine.py b/EIVPackage/EIVData/sine.py index cde80d349eef58cadab44b79f0937d52a90e8d41..2e9eabc4d1a4f38b5c716f3bd05b28548faaafc1 100644 --- a/EIVPackage/EIVData/sine.py +++ b/EIVPackage/EIVData/sine.py @@ -8,8 +8,8 @@ from EIVGeneral.manipulate_tensors import add_noise, normalize_tensor,\ total_number_of_datapoints = 2000 input_range = [-0.2,0.8] intercept = 0.0 -x_noise_strength = 0.02 -y_noise_strength = 0.02 +x_noise_strength = 0.04 +y_noise_strength = 0.01 func = lambda true_x: true_x +\ torch.sin(2 * torch.pi * true_x) +\ torch.sin(4 * torch.pi * true_x) diff --git a/Experiments/configurations/eiv_cubic.json b/Experiments/configurations/eiv_cubic.json index 0e9f9e88edb30a99bd73a2814a92c4ca504218fd..59c37c13abd44984283d2afb579296a18dec8a75 100644 --- a/Experiments/configurations/eiv_cubic.json +++ b/Experiments/configurations/eiv_cubic.json @@ -13,10 +13,10 @@ "std_y_update_points": [1,40], "eiv_prediction_number_of_draws": [100,5], "eiv_prediction_number_of_batches": 10, - "init_std_y_list": [0.5], + "init_std_y_list": [0.05], "gamma": 0.5, "hidden_layers": [128, 128, 128, 128], - "fixed_std_x": 0.10, + "fixed_std_x": 0.20, "seed_range": [0,10], "gpu_number": 1 } diff --git a/Experiments/configurations/eiv_linear.json b/Experiments/configurations/eiv_linear.json index 8b7ebe0767411186d51ca18dde9d2d6aeb92de06..ce84949e64c4edfc4f0f6b100742f2822ca32f1c 100644 --- a/Experiments/configurations/eiv_linear.json +++ b/Experiments/configurations/eiv_linear.json @@ -13,7 +13,7 @@ "std_y_update_points": [1,40], "eiv_prediction_number_of_draws": [100,5], "eiv_prediction_number_of_batches": 10, - "init_std_y_list": [0.5], + "init_std_y_list": [0.1], "gamma": 0.5, "hidden_layers": [128, 128, 128, 128], "fixed_std_x": 0.10, diff --git a/Experiments/configurations/eiv_quadratic.json b/Experiments/configurations/eiv_quadratic.json index c774bbed09beb17e65c475fdfedfca1c795682a7..dc8a9cd87c17b40cec38ee086d4d1954ade2c62c 100644 --- a/Experiments/configurations/eiv_quadratic.json +++ b/Experiments/configurations/eiv_quadratic.json @@ -13,7 +13,7 @@ "std_y_update_points": [1,40], "eiv_prediction_number_of_draws": [100,5], "eiv_prediction_number_of_batches": 10, - "init_std_y_list": [0.5], + "init_std_y_list": [0.1], "gamma": 0.5, "hidden_layers": [128, 128, 128, 128], "fixed_std_x": 0.10, diff --git a/Experiments/configurations/eiv_sine.json b/Experiments/configurations/eiv_sine.json index 1195ea0891ab3dc49745b0c9b310416cc2ee0ba9..b6bf6d0d286644e120729899bc8b1c1a2854681e 100644 --- a/Experiments/configurations/eiv_sine.json +++ b/Experiments/configurations/eiv_sine.json @@ -14,10 +14,10 @@ "eiv_number_of_forward_draws": 10, "eiv_prediction_number_of_draws": [100,5], "eiv_prediction_number_of_batches": 10, - "init_std_y_list": [0.1], + "init_std_y_list": [0.01], "gamma": 0.5, "hidden_layers": [128, 128, 128, 128], - "fixed_std_x": 0.02, + "fixed_std_x": 0.04, "seed_range": [0,10], "gpu_number": 1 } diff --git a/Experiments/configurations/noneiv_cubic.json b/Experiments/configurations/noneiv_cubic.json index 6f71af1d77db1a357f0d68edfe192cc06578d3af..a325665d0c8e0bfe813abd2ae27ba02deaf4610c 100644 --- a/Experiments/configurations/noneiv_cubic.json +++ b/Experiments/configurations/noneiv_cubic.json @@ -13,7 +13,7 @@ "std_y_update_points": [1,40] , "noneiv_prediction_number_of_draws": 100, "noneiv_prediction_number_of_batches": 10, - "init_std_y_list": [0.5], + "init_std_y_list": [0.05], "gamma": 0.5, "hidden_layers": [128, 128, 128, 128], "seed_range": [0,10], diff --git a/Experiments/configurations/noneiv_linear.json b/Experiments/configurations/noneiv_linear.json index ae3040e2b157bc7bd10cfd73d9f4f5448f4cf023..ff57b5686c5beeb2240c14bed889a3480d586429 100644 --- a/Experiments/configurations/noneiv_linear.json +++ b/Experiments/configurations/noneiv_linear.json @@ -13,7 +13,7 @@ "std_y_update_points": [1,40] , "noneiv_prediction_number_of_draws": 100, "noneiv_prediction_number_of_batches": 10, - "init_std_y_list": [0.5], + "init_std_y_list": [0.1], "gamma": 0.5, "hidden_layers": [128, 128, 128, 128], "seed_range": [0,10], diff --git a/Experiments/configurations/noneiv_quadratic.json b/Experiments/configurations/noneiv_quadratic.json index 405263797ff8b9ffa3ef692540b0db5edc506cda..d858851a1dc0be2e52c3d12a579efe485aad7503 100644 --- a/Experiments/configurations/noneiv_quadratic.json +++ b/Experiments/configurations/noneiv_quadratic.json @@ -13,7 +13,7 @@ "std_y_update_points": [1,40] , "noneiv_prediction_number_of_draws": 100, "noneiv_prediction_number_of_batches": 10, - "init_std_y_list": [0.5], + "init_std_y_list": [0.1], "gamma": 0.5, "hidden_layers": [128, 128, 128, 128], "seed_range": [0,10], diff --git a/Experiments/configurations/noneiv_sine.json b/Experiments/configurations/noneiv_sine.json index cc889194d725b1e167b1129d444e12720e2610a0..5191847de1cbf256a4b572a30a09f8dd22e0bea3 100644 --- a/Experiments/configurations/noneiv_sine.json +++ b/Experiments/configurations/noneiv_sine.json @@ -13,7 +13,7 @@ "std_y_update_points": [1,40] , "noneiv_prediction_number_of_draws": 100, "noneiv_prediction_number_of_batches": 10, - "init_std_y_list": [0.1], + "init_std_y_list": [0.01], "gamma": 0.5, "hidden_layers": [128, 128, 128, 128], "seed_range": [0,10], diff --git a/Experiments/plot_coverage_vs_q.py b/Experiments/plot_coverage_vs_q.py index 9bc59a3eb4b15d86d9e2355264852712ef3985a3..5cb7f8f143f65524c22e28ecd6bcf388059f04dd 100644 --- a/Experiments/plot_coverage_vs_q.py +++ b/Experiments/plot_coverage_vs_q.py @@ -13,6 +13,7 @@ import torch.backends.cudnn from torch.utils.data import DataLoader from matplotlib.pyplot import cm import matplotlib.pyplot as plt +from tqdm import tqdm from EIVArchitectures import Networks from EIVTrainingRoutines import train_and_store @@ -94,7 +95,7 @@ plt.ylabel('coverage') # datasets to plot and their coloring datasets = ['linear', 'quadratic','cubic','sine'] -colors = ['cyan', 'magenta', 'yellow', 'green'] +colors = ['#084519', '#7D098D', '#77050C', '#09017F'] def compute_coverages(data, eiv, number_of_draws): """ @@ -148,7 +149,6 @@ def compute_coverages(data, eiv, number_of_draws): = load_data(seed=0, return_ground_truth=True, normalize=normalize) - print(f"Computing {'EiV' if eiv else 'non-EiV'} coverage for {long_dataname}") # train_data only used for finding dimensions input_dim = train_data[0][0].numel() @@ -233,14 +233,13 @@ def compute_coverages(data, eiv, number_of_draws): return numerical_coverage, theoretical_coverage # loop through data -for data, color in zip(datasets, colors): +for data, color in tqdm(zip(datasets, colors)): # compute coverages eiv_coverages = compute_coverages(data=data, eiv=True, number_of_draws=[100,5]) noneiv_coverages = compute_coverages(data=data, eiv=False, number_of_draws=100) # create plots - plt.figure(1) coverage_diagonal_plot(eiv_coverages, noneiv_coverages, color=color, against_theoretical=False, label=data) diff --git a/Experiments/plot_summary.py b/Experiments/plot_summary.py index c3d8c0d284dcff754b9da4a29b9d767d587d930c..c0863c604ff618df5e45351576c493cece331f50 100644 --- a/Experiments/plot_summary.py +++ b/Experiments/plot_summary.py @@ -80,7 +80,7 @@ for i, ([(eiv_metric_mean, eiv_metric_std), bottom = noneiv_metric_mean - k* noneiv_metric_std, color=colors[1], alpha=0.5) -plt.ylim(bottom=0, top=y_max) +plt.ylim(bottom=0, top=ymax) ax = plt.gca() ax.set_xticks(np.arange(1,len(data_list)+1)) ax.set_xticklabels(data_list, rotation='vertical') @@ -127,7 +127,7 @@ for i, ([(eiv_metric_mean, eiv_metric_std), color=colors[1], alpha=0.5) plt.axhline(0.95,0.0,1.0,color='k', linestyle='dashed') -plt.ylim(bottom=0, top=y_max) +plt.ylim(bottom=0, top=ymax) ax = plt.gca() ax.set_xticks(np.arange(1,len(data_list)+1)) ax.set_xticklabels(data_list, rotation='vertical') @@ -173,7 +173,7 @@ for i, ([(eiv_metric_mean, eiv_metric_std), bottom = noneiv_metric_mean - k* noneiv_metric_std, color=colors[1], alpha=0.5) -plt.ylim(bottom=0, top=y_max) +plt.ylim(bottom=0, top=ymax) ax = plt.gca() ax.set_xticks(np.arange(1,len(data_list)+1)) ax.set_xticklabels(data_list, rotation='vertical')