import edu.mit.six825.bn.functiontable.*;
import edu.mit.six825.bn.bayesnet.*;
import edu.mit.six825.bn.inputs.*;
// import techniques.utils.Random;

import java.util.*;

/**
 * Hacking around with the new code.
 *
 * @author nocturne
 */
public class hacking {
    public static void main(String[] args) {

	BayesNet bn;
	BNData data;
	if (false) {
	    bn = BNUtils.getWipedNet("a");
	    data = new BNData(bn.nodes.getFunctionVariableSet());
	    data.readFile("data/dataA.dat");
	    // BNUtils.printNet(bn.nodes);
	    
	    MLEstimate.computeCPTs(bn, data);
	    // BNUtils.printNet(bn.nodes);
	    System.out.println("Log likelihood = " +
			       BNUtils.logLikelihood(bn, data));
	    System.out.println("Structural penalty = " +
			       BNUtils.structuralPenalty(bn, data));
	    System.out.println("BIC score = " +
			       BNUtils.BICScore(bn, data));
	    
	    System.out.println(BNUtils.latexNet(bn.nodes));
	} else {
	    // And now for the fun...
	    bn = BNUtils.getWipedNet("b");
	    data = new BNData(bn.nodes.getFunctionVariableSet());
	    data.readFile("data/dataB.dat");
	    MLEstimate.computeCPTs(bn, data);

	    BNUtils.printNet(bn.nodes);

	    BNUtils.DumpToFile(BNUtils.latexNet(bn.nodes), "./estBcpts.tex");

	    System.out.println("Log likelihood = " +
			       BNUtils.logLikelihood(bn, data));
	    System.out.println("Structural penalty = " +
			       BNUtils.structuralPenalty(bn, data));
	    System.out.println("BIC score = " +
			       BNUtils.BICScore(bn, data));
	}
    }
}
