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

BayesStack.DirMulti

Synopsis

# 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`, ...

Instances

 FullConditionable Multinom HasLikelihood Multinom Eq a => Eq (Multinom a) (Enum a, Show a) => Show (Multinom a) Generic (Multinom a) (Enum a, Serialize a) => Serialize (Multinom a)

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

Constructors

 Set Unset

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

# Convenience functions

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

Probabilities sorted decreasingly