bayesian-torch icon indicating copy to clipboard operation
bayesian-torch copied to clipboard

Regression tasks: Epistemic and Aleatoric Uncertainty Estimation

Open feracero opened this issue 2 years ago • 8 comments

Hello, I am trying to use this repository for regression tasks (I can see the examples seem to focus on classification tasks).

I would like to do estimate epistemic and aleatoric uncertainty for my bayesian neural network as described in 3.1 here https://arxiv.org/pdf/2204.09308.pdf

Could you please provide some guidance on how to obtain the mean and variance used by the final layer to generate the output samples? In this way one could estimate epistemic uncertainty for regression tasks.

Thank you!

feracero avatar Mar 13 '23 14:03 feracero

Hi @feracero, I am currently also thinking about using this repo for regression tasks. Did you have success?

@ranganathkrishnan (and other contributors) would it be possible to add an example? One thing that I am not sure of is how to modify the loss computation which is exemplified for classification in the Training snippet section.

famura avatar Mar 04 '24 15:03 famura

@famura, did you manage to perform a regression with this repo? or did you end up with using another one? (if yes, please let me know which :D)

giulioturrisi avatar Apr 17 '24 08:04 giulioturrisi

@giulioturrisi I was putting it off due to other projects. It is still on my plate to try it within the next 1-2 months though. What is your experience?

famura avatar Apr 17 '24 08:04 famura

@famura I have just started now to look around for libraries actually. If i find something nice, I will ping you.

giulioturrisi avatar Apr 17 '24 08:04 giulioturrisi

Hi @feracero, I am currently also thinking about using this repo for regression tasks. Did you have success?

@ranganathkrishnan (and other contributors) would it be possible to add an example? One thing that I am not sure of is how to modify the loss computation which is exemplified for classification in the Training snippet section.

Hi @famura It should be straightforward to use model with LinearReparameterization layers with torch.nn.MSELoss() for regression task. I will add an example for regression in the repo.

ranganathkrishnan avatar Apr 17 '24 21:04 ranganathkrishnan

Nice, thank you @ranganathkrishnan.

Is there a specific reason why only LSTMs and not GRUs or RNNs are supported here? Or in other words, why did you have to re-code the LSTM forward pass here instead of using the one from PyTroch?

Update: I think my questions can be answered with "Because we need the KL from the layers that make up the LSTM"

famura avatar May 08 '24 14:05 famura

Nice, thank you @ranganathkrishnan.

Is there a specific reason why only LSTMs and not GRUs or RNNs are supported here? Or in other words, why did you have to re-code the LSTM forward pass here instead of using the one from PyTroch?

Update: I think my questions can be answered with "Because we need the KL from the layers that make up the LSTM"

Hi @famura, No specific reason, we included implementation of reference Bayesian LSTM for time-series prediction tasks, Contributions are welcome through PRs. If you end up implementing Bayesian GRU and RNN layers, please send the pull request. Thanks!

ranganathkrishnan avatar May 08 '24 20:05 ranganathkrishnan

Hi @feracero, I am currently also thinking about using this repo for regression tasks. Did you have success? @ranganathkrishnan (and other contributors) would it be possible to add an example? One thing that I am not sure of is how to modify the loss computation which is exemplified for classification in the Training snippet section.

Hi @famura It should be straightforward to use model with LinearReparameterization layers with torch.nn.MSELoss() for regression task. I will add an example for regression in the repo.

Hello, i am currently also looking into using this library for a regression task. How does one weight the KL divergence compared to the MSE loss? In my case, i have multple outputs where all outputs are standardized (μ = 0, σ = 1) based on the training data.

staco-tx-mli avatar Jun 10 '24 13:06 staco-tx-mli