public static void writeBIF(OutputStream os, BayesianNetwork network) {
WriteXML xml = new WriteXML(os);
xml.beginDocument();
xml.addAttribute("VERSION", "0.3");
xml.beginTag("BIF");
xml.beginTag("NETWORK");
xml.addProperty("NAME", "Bayes Network, Generated by Encog");
// write variables
for (BayesianEvent event : network.getEvents()) {
xml.addAttribute("TYPE", "nature");
xml.beginTag("VARIABLE");