Safe Haskell | None |
---|---|
Language | Haskell2010 |
Probability-related types.
TODO instances for serialization and further stuff TODO vector instances
Synopsis
- data IsNormalized
- newtype Prob (n :: IsNormalized) x = Prob {
- getProb :: x
- prob :: (Ord x, Num x, Show x) => x -> Prob Normalized x
- prob' :: (Ord x, Num x, Show x) => x -> Prob NotNormalized x
- newtype LogProb (n :: IsNormalized) x = LogProb {
- getLogProb :: x
- withLog1 :: (Log x -> Log y) -> LogProb n x -> LogProb n y
- withLog2 :: (Log x -> Log y -> Log z) -> LogProb n x -> LogProb n y -> LogProb n z
- p2lp :: Floating x => Prob n x -> LogProb n x
- lp2p :: Floating x => LogProb n x -> Prob n x
- aslp :: Floating x => Iso' (Prob n x) (LogProb n x)
Documentation
Probability in linear space
newtype Prob (n :: IsNormalized) x Source #
Prob
wraps a Double
that encodes probabilities. If Prob
is tagged as
Normalized
, the contained values are in the range [0,...,1]
, otherwise
they are in the range [0,...,∞]
.
Instances
prob :: (Ord x, Num x, Show x) => x -> Prob Normalized x Source #
Turns a value into a normalized probability. error
if the value is not
in the range [0,...,1]
.
prob' :: (Ord x, Num x, Show x) => x -> Prob NotNormalized x Source #
Simple wrapper around Prob
that fixes non-normalization.
Probability in log space. A number of operations internally cast to Log
newtype LogProb (n :: IsNormalized) x Source #
LogProb | |
|