rhine-bayes 1.7 → 1.8
raw patch · 2 files changed
+20/−14 lines, 2 filesdep ~basedep ~rhinedep ~rhine-glossPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, rhine, rhine-gloss
API changes (from Hackage documentation)
+ FRP.Rhine.Bayes: instance (GHC.Base.Monad m, Data.Automaton.Schedule.MonadSchedule m) => Data.Automaton.Schedule.MonadSchedule (Control.Monad.Bayes.Sampler.Strict.SamplerT g m)
Files
- rhine-bayes.cabal +5/−4
- src/FRP/Rhine/Bayes.hs +15/−10
rhine-bayes.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: rhine-bayes-version: 1.7+version: 1.8 synopsis: monad-bayes backend for Rhine description: This package provides a backend to the @monad-bayes@ library,@@ -30,11 +30,11 @@ common opts build-depends: automaton,- base >=4.16 && <4.22,+ base >=4.18 && <4.22, log-domain >=0.12, mmorph ^>=1.2, monad-bayes ^>=1.3.0.5,- rhine ^>=1.7,+ rhine ^>=1.8, transformers >=0.5, default-extensions:@@ -50,6 +50,7 @@ RankNTypes ScopedTypeVariables TupleSections+ TypeApplications TypeFamilies TypeOperators @@ -71,7 +72,7 @@ hs-source-dirs: app build-depends: rhine-bayes,- rhine-gloss ^>=1.7,+ rhine-gloss ^>=1.8, time, ghc-options:
src/FRP/Rhine/Bayes.hs view
@@ -1,16 +1,17 @@+{-# OPTIONS_GHC -fno-warn-orphans #-}+ module FRP.Rhine.Bayes where -- transformers import Control.Monad.Trans.Reader (ReaderT (..)) --- log-domain-import Numeric.Log hiding (sum)- -- monad-bayes import Control.Monad.Bayes.Class import Control.Monad.Bayes.Population+import Control.Monad.Bayes.Sampler.Strict (SamplerT (..)) -- automaton+import Data.Automaton.Schedule (MonadSchedule (..)) import qualified Data.Automaton.Trans.Reader as AutomatonReader -- rhine-bayes@@ -19,6 +20,10 @@ -- rhine import FRP.Rhine +-- | 'SamplerT' is a newtype over 'ReaderT', so it inherits 'MonadSchedule' via 'hoistS'.+instance (Monad m, MonadSchedule m) => MonadSchedule (SamplerT g m) where+ schedule = fmap (hoistS runSamplerT) >>> schedule >>> hoistS SamplerT+ -- * Inference methods -- | Run the Sequential Monte Carlo algorithm continuously on a 'ClSF'.@@ -102,11 +107,11 @@ wienerVaryingLogDomain = wienerVarying >>> arr Exp {- | Inhomogeneous Poisson point process, as described in:- https://en.wikipedia.org/wiki/Poisson_point_process#Inhomogeneous_Poisson_point_process+ https://en.wikipedia.org/wiki/Poisson_point_process#Inhomogeneous_Poisson_point_process - * The input is the inverse of the current rate or intensity.- It corresponds to the average duration between two events.- * The output is the number of events since the last tick.+ * The input is the inverse of the current rate or intensity.+ It corresponds to the average duration between two events.+ * The output is the number of events since the last tick. -} poissonInhomogeneous :: (MonadDistribution m, Real (Diff td), Fractional (Diff td)) =>@@ -123,7 +128,7 @@ {- | The Gamma process, https://en.wikipedia.org/wiki/Gamma_process. - The live input corresponds to inverse shape parameter, which is variance over mean.+ The live input corresponds to inverse shape parameter, which is variance over mean. -} gammaInhomogeneous :: (MonadDistribution m, Real (Diff td), Fractional (Diff td), Floating (Diff td)) =>@@ -136,8 +141,8 @@ {- | The inhomogeneous Bernoulli process, https://en.wikipedia.org/wiki/Bernoulli_process - Throws a coin to a given probability at each tick.- The live input is the probability.+ Throws a coin to a given probability at each tick.+ The live input is the probability. -} bernoulliInhomogeneous :: (MonadDistribution m) => BehaviourF m td Double Bool bernoulliInhomogeneous = arrMCl bernoulli