Skip to content

Commit

Permalink
flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
beckynevin committed May 15, 2024
1 parent 933f2b7 commit b25fb70
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ def loss_der(y, y_pred, coeff):
u_ep,
)

# simplified

# simplified DER loss (from Meinert)
def loss_sder(y, y_pred, coeff):
gamma, nu, alpha, beta = y[:, 0], y[:, 1], y[:, 2], y[:, 3]
error = gamma - y_pred
Expand All @@ -219,7 +220,7 @@ def loss_sder(y, y_pred, coeff):
# define aleatoric and epistemic uncert
u_al = np.sqrt(
(beta.detach().numpy()
* (1 + nu.detach().numpy()))
* (1 + nu.detach().numpy()))
/ (alpha.detach().numpy() * nu.detach().numpy())
)
u_ep = 1 / np.sqrt(nu.detach().numpy())
Expand Down
1 change: 0 additions & 1 deletion src/scripts/Aleatoric.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ def beta_type(value):
range(n_epochs),
np.sqrt(al_dict[model][noise]),
color=color_list[i],
#edgecolors="black",
label=r"$\sigma = $" + str(sigma_list[i]),
)
ax.axhline(y=sigma_list[i], color=color_list[i], ls='--')
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/AleatoricandEpistemic.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def beta_type(value):
ax.set_title("Deep Evidential Regression")
elif model[0:2] == "DE":
ax.set_title("Deep Ensemble (100 models)")
#ax.set_ylim([-1, 15])
# ax.set_ylim([-1, 15])
plt.legend()
if config.get_item("analysis", "savefig", "Analysis"):
plt.savefig(
Expand Down
3 changes: 1 addition & 2 deletions src/scripts/Epistemic.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ def beta_type(value):
range(n_epochs),
ep_dict[model][noise],
color=color_list[i],
#edgecolors="black",
label=r"$\sigma = $" + str(sigma_list[i]),
)
ax.axhline(y=sigma_list[i], color=color_list[i])
Expand All @@ -290,7 +289,7 @@ def beta_type(value):
ax.set_title("Deep Evidential Regression")
elif model[0:2] == "DE":
ax.set_title("Deep Ensemble (100 models)")
#ax.set_ylim([-1, 15])
# ax.set_ylim([-1, 15])
plt.legend()
if config.get_item("analysis", "savefig", "Analysis"):
plt.savefig(
Expand Down
2 changes: 1 addition & 1 deletion src/utils/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"analysis": {
"noise_level_list": ["low", "medium", "high"],
"model_names_list": ["DER", "DE_desiderata_2"],
#["DER_desiderata_2", "DE_desiderata_2"]
# ["DER_desiderata_2", "DE_desiderata_2"]
"plot": True,
"savefig": False,
"verbose": False,
Expand Down

0 comments on commit b25fb70

Please sign in to comment.