| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Statistics.Probability
Contents
Description
Probability-related types.
TODO instances for serialization and further stuff TODO vector instances
Synopsis
- data IsNormalized
- newtype Probability (n :: IsNormalized) x = Prob {
- getProb :: x
- prob :: (Ord x, Num x, Show x) => x -> Probability Normalized x
- prob' :: (Ord x, Num x, Show x) => x -> Probability NotNormalized x
- probabilityToChar :: (Num k, RealFrac k) => Probability Normalized k -> Char
Documentation
data IsNormalized Source #
Constructors
| Normalized | |
| NotNormalized |
Probability in linear space
newtype Probability (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 -> Probability 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 -> Probability NotNormalized x Source #
Simple wrapper around Probability that fixes non-normalization.
probabilityToChar :: (Num k, RealFrac k) => Probability Normalized k -> Char Source #
This simple function represents probabilities with characters between '0'
0.0 -- 0.05 up to '9' 0.85 -- 0.95 and finally * for >0.95.