|
|
|
|
|
|
| Synopsis |
|
| type Event a = a -> Bool | | | oneOf :: Eq a => [a] -> Event a | | | just :: Eq a => a -> Event a | | | newtype Probability = P ProbRep | | | type ProbRep = Float | | | precision :: Int | | | showPfix :: ProbRep -> String | | | roundRel :: RealFrac a => Int -> a -> a | | | showP :: ProbRep -> String | | | errorMargin :: ProbRep | | | (>@>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c | | | sequ :: Monad m => [a -> m a] -> a -> m a | | | newtype Dist a = D {} | | | isZero :: Dist a -> Bool | | | onD :: ([(a, ProbRep)] -> [(a, ProbRep)]) -> Dist a -> Dist a | | | sizeD :: Dist a -> Int | | | checkD :: Dist a -> Dist a | | | mkD :: [(a, ProbRep)] -> Dist a | | | sumP :: [(a, ProbRep)] -> ProbRep | | | sortP :: [(a, ProbRep)] -> [(a, ProbRep)] | | | normBy :: Ord a => (a -> a -> Bool) -> Dist a -> Dist a | | | accumBy :: Num b => (a -> a -> Bool) -> [(a, b)] -> [(a, b)] | | | norm :: Ord a => Dist a -> Dist a | | | norm' :: Ord a => [(a, ProbRep)] -> [(a, ProbRep)] | | | joinWith :: (a -> b -> c) -> Dist a -> Dist b -> Dist c | | | prod :: Dist a -> Dist b -> Dist (a, b) | | | type Spread a = [a] -> Dist a | | | certainly :: Trans a | | | impossible :: Dist a | | | choose :: ProbRep -> a -> a -> Dist a | | | enum :: [ProbRep] -> Spread a | | | enumPC :: [ProbRep] -> Spread a | | | relative :: [Int] -> Spread a | | | shape :: (Float -> Float) -> Spread a | | | linear :: Float -> Spread a | | | uniform :: Spread a | | | negexp :: Spread a | | | normal :: Spread a | | | normalCurve :: Float -> Float -> Float -> Float | | | extract :: Dist a -> [a] | | | mapD :: (a -> b) -> Dist a -> Dist b | | | unfoldD :: Dist (Dist a) -> Dist a | | | cond :: Dist Bool -> Dist a -> Dist a -> Dist a | | | truth :: Dist Bool -> Probability | | | (|||) :: Dist a -> Event a -> Dist a | | | | | above :: Ord a => ProbRep -> Dist a -> Dist (Select a) | | | scale :: [(a, ProbRep)] -> Dist a | | | filterD :: (a -> Bool) -> Dist a -> Dist a | | | selectP :: Dist a -> ProbRep -> a | | | scanP :: ProbRep -> [(a, ProbRep)] -> a | | | (??) :: Event a -> Dist a -> Probability | | | class ToFloat a where | | | | class FromFloat a where | | | | class Expected a where | | | | variance :: Expected a => Dist a -> Float | | | stddev :: Expected a => Dist a -> Float | | | type R a = IO a | | | printR :: Show a => R a -> R () | | | pick :: Dist a -> R a | | | type RDist a = R (Dist a) | | | rAbove :: Ord a => ProbRep -> RDist a -> RDist (Select a) | | | type Change a = a -> a | | | type Trans a = a -> Dist a | | | idT :: Trans a | | | mapT :: Change a -> Trans a -> Trans a | | | unfoldT :: Dist (Trans a) -> Trans a | | | type SpreadC a = [Change a] -> Trans a | | | certainlyT :: Change a -> Trans a | | | maybeT :: ProbRep -> Change a -> Trans a | | | liftC :: Spread a -> [Change a] -> Trans a | | | uniformT :: [Change a] -> Trans a | | | normalT :: [Change a] -> Trans a | | | linearT :: Float -> [Change a] -> Trans a | | | enumT :: [ProbRep] -> [Change a] -> Trans a | | | type SpreadT a = [Trans a] -> Trans a | | | liftT :: Spread (Trans a) -> [Trans a] -> Trans a | | | uniformTT :: [Trans a] -> Trans a | | | normalTT :: [Trans a] -> Trans a | | | linearTT :: Float -> [Trans a] -> Trans a | | | enumTT :: [ProbRep] -> [Trans a] -> Trans a | | | type RChange a = a -> R a | | | random :: Trans a -> RChange a | | | type RTrans a = a -> RDist a | | | type ApproxDist a = R [a] | | | rDist :: Ord a => [R a] -> RDist a | | | class Iterate c where | | (*.) :: Int -> (a -> c a) -> (a -> c a) | | while :: (a -> Bool) -> (a -> c a) -> (a -> c a) | | until :: (a -> Bool) -> (a -> c a) -> (a -> c a) |
| | | class Sim c where | | | | type Trace a = [a] | | | type Space a = Trace (Dist a) | | | type Walk a = a -> Trace a | | | type Expand a = a -> Space a | | | (>>:) :: Trans a -> Expand a -> Expand a | | | walk :: Int -> Change a -> Walk a | | | (*..) :: Int -> Trans a -> Expand a | | | type RTrace a = R (Trace a) | | | type RSpace a = R (Space a) | | | type RWalk a = a -> RTrace a | | | type RExpand a = a -> RSpace a | | | composelR :: RChange a -> RWalk a -> RWalk a | | | rWalk :: Int -> RChange a -> RWalk a | | | mergeTraces :: Ord a => [RTrace a] -> RSpace a |
|
|
|
| Auxiliary definitions
|
|
| Events
|
|
|
|
|
|
|
|
| Probabilities
|
|
|
| Constructors | | Instances | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Monad composition
|
|
| (>@>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c | Source |
|
| binary composition
|
|
|
| composition of a list of monadic functions
|
|
| Deterministic and probabilistic values
|
|
| Distributions
|
|
|
| probability disribution
| | Constructors | | Instances | |
|
|
|
|
| Auxiliary functions for constructing and working with distributions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Normalization = grouping
|
|
|
|
| accumBy :: Num b => (a -> a -> Bool) -> [(a, b)] -> [(a, b)] | Source |
|
|
|
|
|
|
| Operations on distributions
|
|
|
| product of independent distributions, identical to Monad.liftM2
|
|
|
|
| Spread: functions to convert a list of values into a distribution
|
|
|
| distribution generators
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| extracting and mapping the domain of a distribution
|
|
|
|
|
| unfold a distribution of distributions into one distribution
|
|
|
| conditional distribution
|
|
|
|
|
| conditional probability
|
|
|
| filtering distributions
| | Constructors | | Instances | |
|
|
|
|
|
|
|
|
|
| selecting from distributions
|
|
|
|
|
|
|
| | Methods | | | Instances | |
|
|
|
| | Methods | | | Instances | |
|
|
|
| | Methods | | | Instances | |
|
|
|
| statistical analyses
|
|
|
|
| Randomized values
|
|
| R random value
|
|
|
| Random values
|
|
|
|
|
|
| RDist random distribution
|
|
|
| Randomized distributions
|
|
|
|
| Deterministic and probabilistic generators
|
|
| Transitions
|
|
|
| deterministic generator
|
|
|
| probabilistic generator
|
|
|
|
|
|
|
|
| Spreading changes into transitions
|
|
|
| functions to convert a list of changes into a transition
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Spreading transitions into transitions
|
|
|
| functions to convert a list of transitions into a transition
|
|
|
|
|
|
|
|
|
|
|
|
| Randomized generators
|
|
| Randomized changes
|
|
|
| random change
|
|
|
|
| Randomized transitions
|
|
|
| random transition
|
|
|
|
|
| rDist converts a list of randomly generated values into
a distribution by taking equal weights for all values
|
|
| Iteration and simulation
|
|
|
Naming convention:
- * takes n :: Int and a generator and iterates the generator n times
- . produces a single result
- .. produces a trace
- ~ takes k :: Int [and n :: Int] and a generator and simulates
the [n-fold repetition of the] generator k times
There are the following functions:
- n *. t iterates t and produces a distribution
- n *.. t iterates t and produces a trace
- k ~. t simulates t and produces a distribution
- (k,n) ~*. t simulates the n-fold repetition of t and produces a distribution
- (k,n) ~.. t simulates the n-fold repetition of t and produces a trace
Iteration captures three iteration strategies:
iter builds an n-fold composition of a (randomized) transition
while and until implement conditional repetitions
The class Iterate allows the overloading of iteration for different
kinds of generators, namely transitions and random changes:
| | | Methods | | (*.) :: Int -> (a -> c a) -> (a -> c a) | Source |
| | | while :: (a -> Bool) -> (a -> c a) -> (a -> c a) | Source |
| | | until :: (a -> Bool) -> (a -> c a) -> (a -> c a) | Source |
|
| | Instances | |
|
|
|
Simulation means to repeat a random chage many times and
to accumulate all results into a distribution. Therefore,
simulation can be regarded as an approximation of distributions
through randomization.
The Sim class allows the overloading of simulation for different
kinds of generators, namely transitions and random changes:
| | | Methods | | | returns the final randomized transition
| | | | returns the whole trace
| | |
| | Instances | |
|
|
| Tracing
|
|
|
|
|
|
|
|
|
|
|
(>>:) composes the result of a transition with a space
(transition is composed on the left)
(a -> m a) -> (a -> [m a]) -> (a -> [m a]) |
|
|
| walk is a bounded version of the predefined function iterate
|
|
|
| (*..) is identical to (*.),
but returns the list of all intermediate distributions
|
|
|
|
|
|
|
|
|
|
|
|
|
| rWalk computes a list of values by randomly selecting
one value from a distribution in each step.
|
|
|
| mergeTraces converts a list of RTraces
into a list of randomized distributions, i.e., an RSpace,
by creating a randomized distribution for each list position across all traces
|
|
| Produced by Haddock version 2.1.0 |