diff --git a/Experiments/plot_real_intersection.py b/Experiments/plot_real_diagonal.py similarity index 90% rename from Experiments/plot_real_intersection.py rename to Experiments/plot_real_diagonal.py index f01b47f2690d8050112f9fd49d8c02693947643c..d2abda6db2c527edd0731c0a544d1771b425f271 100644 --- a/Experiments/plot_real_intersection.py +++ b/Experiments/plot_real_diagonal.py @@ -152,7 +152,7 @@ def create_diagonal(train, number_of_steps=100): input_shape = train[0][0].shape assert len(input_shape) == 1 input_dim = input_shape[0] - ones = torch.ones((1, input_dim)) + ones = 0.75 * torch.ones((1, input_dim)) t = torch.linspace(start=0, end=1, steps=number_of_steps)[...,None] return (1-t) * ones - t * ones @@ -161,9 +161,7 @@ def create_diagonal(train, number_of_steps=100): assert noneiv_conf_dict["seed_range"] == eiv_conf_dict["seed_range"] seed_list = range(noneiv_conf_dict["seed_range"][0], noneiv_conf_dict["seed_range"][1]) -noneiv_predictions = 0 noneiv_uncertainties = 0 -eiv_predictions = 0 eiv_uncertainties = 0 number_of_seeds = len(seed_list) out_dim = 0 @@ -172,16 +170,13 @@ for seed in tqdm(seed_list): x_diagonal = create_diagonal(train=train_data, number_of_steps=number_of_steps) results = collect_predictions(x_diagonal, seed=seed) - noneiv_predictions += 1/number_of_seeds * results['noneiv']['predictions'][..., out_dim] noneiv_uncertainties += 1/number_of_seeds * results['noneiv']['uncertainties'][..., out_dim] - eiv_predictions += 1/number_of_seeds * results['eiv']['predictions'][..., out_dim] eiv_uncertainties += 1/number_of_seeds * results['eiv']['uncertainties'][..., out_dim] plt.figure(1) plt.clf() plot_x = torch.linspace(0,1, steps=number_of_steps) -plt.plot(plot_x, noneiv_predictions, color='b') -plt.fill_between(plot_x, noneiv_predictions - noneiv_uncertainties,noneiv_predictions + noneiv_uncertainties, color='b', alpha=0.5) -plt.plot(plot_x, eiv_predictions, color='r') -plt.fill_between(plot_x, eiv_predictions - eiv_uncertainties, eiv_predictions + eiv_uncertainties, color='r', alpha=0.5) +plt.fill_between(plot_x, noneiv_uncertainties, color='b', alpha=0.5) +plt.fill_between(plot_x, eiv_uncertainties, color='r', alpha=0.5) +plt.savefig('results/figures/intersection')