piEsposito / blitz-bayesian-deep-learning

A simple and extensible library to create Bayesian Neural Network layers on PyTorch.
GNU General Public License v3.0
918 stars 107 forks source link

Interface features both parts of the ELBO-loss (likelihood part and performance part) #94

Closed filljonas closed 2 years ago

filljonas commented 2 years ago

For my recent work about Bayesian Neural Networks for Time Series Forecasting in Hydrology I needed a slight modification of the BLiTZ-library where the function _sampleelbo in _variationalestimator.py does not only output the total loss, but the likelihood part and performance part individually. In addition, my version outputs the model predictions.

As I think that this could be sensible addition for public use of the library, I would like to apply for a change here.

Best regards, Jonas Fill

piEsposito commented 2 years ago

Hi, and thank you for contributing to BLiTZ. I'm gonna run the tests and review the PR.

Tks, -Pi

piEsposito commented 2 years ago

The tests did not pass as you changed the return value of a important function of @variational_estimator.

I've presented some approaches you can go to to solve this issue, and you can always create a new function return the values as you wish without changing this function that is a central part of BLiTZ's API.

Tks!

filljonas commented 2 years ago

Hi, I restored the original function within @variational_estimator and added my own function where I changed the return type. Please let me know if there is anything else that I need to adjust.

Best, Jonas

piEsposito commented 2 years ago

Gonna run the tests and let you know. Thanks again :D

piEsposito commented 2 years ago

Now it works. I'm merging it, thou it would be nice if you could add the unit tests for this function on other PR.