dp Package

dp Package

Code for variational inference in a dirichlet process mixture of exponential families model.

See U{http://www.cs.berkeley.edu/~jordan/papers/vdp-icml.pdf}.

class infpy.dp.VariationalDistribution(K, X, alpha, _lambda, conj_prior)[source]

Bases: object

The variational distribution, q, over the hidden variables.

K = None

The truncation parameter: I.e. upper limit on # of mixtures

N = None

The number of data

X = None

The data

alpha = None

The dirichlet scaling parameter


@return: An array specifying the probability for a new point coming from each component.

conj_prior = None

Conjugate prior to the exponential family that we are mixing

d = None

The number of dimensions in the conjugate prior that represent the strength of the prior

gamma = None

Beta parameters for the distributions on V_i


Returns the likelihood given the variational distribution. Eqn. 12 in U{http://www.cs.berkeley.edu/~jordan/papers/vdp-icml.pdf}.

phi = None

Multinomial parameters for distributions on Z_n


Predictive distribution of x given variational parameters.

tau = None

Natural parameters for distributions on eta_i


One iteration of variational updates.


Enter debugger if argument is not finite.

infpy.dp.generate_test_data(N, alpha, conjugate_prior, tau)[source]

Generate N data points using given parameters.

@return: (counts, eta, X)

infpy.dp.polya_urn(N, alpha)[source]

Draw N times from a Polya urn parameterised by alpha.

@arg N: Number of draws to make. @arg alpha: Parameter for the polya urn. Small alphas result in a small number of components, big alphas spread the draws over more components. @return: A vector of counts. The i’th entry represents how many draws were made from the i’th component

gen_artificial_data Module

infinite_multinomials Module

Table Of Contents

Previous topic

test Package

Next topic

hdpm Package

This Page