}
// learning starts here
// create a new learner
BayesianLearner learner = new BayesianLearner();
// you need to initialize the link between the learner and network
// this initialization will clear existing
// probability tables from the network and set up uniform Dirichlet priors
learner.initialize(network);
// System.out.println("CPTs Before Learning \n");
//
// for (BeliefNode node : nodes) {
// System.out.println(node.getName() + ":\n"
// + node.getTable().toString() + "\n");
// }
// create a new data source for the learner
GraphDataFile graphData = new GraphDataFile();
// now, populate the data source, in this case from file
graphData.readArff(dataFile);
// you need to connect it too, which will help
// the instance IGraphData to understand how to
// format dta so that they fit the network
// graphData.connect(network);
// finally, learn!
learner.learnFromTable(graphData);
inference = new JTInference();
inference.initialize(network, new JoinTreeCompiler());
inference.run();
// now, show the probabilities again