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

Space transformations refactor #449

Merged
merged 19 commits into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/src/experimental_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,14 @@ ReactiveNestedSampling
SobolSampler
truncate_batmeasure
ValueAndThreshold

BAT.MCMCIterator
BAT.MCMCTunerState
BAT.TemperingState
BAT.MCMCProposalState
BAT.MCMCTempering
BAT.MCMCState
BAT.MCMCChainState
BAT.MCMCChainStateInfo
BAT.MCMCProposal
```
1 change: 0 additions & 1 deletion docs/src/internal_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ BAT.FullMeasureTransform
BAT.LFDensity
BAT.LFDensityWithGrad
BAT.LogDVal
BAT.MCMCIterator
BAT.MCMCSampleGenerator
BAT.MeasureLike
BAT.NoWhitening
Expand Down
2 changes: 1 addition & 1 deletion docs/src/stable_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ MCMCInitAlgorithm
MCMCMultiCycleBurnin
MCMCNoOpTuning
MCMCSampling
MCMCTuningAlgorithm
MCMCTuning
MetropolisHastings
MHProposalDistTuning
ModeAsDefined
Expand Down
7 changes: 3 additions & 4 deletions docs/src/tutorial_lit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ posterior = PosteriorMeasure(likelihood, prior)
# Now we can generate a set of MCMC samples via [`bat_sample`](@ref). We'll
# use 4 MCMC chains with 10^5 MC steps in each chain (after tuning/burn-in):

samples = bat_sample(posterior, MCMCSampling(mcalg = MetropolisHastings(), nsteps = 10^5, nchains = 4)).result
samples = bat_sample(posterior, MCMCSampling(proposal = MetropolisHastings(), nsteps = 10^5, nchains = 4)).result
#md nothing # hide
#nb nothing # hide

Expand Down Expand Up @@ -377,8 +377,7 @@ plot!(-4:0.01:4, x -> fit_function(true_par_values, x), color=4, label = "Truth"
# We'll sample using the The Metropolis-Hastings MCMC algorithm:

mcmcalgo = MetropolisHastings(
weighting = RepetitionWeighting(),
tuning = AdaptiveMHTuning()
weighting = RepetitionWeighting()
)

# BAT requires a counter-based random number generator (RNG), since it
Expand Down Expand Up @@ -414,7 +413,7 @@ convergence = BrooksGelmanConvergence()
samples = bat_sample(
posterior,
MCMCSampling(
mcalg = mcmcalgo,
proposal = mcmcalgo,
nchains = 4,
nsteps = 10^5,
init = init,
Expand Down
2 changes: 1 addition & 1 deletion examples/paper-example/paper_example.jl
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ posterior_bkg_signal = PosteriorMeasure(SignalBkgLikelihood(summary_dataset_tabl
nchains = 4
nsteps = 10^5

algorithm = MCMCSampling(mcalg = HamiltonianMC(), nchains = nchains, nsteps = nsteps)
algorithm = MCMCSampling(proposal = HamiltonianMC(), nchains = nchains, nsteps = nsteps)

samples_bkg = bat_sample(posterior_bkg, algorithm).result
eval_bkg = EvaluatedMeasure(posterior_bkg, samples = samples_bkg)
Expand Down
17 changes: 9 additions & 8 deletions ext/BATAdvancedHMCExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,21 @@ using HeterogeneousComputing, AutoDiffOperators
using BAT: MeasureLike, BATMeasure

using BAT: get_context, get_adselector, _NoADSelected
using BAT: getalgorithm, mcmc_target
using BAT: MCMCIterator, MCMCIteratorInfo, MCMCChainPoolInit, MCMCMultiCycleBurnin, AbstractMCMCTunerInstance
using BAT: AbstractTransformTarget
using BAT: RNGPartition, set_rng!
using BAT: mcmc_step!, nsamples, nsteps, samples_available, eff_acceptance_ratio
using BAT: get_samples!, get_mcmc_tuning, reset_rng_counters!
using BAT: tuning_init!, tuning_postinit!, tuning_reinit!, tuning_update!, tuning_finalize!, tuning_callback
using BAT: getproposal, mcmc_target
using BAT: MCMCChainState, HMCState, HamiltonianMC, HMCProposalState, MCMCChainStateInfo, MCMCChainPoolInit, MCMCMultiCycleBurnin, MCMCTunerState, NoMCMCTempering
using BAT: _current_sample_idx, _proposed_sample_idx, _cleanup_samples
using BAT: AbstractTransformTarget, TriangularAffineTransform
using BAT: RNGPartition, get_rng, set_rng!
using BAT: mcmc_step!!, nsamples, nsteps, samples_available, eff_acceptance_ratio
using BAT: get_samples!, reset_rng_counters!
using BAT: create_trafo_tuner_state, create_proposal_tuner_state, mcmc_tuning_init!!, mcmc_tuning_postinit!!, mcmc_tuning_reinit!!, mcmc_tune_transform_post_cycle!!, transform_mcmc_tuning_finalize!!, tuning_callback
using BAT: totalndof, measure_support, checked_logdensityof
using BAT: CURRENT_SAMPLE, PROPOSED_SAMPLE, INVALID_SAMPLE, ACCEPTED_SAMPLE, REJECTED_SAMPLE

using BAT: HamiltonianMC
using BAT: AHMCSampleID, AHMCSampleIDVector
using BAT: HMCMetric, DiagEuclideanMetric, UnitEuclideanMetric, DenseEuclideanMetric
using BAT: HMCTuningAlgorithm, MassMatrixAdaptor, StepSizeAdaptor, NaiveHMCTuning, StanHMCTuning
using BAT: HMCTuning, MassMatrixAdaptor, StepSizeAdaptor, NaiveHMCTuning, StanHMCTuning

using ValueShapes: varshape

Expand Down
Loading
Loading