mcmc-0.8.2.0: Sample from a posterior using Markov chain Monte Carlo
Copyright2021 Dominik Schrempf
LicenseGPL-3.0-or-later
Maintainerdominik.schrempf@gmail.com
Stabilityunstable
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Mcmc.Chain.Save

Description

Creation date: Tue Jun 16 10:18:54 2020.

Save and load chains. It is easy to save and restore the current state and likelihood (or the trace), but it is not feasible to store all the proposals and so on, so they have to be provided again when continuing a run.

Synopsis

Documentation

data SavedChain a Source #

Storable values of a Markov chain.

See toSavedChain.

Instances

Instances details
FromJSON a => FromJSON (SavedChain a) Source # 
Instance details

Defined in Mcmc.Chain.Save

ToJSON a => ToJSON (SavedChain a) Source # 
Instance details

Defined in Mcmc.Chain.Save

Show a => Show (SavedChain a) Source # 
Instance details

Defined in Mcmc.Chain.Save

Eq a => Eq (SavedChain a) Source # 
Instance details

Defined in Mcmc.Chain.Save

Methods

(==) :: SavedChain a -> SavedChain a -> Bool #

(/=) :: SavedChain a -> SavedChain a -> Bool #

toSavedChain :: Chain a -> IO (SavedChain a) Source #

Save a chain.

fromSavedChain :: PriorFunction a -> LikelihoodFunction a -> Cycle a -> Monitor a -> SavedChain a -> IO (Chain a) Source #

Load a saved chain.

Perform some safety checks:

Check that the number of proposals is equal.

Recompute and check the prior and likelihood for the last state because the functions may have changed. Of course, we cannot test for the same function, but having the same prior and likelihood at the last state is already a good indicator.

fromSavedChainUnsafe :: PriorFunction a -> LikelihoodFunction a -> Cycle a -> Monitor a -> SavedChain a -> IO (Chain a) Source #

See fromSavedChain but do not perform sanity checks. Useful when restarting a run with changed prior function, likelihood function or proposals.