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

Toy Regression Example #2

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

nilsleh
Copy link

@nilsleh nilsleh commented Mar 31, 2023

Thanks a lot for the interesting paper and open sourcing the code. I am trying to get a better understanding of the method and its sensitivity to hyperparameters. Therefore, I created a toy example notebook contained in this PR because there is no Issues tab, to discuss the observation. The mean fit is okay, albeit not perfect, hower, the estimates for epistemic and aleatoric uncertainty seem rather strange. However, I am not sure, whether I compute it correctly. I was following your implementation in the ood comput step.

posterior, log_prob = module.model(dm.X_test)
mean = posterior.maximum_a_posteriori().mean()
epistemic = torch.clone(log_prob)
aleatoric = -posterior.maximum_a_posteriori().uncertainty()

Given the results, I was wondering if you could point out what I am doing wrong. Cheers.

Screenshot from 2023-03-31 11-28-06

@borchero
Copy link
Owner

borchero commented Apr 2, 2023

Hey @nilsleh, happy to see you get your hands dirty with NatPN and thanks for adding the notebook here! ;) On some datasets, fine-tuning is very important which requires an additional "optimization round". Please have a look at the NaturalPosteriorNetwork estimator that is exposed by this package. In its fit method, you can see what fine-tuning (which is enabled by default) uses a different loss to solely optimize the normalizing flow to obtain more accurate uncertainty estimates.

@nilsleh
Copy link
Author

nilsleh commented Apr 3, 2023

Thanks a lot for your reply, I have added a finetuning step, which changes the results but does not really improve them, so I must still be doing something wrong with the hyperparameter tuning. Do yo happen to have a script for the Toy Regression Task Figure 1 of your paper that could maybe help to pinpoint the issue?

Edit for context:

This is before finetuning:
before_finetuning

And after finetuning:
after_finetuning

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

Successfully merging this pull request may close these issues.

2 participants