Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Abstract types for the Dirichlet Process viewed through the interface of the Chinese Restaurant Process.
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
- data Restaurant
- data Table
- newRestaurant :: Double -> Prob Restaurant
- newCustomer :: Restaurant -> Prob Table
- dp :: Double -> Prob a -> Prob (Prob a)
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
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).
:: 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.