public class MetropolisHastings extends AbstractMetropolis
Modifier and Type | Class and Description |
---|---|
static interface |
MetropolisHastings.ProposalDensityFunction
Defines the density of a proposal function, i.e.
|
Constructor and Description |
---|
MetropolisHastings(RealScalarFunction logf,
ProposalFunction proposalFunction,
MetropolisHastings.ProposalDensityFunction proposalDensity,
Vector initialState,
RandomNumberGenerator rng)
Constructs a new instance with the given parameters.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
isProposalAccepted(Vector x,
Vector y)
Decides whether the given proposed state should be accepted, or whether the system should
remain in it's current state.
|
protected Vector |
nextProposedState(Vector currentState)
Proposes a next state for the system.
|
acceptanceRate, nextVector, seed
public MetropolisHastings(RealScalarFunction logf, ProposalFunction proposalFunction, MetropolisHastings.ProposalDensityFunction proposalDensity, Vector initialState, RandomNumberGenerator rng)
logf
- the log of the unnormalized pdf from which we wish to sampleproposalFunction
- generates a proposal for the next state, given the current stateproposalDensity
- the proposal density (see explanation in
MetropolisHastings.ProposalDensityFunction)initialState
- the initial state of the algorithmrng
- a random number generatorprotected Vector nextProposedState(Vector currentState)
AbstractMetropolis
nextProposedState
in class AbstractMetropolis
currentState
- the current state of the systemprotected boolean isProposalAccepted(Vector x, Vector y)
AbstractMetropolis
isProposalAccepted
in class AbstractMetropolis
x
- the current state of the systemy
- the proposed next state of the systemCopyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.