Dirichlet dirichlet = new Dirichlet (NUM_OUTCOMES, 1.0);
double[] pA = dirichlet.randomVector (random);
double[] pB = dirichlet.randomVector (random);
TDoubleArrayList pC = new TDoubleArrayList (NUM_OUTCOMES * NUM_OUTCOMES * NUM_OUTCOMES);
for (int i = 0; i < (NUM_OUTCOMES * NUM_OUTCOMES); i++) {
pC.add (dirichlet.randomVector (random));
}
Variable[] vars = new Variable[] { new Variable (NUM_OUTCOMES), new Variable (NUM_OUTCOMES),
new Variable (NUM_OUTCOMES) };
DirectedModel mdl = new DirectedModel ();
mdl.addFactor (new CPT (new TableFactor (vars[0], pA), vars[0]));
mdl.addFactor (new CPT (new TableFactor (vars[1], pB), vars[1]));
mdl.addFactor (new CPT (new TableFactor (vars, pC.toNativeArray ()), vars[2]));
return mdl;
}