Decide on the number of chains we want – it is important to run
multiple chains from different starting points!

Define our DP-GMM model

Munge the data into numpy recarray format then wrap the data for our
model

Randomize start points

Create runners for each chain

nchains=8# The random state objectprng=rng()# Define a DP-GMM where the Gaussian is 2Ddefn=model_definition(Y.shape[0],[normal_inverse_wishart(2)])# Munge the data into numpy recarray formatY_rec=np.array([(list(y),)foryinY],dtype=[('',np.float32,2)])# Create a wrapper around the numpy recarray which# data-microscopes understandsview=numpy_dataview(Y_rec)# Initialize nchains start points randomly in the state spacelatents=[model.initialize(defn,view,prng)for_inxrange(nchains)]# Create a runner for each chainrunners=[runner.runner(defn,view,latent,kernel_config=['assign'])forlatentinlatents]