Copyright | (c) Adam Scibior 2015-2020 |
---|---|
License | MIT |
Maintainer | leonhard.markert@tweag.io |
Stability | experimental |
Portability | GHC |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
WeightedT
is an instance of MonadFactor
. Apply a MonadDistribution
transformer to
obtain a MonadMeasure
that can execute probabilistic models.
Synopsis
- data WeightedT m a
- weightedT :: Monad m => m (a, Log Double) -> WeightedT m a
- extractWeight :: Functor m => WeightedT m a -> m (Log Double)
- unweighted :: Functor m => WeightedT m a -> m a
- applyWeight :: MonadFactor m => WeightedT m a -> m a
- hoist :: (forall x. m x -> n x) -> WeightedT m a -> WeightedT n a
- runWeightedT :: WeightedT m a -> m (a, Log Double)
Documentation
Execute the program using the prior distribution, while accumulating likelihood.
Instances
weightedT :: Monad m => m (a, Log Double) -> WeightedT m a Source #
Embed a random variable with explicitly given likelihood.
runWeightedT . weightedT = id
extractWeight :: Functor m => WeightedT m a -> m (Log Double) Source #
Compute the weight and discard the sample.
unweighted :: Functor m => WeightedT m a -> m a Source #
Compute the sample and discard the weight.
This operation introduces bias.
applyWeight :: MonadFactor m => WeightedT m a -> m a Source #
Use the weight as a factor in the transformed monad.