lazyppl-1.0: Lazy Probabilistic Programming Library
Safe HaskellSafe-Inferred
LanguageHaskell2010

LazyPPL.Distributions.DirichletP

Description

Abstract types for the Dirichlet Process viewed through the interface of the Chinese Restaurant Process.

Ideas following S. Staton, H. Yang, N. L. Ackerman, C. Freer, D. Roy. Exchangeable random process and data abstraction. Workshop on probabilistic programming semantics (PPS 2017).

Our implementation here uses stick breaking, with a lazily broken stick. Other urn-based implementations are possible with hidden state, and they should be observationally equivalent.

For illustrations, see non-parametric clustering and relational inference.

Synopsis

Chinese Restaurant Process interface

For clustering, we regard each data point as a "customer" in a "restaurant", and they are in the same cluster if they sit at the same Table.

data Restaurant Source #

Abstract type of restaurants

data Table Source #

Abstract type of tables. This supports Eq so that we can ask whether customers are at the same table (i.e. whether points are in the same cluster).

Instances

Instances details
Show Table Source # 
Instance details

Defined in LazyPPL.Distributions.DirichletP

Methods

showsPrec :: Int -> Table -> ShowS #

show :: Table -> String #

showList :: [Table] -> ShowS #

Eq Table Source # 
Instance details

Defined in LazyPPL.Distributions.DirichletP

Methods

(==) :: Table -> Table -> Bool #

(/=) :: Table -> Table -> Bool #

MonadMemo Prob Table Source # 
Instance details

Defined in LazyPPL.Distributions.DirichletP

Methods

memoize :: (Table -> Prob b) -> Prob (Table -> b) Source #

newRestaurant Source #

Arguments

:: Double

Concentration parameter, alpha

-> Prob Restaurant 

Create a new restaurant with concentration parameter alpha.

newCustomer :: Restaurant -> Prob Table Source #

A customer enters the restaurant and is assigned a table.

Random distribution interface

dp Source #

Arguments

:: Double

Concentration parameter, alpha

-> Prob a

Base distribution

-> Prob (Prob a) 

Dirichlet Process as a random distribution.