ykwon0407 / UQ_BNN

Uncertainty quantification using Bayesian neural networks in classification (MIDL 2018, CSDA)
133 stars 21 forks source link

another question about p_hat #5

Closed ShellingFord221 closed 5 years ago

ShellingFord221 commented 5 years ago

Why do you only use [0] of prediction results in line 63, /retina/utils.py? Shouldn't p_hat be made up of the probabilities of all classes?

ShellingFord221 commented 5 years ago

In your paper, the explanation of p_hat under Eq. 4 is: p_hat = Softmax{f(x*)}, therefore I think that p_hat should be made up of the probabilities of all classes after softmax layer.

ykwon0407 commented 5 years ago

@ShellingFord221 Hello~ Why do you only use [0] of prediction results in line 63, /retina/utils.py? Shouldn't p_hat be made up of the probabilities of all classes? In your paper, the explanation of p_hat under Eq. 4 is: p_hat = Softmax{f(x*)}, therefore I think that p_hat should be made up of the probabilities of all classes after softmax layer. -> You are right. However, in this GitHub codes, the similar concept applied to another issue you wrote goes again, indexing [0] is enough to obtain the p_hat. Please note that knowing P(y=1) is sufficient to know p_hat in case of binary classification.

Hope this information helps you!

ShellingFord221 commented 5 years ago

Hi, I suddenly realize that p_hat is just for ONE test data according to the explanation under Eq. 4: p_hat = Softmax{f(x)}, where x means a new input. Can I rewrite Eq. 4 to get aleatoric and epistemic uncertainty of ALL test data (e.g. 10000 samples)? Because I think the uncertainty metrics are more appropriate in the case of all test data, aleatoric and epistemic uncertainty should mean the uncertainty about the whole test set.

ykwon0407 commented 5 years ago

Not really. It is because, in general, the 'uncertainty' is terminology for one random variable X. Once you have averaged the uncertainties using whole test data, then it would estimate Var(y), not Var(y | x).

If you want to see overall uncertainty, then I guess you can compute by averaging all terms. It depends on what quantity you want.