|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgov.sandia.cognition.util.AbstractCloneableSerializable
gov.sandia.cognition.algorithm.AbstractIterativeAlgorithm
gov.sandia.cognition.algorithm.AbstractAnytimeAlgorithm<ResultType>
gov.sandia.cognition.learning.algorithm.AbstractAnytimeBatchLearner<Collection<? extends ObservationType>,DataDistribution<ParameterType>>
gov.sandia.cognition.statistics.bayesian.AbstractMarkovChainMonteCarlo<ObservationType,ParameterType>
gov.sandia.cognition.statistics.bayesian.MetropolisHastingsAlgorithm<ObservationType,ParameterType>
ObservationType
- Type of observations handled by the MCMC algorithm.ParameterType
- Type of parameters to infer.@PublicationReference(author="Wikipedia", title="Metropolis\u2013Hastings algorithm", type=WebPage, year=2009, url="http://en.wikipedia.org/wiki/Metropolis-Hastings_algorithm") public class MetropolisHastingsAlgorithm<ObservationType,ParameterType>
An implementation of the Metropolis-Hastings MCMC algorithm, which is the most general formulation of MCMC but can be slow.
Nested Class Summary | |
---|---|
static interface |
MetropolisHastingsAlgorithm.Updater<ObservationType,ParameterType>
Creates proposals for the MCMC steps. |
Field Summary | |
---|---|
static String |
PERFORMANCE_NAME
Performance statistic name, "Current Log Likelihood". |
protected MetropolisHastingsAlgorithm.Updater<ObservationType,ParameterType> |
updater
The object that makes proposal samples from the current location. |
Fields inherited from class gov.sandia.cognition.statistics.bayesian.AbstractMarkovChainMonteCarlo |
---|
currentParameter, DEFAULT_NUM_SAMPLES, previousParameter, random |
Fields inherited from class gov.sandia.cognition.learning.algorithm.AbstractAnytimeBatchLearner |
---|
data, keepGoing |
Fields inherited from class gov.sandia.cognition.algorithm.AbstractAnytimeAlgorithm |
---|
maxIterations |
Fields inherited from class gov.sandia.cognition.algorithm.AbstractIterativeAlgorithm |
---|
DEFAULT_ITERATION, iteration |
Constructor Summary | |
---|---|
MetropolisHastingsAlgorithm()
Creates a new instance of MetropolisHastingsAlgorithm. |
Method Summary | |
---|---|
MetropolisHastingsAlgorithm<ObservationType,ParameterType> |
clone()
This makes public the clone method on the Object class and
removes the exception that it throws. |
ParameterType |
createInitialLearnedObject()
Creates the initial parameters from which to start the Markov chain. |
NamedValue<Double> |
getPerformance()
Gets the name-value pair that describes the current performance of the algorithm. |
MetropolisHastingsAlgorithm.Updater<ObservationType,ParameterType> |
getUpdater()
Gets the object that makes proposal samples from the current location. |
protected boolean |
initializeAlgorithm()
Called to initialize the learning algorithm's state based on the data that is stored in the data field. |
protected void |
mcmcUpdate()
Performs a valid MCMC update step. |
void |
setUpdater(MetropolisHastingsAlgorithm.Updater<ObservationType,ParameterType> updater)
Sets the object that makes proposal samples from the current location. |
Methods inherited from class gov.sandia.cognition.statistics.bayesian.AbstractMarkovChainMonteCarlo |
---|
cleanupAlgorithm, getBurnInIterations, getCurrentParameter, getIterationsPerSample, getPreviousParameter, getRandom, getResult, setBurnInIterations, setCurrentParameter, setIterationsPerSample, setRandom, setResult, step |
Methods inherited from class gov.sandia.cognition.learning.algorithm.AbstractAnytimeBatchLearner |
---|
getData, getKeepGoing, learn, setData, setKeepGoing, stop |
Methods inherited from class gov.sandia.cognition.algorithm.AbstractAnytimeAlgorithm |
---|
getMaxIterations, isResultValid, setMaxIterations |
Methods inherited from class gov.sandia.cognition.algorithm.AbstractIterativeAlgorithm |
---|
addIterativeAlgorithmListener, fireAlgorithmEnded, fireAlgorithmStarted, fireStepEnded, fireStepStarted, getIteration, getListeners, removeIterativeAlgorithmListener, setIteration, setListeners |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface gov.sandia.cognition.learning.algorithm.BatchLearner |
---|
learn |
Methods inherited from interface gov.sandia.cognition.algorithm.AnytimeAlgorithm |
---|
getMaxIterations, setMaxIterations |
Methods inherited from interface gov.sandia.cognition.algorithm.IterativeAlgorithm |
---|
addIterativeAlgorithmListener, getIteration, removeIterativeAlgorithmListener |
Methods inherited from interface gov.sandia.cognition.algorithm.StoppableAlgorithm |
---|
isResultValid, stop |
Field Detail |
---|
public static final String PERFORMANCE_NAME
protected MetropolisHastingsAlgorithm.Updater<ObservationType,ParameterType> updater
Constructor Detail |
---|
public MetropolisHastingsAlgorithm()
Method Detail |
---|
public MetropolisHastingsAlgorithm<ObservationType,ParameterType> clone()
AbstractCloneableSerializable
Object
class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone()
to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil
may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone()
as the basis for your implementation.
clone
in interface CloneableSerializable
clone
in class AbstractMarkovChainMonteCarlo<ObservationType,ParameterType>
protected boolean initializeAlgorithm()
AbstractAnytimeBatchLearner
initializeAlgorithm
in class AbstractMarkovChainMonteCarlo<ObservationType,ParameterType>
protected void mcmcUpdate()
AbstractMarkovChainMonteCarlo
mcmcUpdate
in class AbstractMarkovChainMonteCarlo<ObservationType,ParameterType>
public NamedValue<Double> getPerformance()
MeasurablePerformanceAlgorithm
getPerformance
in interface MeasurablePerformanceAlgorithm
public MetropolisHastingsAlgorithm.Updater<ObservationType,ParameterType> getUpdater()
public void setUpdater(MetropolisHastingsAlgorithm.Updater<ObservationType,ParameterType> updater)
updater
- The object that makes proposal samples from the current location.public ParameterType createInitialLearnedObject()
AbstractMarkovChainMonteCarlo
createInitialLearnedObject
in class AbstractMarkovChainMonteCarlo<ObservationType,ParameterType>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |