bayes-stack- Framework for inferring generative probabilistic models with Gibbs sampling

Safe HaskellNone




Dirichlet/multinomial pair

data Multinom a Source

'Multinom a' represents multinomial distribution over domain a. Optionally, this can include a collapsed Dirichlet prior. 'Multinom alpha count total' is a multinomial with Dirichlet prior with symmetric parameter alpha, ...

dirMulti :: Enum a => [(a, Double)] -> Multinom aSource

Create an asymmetric Dirichlet/multinomial from items and alphas

symDirMulti :: Enum a => Double -> [a] -> Multinom aSource

Create a symmetric Dirichlet/multinomial

multinom :: Enum a => [(a, Double)] -> Multinom aSource

A multinomial without a prior

Do not do record updates with these

setMultinom :: (Enum a, Ord a) => SetUnset -> a -> Multinom a -> Multinom aSource

data SetUnset Source



decMultinom :: (Ord a, Enum a) => a -> Multinom a -> Multinom aSource

incMultinom :: (Ord a, Enum a) => a -> Multinom a -> Multinom aSource

prettyMultinom :: (Ord a, Enum a) => Int -> (a -> String) -> Multinom a -> DocSource

updatePrior :: (Alpha a -> Alpha a) -> Multinom a -> Multinom aSource

Update the prior of a Dirichlet/multinomial

Parameter estimation

Convenience functions

decProbabilities :: (Ord a, Enum a) => Multinom a -> Seq (Double, a)Source

Probabilities sorted decreasingly