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

how to calculate uncertainty estimates #2

Open
Nero0113 opened this issue Mar 16, 2023 · 4 comments
Open

how to calculate uncertainty estimates #2

Nero0113 opened this issue Mar 16, 2023 · 4 comments

Comments

@Nero0113
Copy link

Nero0113 commented Mar 16, 2023

Following your steps, I divided cnews into two tag sets and trained two teacher models, but when I am ready to run monte_carlo.py by myself, I do not find the correct steps to proceed. Please, how can I train a weight file by myself, the steps you give in the web page are not enough to get the np file.

@Nero0113 Nero0113 changed the title On how to calculate uncertainty estimates how to calculate uncertainty estimates Mar 16, 2023
@TobiasLee
Copy link
Member

Thanks for the question. If you want to prepare the uncertainty score files, you can use the teacher models to perform predictions on the whole dataset and save the prediction uncertainty to form a score file.
We uploaded the script used for running the inference 'scripts/md_cnews.sh' and the corresponding main program 'run_mc.py', you can check the models/monte_carlo.py for detailed computation.
If you have further questions, please do not hesitate to discuss them here, and we are glad to help.

@Nero0113
Copy link
Author

Thank you for your kind help, best regard.

@Nero0113
Copy link
Author

Thanks for the question. If you want to prepare the uncertainty score files, you can use the teacher models to perform predictions on the whole dataset and save the prediction uncertainty to form a score file. We uploaded the script used for running the inference 'scripts/md_cnews.sh' and the corresponding main program 'run_mc.py', you can check the models/monte_carlo.py for detailed computation. If you have further questions, please do not hesitate to discuss them here, and we are glad to help.

Please tell me how to add small perturbations in the inference process, I didn't get it from the code.

@TobiasLee
Copy link
Member

The monte carlo dropout is easy to implement with the inner Dropout modules of teacher models.
We just make sure the teacher models are in the training mode(default setting) with Dropout activated, and run forward prediction several times to get the different predictions with different dropout masks:
https://github.com/lancopku/MUKI/blob/main/models/monte_carlo.py#L73

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

2 participants