mixle.inference.mcmc.proposals moduleΒΆ
Proposal kernels for Metropolis-Hastings samplers.
- class Proposal[source]
Bases:
objectBase proposal protocol for Metropolis-Hastings kernels.
- sample(current, rng)[source]
Draw a proposed state given the current state.
- Parameters:
current (Any)
rng (RandomState)
- Return type:
- log_density(proposed, current)[source]
Return
log q(proposed | current)for Hastings correction.
- class RandomWalkProposal(scale)[source]
Bases:
ProposalSymmetric Gaussian random-walk proposal for scalar/vector states.
- Parameters:
scale (Any)
- sample(current, rng)[source]
Draw a Gaussian random-walk proposal centered at
current.- Parameters:
current (Any)
rng (RandomState)
- Return type:
- class AdaptiveRandomWalkProposal(scale, target_acceptance=0.44, adaptation_rate=0.05, adapt_during_burn_in_only=True, min_scale=1.0e-12, max_scale=1.0e12)[source]
Bases:
RandomWalkProposalGaussian random walk with Robbins-Monro scale adaptation.
By default adaptation only runs during burn-in, which preserves the stationary post-burn chain used for retained samples.
- Parameters:
- class AdaptiveCovarianceProposal(initial_covariance=1.0, scale=None, regularization=1.0e-6, adapt_after=2, adapt_during_burn_in_only=True)[source]
Bases:
ProposalFull-covariance Gaussian random walk with burn-in covariance learning.
- Parameters:
- sample(current, rng)[source]
Draw a full-covariance Gaussian random-walk proposal.
- Parameters:
current (Any)
rng (RandomState)
- Return type:
- log_density(proposed, current)[source]
Return the current adaptive Gaussian proposal log density.
- class IndependentProposal(sampler, log_density=None)[source]
Bases:
ProposalIndependence proposal from a sampler plus optional log density.
- Parameters:
sampler (Callable[[np.random.RandomState], Any])
log_density (Callable[[Any], float] | None)
- sample(current, rng)[source]
Draw a state independent of
currentfrom the supplied sampler.- Parameters:
current (Any)
rng (RandomState)
- Return type:
- class MixtureProposal(proposals, weights=None)[source]
Bases:
ProposalMixture of proposal kernels with exact mixture proposal density.
- Parameters:
proposals (Sequence[Proposal])
weights (Sequence[float] | None)
- sample(current, rng)[source]
Draw from one mixture component proposal and remember its index.
- Parameters:
current (Any)
rng (RandomState)
- Return type:
- log_density(proposed, current)[source]
Return the log mixture density of all component proposals.
- class BlockProposal(keys, proposal)[source]
Bases:
ProposalLift a proposal on one or more mapping fields to a full-record proposal.
- Parameters:
keys (Any)
proposal (Proposal)
- sample(current, rng)[source]
Propose a replacement for the configured mapping field block.
- log_density(proposed, current)[source]
Return the block proposal density inside the full mapping state.
- class LangevinProposal(step_size, grad_log_target)[source]
Bases:
ProposalMetropolis-adjusted Langevin proposal for scalar/vector states.
- Parameters:
step_size (float)
grad_log_target (Callable[[Any], Any])
- sample(current, rng)[source]
Draw a MALA proposal centered at the Langevin drift mean.
- Parameters:
current (Any)
rng (RandomState)
- Return type: