UncertaintyQuantification.jl icon indicating copy to clipboard operation
UncertaintyQuantification.jl copied to clipboard

Bayesian updating framework

Open FriesischScott opened this issue 2 years ago • 3 comments

This is where I'll update/improve the framework to better integrate it into the existing code base.

FriesischScott avatar Apr 08 '22 13:04 FriesischScott

Implemented right now are

  • Metropolis Hastings mh()
  • Gibbs Sampler gibbssample()
  • Transitional MCMC tmcmc()
  • Sequential Monte Carlo 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.

FriesischScott avatar May 25 '22 11:05 FriesischScott

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.

FriesischScott avatar Apr 05 '23 14:04 FriesischScott

Codecov Report

Attention: 228 lines in your changes are missing coverage. Please review.

Comparison is base (e2d4772) 98.27% compared to head (c182077) 80.95%. Report is 3 commits behind head on master.

:exclamation: Current head c182077 differs from pull request most recent head 6ffd1ae. Consider uploading reports for the commit 6ffd1ae to get more accurate results

Files Patch % Lines
src/simulations/bayesianinference.jl 0.00% 179 Missing :warning:
src/inference/bayesianupdating.jl 28.35% 48 Missing :warning:
src/inference/likelihood.jl 0.00% 1 Missing :warning:
Additional details and impacted files
@@             Coverage Diff             @@
##           master      #63       +/-   ##
===========================================
- Coverage   98.27%   80.95%   -17.32%     
===========================================
  Files          27       30        +3     
  Lines        1045     1292      +247     
===========================================
+ Hits         1027     1046       +19     
- Misses         18      246      +228     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jan 27 '24 13:01 codecov[bot]