Closed FriesischScott closed 2 months ago
Implemented right now are
mh()
gibbssample()
tmcmc()
smc()
along with some helper methods.
To clean this up I would like to unify the interface somehow. My suggestion:
Have all methods called bayesian_inference()
or some variation of it. These will take the values that are the same among all algorithms while the extra parameters are grouped into structs like
struct TransitionalMarkovChainMonteCarlo begin
...
end
struct SequentialMonteCarlo begin
...
end
For metropolis-hastings as well as tmcmc we would just wrap around TransitionalMCMC.jl
if possible. No need to reinvent the wheel.
Ideally, the method signature would include the arguments that all of the methods have (if they exist). Like
function bayesian_model_updating(likelihood::Function, prior::Function, bmu::AbstractBayesianModelUpdating)
...
end
where the bmu
includes everything else based on the method that should be used (Transitional, Sequential, MH, etc.). If that makes sense.
Having a common interface and grouping the extras in the struct
seems fairly reasonable. Not 100% sure though.
Attention: Patch coverage is 81.89655%
with 21 lines
in your changes missing coverage. Please review.
Project coverage is 90.16%. Comparing base (
69f74ff
) to head (97f51ad
). Report is 2 commits behind head on master.:exclamation: Current head 97f51ad differs from pull request most recent head 5985448
Please upload reports for the commit 5985448 to get more accurate results.
Files | Patch % | Lines |
---|---|---|
src/modelupdating/bayesianupdating.jl | 81.89% | 21 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
For testing of MCMC methods in bayesian updating, we can use conjugate priors to get analytical solutions to simple updating problems.
There are tables in wikipedia: https://en.wikipedia.org/wiki/Conjugate_prior
For example a prior and likelihood which are both normal, will also produce a normal posterior. The parameters of the posterior depend on the parameters of the prior and likelihood. The updating rules can be found in the tables.
I will write a bit of documentation before the merge. Code -wise, it should be OK for now. We can always extend with more algorithms in the future.
This is where I'll update/improve the framework to better integrate it into the existing code base.