Skip to content
Snippets Groups Projects
Commit daa8d2ce authored by Jörg Martin's avatar Jörg Martin
Browse files

renamed file

parent 2298b661
Branches
No related tags found
No related merge requests found
...@@ -152,7 +152,7 @@ def create_diagonal(train, number_of_steps=100): ...@@ -152,7 +152,7 @@ def create_diagonal(train, number_of_steps=100):
input_shape = train[0][0].shape input_shape = train[0][0].shape
assert len(input_shape) == 1 assert len(input_shape) == 1
input_dim = input_shape[0] 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] t = torch.linspace(start=0, end=1, steps=number_of_steps)[...,None]
return (1-t) * ones - t * ones return (1-t) * ones - t * ones
...@@ -161,9 +161,7 @@ def create_diagonal(train, number_of_steps=100): ...@@ -161,9 +161,7 @@ def create_diagonal(train, number_of_steps=100):
assert noneiv_conf_dict["seed_range"] == eiv_conf_dict["seed_range"] assert noneiv_conf_dict["seed_range"] == eiv_conf_dict["seed_range"]
seed_list = range(noneiv_conf_dict["seed_range"][0], seed_list = range(noneiv_conf_dict["seed_range"][0],
noneiv_conf_dict["seed_range"][1]) noneiv_conf_dict["seed_range"][1])
noneiv_predictions = 0
noneiv_uncertainties = 0 noneiv_uncertainties = 0
eiv_predictions = 0
eiv_uncertainties = 0 eiv_uncertainties = 0
number_of_seeds = len(seed_list) number_of_seeds = len(seed_list)
out_dim = 0 out_dim = 0
...@@ -172,16 +170,13 @@ for seed in tqdm(seed_list): ...@@ -172,16 +170,13 @@ for seed in tqdm(seed_list):
x_diagonal = create_diagonal(train=train_data, number_of_steps=number_of_steps) x_diagonal = create_diagonal(train=train_data, number_of_steps=number_of_steps)
results = collect_predictions(x_diagonal, results = collect_predictions(x_diagonal,
seed=seed) seed=seed)
noneiv_predictions += 1/number_of_seeds * results['noneiv']['predictions'][..., out_dim]
noneiv_uncertainties += 1/number_of_seeds * results['noneiv']['uncertainties'][..., 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] eiv_uncertainties += 1/number_of_seeds * results['eiv']['uncertainties'][..., out_dim]
plt.figure(1) plt.figure(1)
plt.clf() plt.clf()
plot_x = torch.linspace(0,1, steps=number_of_steps) plot_x = torch.linspace(0,1, steps=number_of_steps)
plt.plot(plot_x, noneiv_predictions, color='b') plt.fill_between(plot_x, noneiv_uncertainties, color='b', alpha=0.5)
plt.fill_between(plot_x, noneiv_predictions - noneiv_uncertainties,noneiv_predictions + noneiv_uncertainties, color='b', alpha=0.5) plt.fill_between(plot_x, eiv_uncertainties, color='r', alpha=0.5)
plt.plot(plot_x, eiv_predictions, color='r') plt.savefig('results/figures/intersection')
plt.fill_between(plot_x, eiv_predictions - eiv_uncertainties, eiv_predictions + eiv_uncertainties, color='r', alpha=0.5)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment