Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing sum in Epistemic and Aleatoric computation #67

Open
Zimba96 opened this issue Jun 10, 2021 · 0 comments
Open

Missing sum in Epistemic and Aleatoric computation #67

Zimba96 opened this issue Jun 10, 2021 · 0 comments

Comments

@Zimba96
Copy link

Zimba96 commented Jun 10, 2021

Hey there,

I recently tried to implement a Bayesian Net myself and oriented myself a little on your implementation. When coming across the computation of the epistemic and aleatoric, I noticed that your implementation in uncertainty_estimation.py seems to differ a little from the formula in your paper.
In the paper, it says:
formula_paper

However, I'm missing the sums in your implementation, e. g. when you calculate the epistemic and you divide by T but not summing over all t's (same with the second part of the aleatoric):

temp = p_hat - np.expand_dims(p_bar, 0)
epistemic = np.dot(temp.T, temp) / T
epistemic = np.diag(epistemic)

aleatoric = np.diag(p_bar) - (np.dot(p_hat.T, p_hat) / T)
aleatoric = np.diag(aleatoric)

Or does the following np.diag somehow replaces the summation?

There's another short question I'd like to ask:
This code outputs the epistemic and aleatoric as vectors of size [number_of_classes], right? Does that mean that the vector represents the epistemic and aleatoric for the predictions of each class? And when I want to obtain the epistemic and aleatoric of my resulting prediction (the class with the max. softmax/softplus-value), do I then only need to extract the aleatoric and epistemic-value corresponding to that class from the epistemic and aleatoric vectors?

Thanks in advance for your answers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant