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

Use Logging module in tmcmc function #15

Merged
merged 2 commits into from
Apr 14, 2021
Merged

Use Logging module in tmcmc function #15

merged 2 commits into from
Apr 14, 2021

Conversation

FriesischScott
Copy link
Collaborator

I decided to use @info to log the beta value of the current iteration. The rest of the statements hold little value for the end user in my opinion so I used @debug to log them. Standard logging looks like this:

[ Info: β_1 = 0.016394779086112976
[ Info: β_2 = 0.06899239096730403
[ Info: β_3 = 0.23616091794255514
[ Info: β_4 = 0.6787443625386766
[ Info: β_5 = 1.0

The debug statements can be turned of by setting the JULIA_DEBUG=TransitionalMCMC environment variable.

┌ Debug: Beginnig iteration 1
└ @ TransitionalMCMC ~/src/github.com/AnderGray/TransitionalMCMC.jl/src/tmcmc.jl:39
┌ Debug: Computing likelihood with 1 workers...
└ @ TransitionalMCMC ~/src/github.com/AnderGray/TransitionalMCMC.jl/src/tmcmc.jl:45
┌ Debug: Computing β_j...
└ @ TransitionalMCMC ~/src/github.com/AnderGray/TransitionalMCMC.jl/src/tmcmc.jl:55
[ Info: β_1 = 0.015737786889076233
┌ Debug: Computing weights...
└ @ TransitionalMCMC ~/src/github.com/AnderGray/TransitionalMCMC.jl/src/tmcmc.jl:74
┌ Debug: Markov chains with 1 workers...
└ @ TransitionalMCMC ~/src/github.com/AnderGray/TransitionalMCMC.jl/src/tmcmc.jl:106

This way the tmcmc reports the progress without adding to much noise.

Closes #14

@AnderGray
Copy link
Owner

Thanks for this, I agree.

Although I think maybe the likelihood and Makov chain prints statements should be an info instead of a debug.
Do you know if there's anyway to change the verbosity of the logging?

@FriesischScott
Copy link
Collaborator Author

FriesischScott commented Apr 14, 2021

Statements like "we are now doing something" don't add a lot of value in my opinion. But since they might take some time depending on the problem it might not be too bad to show them. Want me to change them to @info?

You can disable output for everything below a certain log level with disable_logging(level) e.g. disable_logging(Logging.Info) will disable everything equal to info and below.

@AnderGray AnderGray merged commit 0310a69 into main Apr 14, 2021
@AnderGray
Copy link
Owner

You're right, merged!

@AnderGray AnderGray deleted the logging branch April 14, 2021 15:48
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.

Use the Logging module to print info messages
2 participants