}
}
// ok, now all data is binary, except the class attribute
// now learn the empty and tree network
BayesNet EmptyNet = new BayesNet();
K2 oSearchAlgorithm = new K2();
oSearchAlgorithm.setInitAsNaiveBayes(false);
oSearchAlgorithm.setMaxNrOfParents(0);
EmptyNet.setSearchAlgorithm(oSearchAlgorithm);
EmptyNet.buildClassifier(instances);
BayesNet NBNet = new BayesNet();
oSearchAlgorithm.setInitAsNaiveBayes(true);
oSearchAlgorithm.setMaxNrOfParents(1);
NBNet.setSearchAlgorithm(oSearchAlgorithm);
NBNet.buildClassifier(instances);
// estimate CPTs
for (int iAttribute = 0; iAttribute < instances.numAttributes(); iAttribute++) {
if (iAttribute != instances.classIndex()) {
double w1 = 0.0, w2 = 0.0;