Copyright | (c) Adam Scibior 2015-2020 |
---|---|
License | MIT |
Maintainer | leonhard.markert@tweag.io |
Stability | experimental |
Portability | GHC |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- data Enumerator a
- logExplicit :: Enumerator a -> [(a, Log Double)]
- explicit :: Enumerator a -> [(a, Double)]
- evidence :: Enumerator a -> Log Double
- mass :: Ord a => Enumerator a -> a -> Double
- compact :: (Num r, Ord a, Ord r) => [(a, r)] -> [(a, r)]
- enumerator :: Ord a => Enumerator a -> [(a, Double)]
- enumerate :: Ord a => Enumerator a -> [(a, Double)]
- expectation :: (a -> Double) -> Enumerator a -> Double
- normalForm :: Ord a => Enumerator a -> [(a, Double)]
- toEmpirical :: (Fractional b, Ord a, Ord b) => [a] -> [(a, b)]
- toEmpiricalWeighted :: (Fractional b, Ord a, Ord b) => [(a, b)] -> [(a, b)]
- normalizeWeights :: Fractional b => [(a, b)] -> [(a, b)]
- enumerateToDistribution :: MonadDistribution n => Enumerator a -> n a
- removeZeros :: Enumerator a -> Enumerator a
- fromList :: [(a, Log Double)] -> Enumerator a
Documentation
data Enumerator a Source #
An exact inference transformer that integrates discrete random variables by enumerating all execution paths.
Instances
logExplicit :: Enumerator a -> [(a, Log Double)] Source #
Returns the posterior as a list of weight-value pairs without any post-processing, such as normalization or aggregation
explicit :: Enumerator a -> [(a, Double)] Source #
Same as toList
, only weights are converted from log-domain.
evidence :: Enumerator a -> Log Double Source #
Returns the model evidence, that is sum of all weights.
mass :: Ord a => Enumerator a -> a -> Double Source #
Normalized probability mass of a specific value.
compact :: (Num r, Ord a, Ord r) => [(a, r)] -> [(a, r)] Source #
Aggregate weights of equal values. The resulting list is sorted ascendingly according to values.
enumerator :: Ord a => Enumerator a -> [(a, Double)] Source #
Aggregate and normalize of weights. The resulting list is sorted ascendingly according to values.
enumerator = compact . explicit
enumerate :: Ord a => Enumerator a -> [(a, Double)] Source #
deprecated synonym
Aggregate and normalize of weights. The resulting list is sorted ascendingly according to values.
enumerator = compact . explicit
expectation :: (a -> Double) -> Enumerator a -> Double Source #
Expectation of a given function computed using normalized weights.
normalForm :: Ord a => Enumerator a -> [(a, Double)] Source #
compact
followed by removing values with zero weight.
toEmpirical :: (Fractional b, Ord a, Ord b) => [a] -> [(a, b)] Source #
toEmpiricalWeighted :: (Fractional b, Ord a, Ord b) => [(a, b)] -> [(a, b)] Source #
normalizeWeights :: Fractional b => [(a, b)] -> [(a, b)] Source #
Divide all weights by their sum.
enumerateToDistribution :: MonadDistribution n => Enumerator a -> n a Source #
removeZeros :: Enumerator a -> Enumerator a Source #