# Correction to ( or confusion about) Infer.Net 101 CyclistMixed Chapter (p.41)

• ### Question

• Hi -- at the bottom of page 41, of Infer.Net 101, there is the following description of the generative model :

The basic generative process is to sample the mixing coefficients from the mixing
prior, and then for each travel time from the TravelTimes array:
1. Sample the travel time’s component index to determine which mixing component
generates the travel time.
The component index’s Dirichlet distribution is defined by the mixing coefficients
from Step 1.
2. Sample AverageTime and TrafficNoise from their respective priors for the mixing
component determined in Step 2.
3. Sample the travel time value from a Gaussian distribution whose mean and
precision are determined by the AverageTime and TrafficNoise values from
Step 3, respectively.
Repeat Steps 1-4 to generate the entire travelTimes data set.

-----------------------------------------------------------------------------

There are some obvious typos, but I also feel like there is a deeper conceptual mistake.  I feel it should actually be explained something like:

0. For each of the two elements of AverageTime , and for each of the two elements of  TrafficNoise, draw a sample from their respective priors

Then repeat the following N times (where each iteration is indexed by i):

1. Sample the i-th travel time component index to determine which mixing component
generates the travel time.

2. Sample the i-th travel time value from a Gaussian distribution whose mean and
precision are determined by the AverageTime and TrafficNoise values (which were determined at step 0) at the currently selected component index

Does this seem right, or am I the one making the conceptual mistake?

cheers

Friday, June 1, 2012 8:43 PM

### All replies

• I think the OP is correct: you sample AverageTime and TrafficNoise once in advance, not for each observation.  The code does this correctly, but the description in the document is wrong.
Wednesday, June 6, 2012 1:57 PM