Copyright | 2021 Dominik Schrempf |
---|---|
License | GPL-3.0-or-later |
Maintainer | dominik.schrempf@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Creation date: Thu Jul 8 18:12:07 2021.
Synopsis
- type AcceptanceRate = Double
- data AcceptanceCounts = AcceptanceCounts {}
- data AcceptanceRates = AcceptanceRates {}
- data Acceptance
- data Acceptances k
- emptyA :: Ord k => [k] -> Acceptances k
- pushAccept :: Ord k => Maybe AcceptanceRates -> k -> Acceptances k -> Acceptances k
- pushReject :: Ord k => Maybe AcceptanceRates -> k -> Acceptances k -> Acceptances k
- data ResetAcceptance
- resetA :: Ord k => ResetAcceptance -> Acceptances k -> Acceptances k
- transformKeysA :: (Ord k1, Ord k2) => [(k1, k2)] -> Acceptances k1 -> Acceptances k2
- acceptanceRate :: Ord k => k -> Acceptances k -> (Int, Int, Maybe AcceptanceRate, Maybe AcceptanceRate)
- acceptanceRates :: Acceptances k -> Map k (Maybe AcceptanceRate)
Acceptance rates
type AcceptanceRate = Double Source #
Acceptance rate.
data AcceptanceCounts Source #
Number of accepted and rejected proposals.
Instances
data AcceptanceRates Source #
Proposals based on Hamiltonian dynamics use expected acceptance rates, not counts.
Instances
FromJSON AcceptanceRates Source # | |
Defined in Mcmc.Acceptance parseJSON :: Value -> Parser AcceptanceRates # parseJSONList :: Value -> Parser [AcceptanceRates] # | |
ToJSON AcceptanceRates Source # | |
Defined in Mcmc.Acceptance toJSON :: AcceptanceRates -> Value # toEncoding :: AcceptanceRates -> Encoding # toJSONList :: [AcceptanceRates] -> Value # toEncodingList :: [AcceptanceRates] -> Encoding # omitField :: AcceptanceRates -> Bool # | |
Show AcceptanceRates Source # | |
Defined in Mcmc.Acceptance showsPrec :: Int -> AcceptanceRates -> ShowS # show :: AcceptanceRates -> String # showList :: [AcceptanceRates] -> ShowS # | |
Eq AcceptanceRates Source # | |
Defined in Mcmc.Acceptance (==) :: AcceptanceRates -> AcceptanceRates -> Bool # (/=) :: AcceptanceRates -> AcceptanceRates -> Bool # |
data Acceptance Source #
Stored actual acceptance counts and maybe expected acceptance rates.
Instances
FromJSON Acceptance Source # | |
Defined in Mcmc.Acceptance parseJSON :: Value -> Parser Acceptance # parseJSONList :: Value -> Parser [Acceptance] # | |
ToJSON Acceptance Source # | |
Defined in Mcmc.Acceptance toJSON :: Acceptance -> Value # toEncoding :: Acceptance -> Encoding # toJSONList :: [Acceptance] -> Value # toEncodingList :: [Acceptance] -> Encoding # omitField :: Acceptance -> Bool # | |
Show Acceptance Source # | |
Defined in Mcmc.Acceptance showsPrec :: Int -> Acceptance -> ShowS # show :: Acceptance -> String # showList :: [Acceptance] -> ShowS # | |
Eq Acceptance Source # | |
Defined in Mcmc.Acceptance (==) :: Acceptance -> Acceptance -> Bool # (/=) :: Acceptance -> Acceptance -> Bool # |
data Acceptances k Source #
For each key k
, store the number of accepted and rejected proposals.
Instances
(Ord k, FromJSONKey k) => FromJSON (Acceptances k) Source # | |
Defined in Mcmc.Acceptance parseJSON :: Value -> Parser (Acceptances k) # parseJSONList :: Value -> Parser [Acceptances k] # omittedField :: Maybe (Acceptances k) # | |
ToJSONKey k => ToJSON (Acceptances k) Source # | |
Defined in Mcmc.Acceptance toJSON :: Acceptances k -> Value # toEncoding :: Acceptances k -> Encoding # toJSONList :: [Acceptances k] -> Value # toEncodingList :: [Acceptances k] -> Encoding # omitField :: Acceptances k -> Bool # | |
Show k => Show (Acceptances k) Source # | |
Defined in Mcmc.Acceptance showsPrec :: Int -> Acceptances k -> ShowS # show :: Acceptances k -> String # showList :: [Acceptances k] -> ShowS # | |
Eq k => Eq (Acceptances k) Source # | |
Defined in Mcmc.Acceptance (==) :: Acceptances k -> Acceptances k -> Bool # (/=) :: Acceptances k -> Acceptances k -> Bool # |
emptyA :: Ord k => [k] -> Acceptances k Source #
In the beginning there was the Word.
Initialize an empty storage of accepted/rejected values.
pushAccept :: Ord k => Maybe AcceptanceRates -> k -> Acceptances k -> Acceptances k Source #
For key k
, add an accept.
pushReject :: Ord k => Maybe AcceptanceRates -> k -> Acceptances k -> Acceptances k Source #
For key k
, add a reject.
data ResetAcceptance Source #
Reset acceptance specification.
ResetEverything | Reset actual acceptance counts and expected acceptance rates. |
ResetExpectedRatesOnly | Only reset expected acceptance rates. |
resetA :: Ord k => ResetAcceptance -> Acceptances k -> Acceptances k Source #
Reset acceptance counts.
transformKeysA :: (Ord k1, Ord k2) => [(k1, k2)] -> Acceptances k1 -> Acceptances k2 Source #
Transform keys using the given lists. Keys not provided will not be present
in the new Acceptance
variable.
:: Ord k | |
=> k | |
-> Acceptances k | |
-> (Int, Int, Maybe AcceptanceRate, Maybe AcceptanceRate) | (nAccepts, nRejects, actualRate, expectedRate) |
Compute acceptance counts, and actual and expected acceptances rates for a specific proposal.
Return Just (accepts, rejects, acceptance rate)
.
Return Nothing
if no proposals have been accepted or rejected (division by
zero).
acceptanceRates :: Acceptances k -> Map k (Maybe AcceptanceRate) Source #
Compute actual acceptance rates for all proposals.
Set rate to Nothing
if no proposals have been accepted or rejected
(division by zero).