@Test public void test() throws Exception { MPEInferenceExample.main(null); }
public static void main(String[] args) throws Exception { BayesianNetwork bn = BayesianNetworkLoader.loadFromFile("./networks/simulated/WasteIncinerator.bn"); List<Variable> topologicalOrder = Utils.getTopologicalOrder(bn.getDAG()); Variable varMin = bn.getVariables().getVariableByName("Min"); Variable varW = bn.getVariables().getVariableByName("W"); MPEInference mpeInference = new MPEInference(); mpeInference.setModel(bn); System.out.println(bn.toString()); Assignment assignment = new HashMapAssignment(2); assignment.setValue(varW, 0); assignment.setValue(varMin, 0.15); mpeInference.setEvidence(assignment); System.out.println("Evidence: " + assignment.outputString(topologicalOrder) + "\n"); mpeInference.setParallelMode(true); mpeInference.runInference(); System.out.println("MPE = " + mpeInference.getEstimate().outputString(topologicalOrder)); System.out.println("P(MPE) = " + Math.exp(mpeInference.getLogProbabilityOfEstimate())); }
MPEInferenceExample { public static void main(String[] args) throws Exception { BayesianNetwork bn = BayesianNetworkLoader.loadFromFile("./networks/simulated/WasteIncinerator.bn"); List<Variable> topologicalOrder = Utils.getTopologicalOrder(bn.getDAG()); Variable varMin = bn.getVariables().getVariableByName("Min"); Variable varW = bn.getVariables().getVariableByName("W"); MPEInference mpeInference = new MPEInference(); mpeInference.setModel(bn); System.out.println(bn.toString()); Assignment assignment = new HashMapAssignment(2); assignment.setValue(varW, 0); assignment.setValue(varMin, 0.15); mpeInference.setEvidence(assignment); System.out.println("Evidence: " + assignment.outputString(topologicalOrder) + "\n"); mpeInference.setParallelMode(true); mpeInference.runInference(); System.out.println("MPE = " + mpeInference.getEstimate().outputString(topologicalOrder)); System.out.println("P(MPE) = " + Math.exp(mpeInference.getLogProbabilityOfEstimate())); } }
MPEInferenceExample { public static void main(String[] args) throws Exception { BayesianNetwork bn = BayesianNetworkLoader.loadFromFile("./networks/simulated/WasteIncinerator.bn"); List<Variable> topologicalOrder = Utils.getTopologicalOrder(bn.getDAG()); Variable varMin = bn.getVariables().getVariableByName("Min"); Variable varW = bn.getVariables().getVariableByName("W"); MPEInference mpeInference = new MPEInference(); mpeInference.setModel(bn); System.out.println(bn.toString()); Assignment assignment = new HashMapAssignment(2); assignment.setValue(varW, 0); assignment.setValue(varMin, 0.15); mpeInference.setEvidence(assignment); System.out.println("Evidence: " + assignment.outputString(topologicalOrder) + "\n"); mpeInference.setParallelMode(true); mpeInference.runInference(); System.out.println("MPE = " + mpeInference.getEstimate().outputString(topologicalOrder)); System.out.println("P(MPE) = " + Math.exp(mpeInference.getLogProbabilityOfEstimate())); }  }
MPEInferenceExample { public static void main(String[] args) throws Exception { BayesianNetwork bn = BayesianNetworkLoader.loadFromFile("./networks/simulated/WasteIncinerator.bn"); List<Variable> topologicalOrder = Utils.getTopologicalOrder(bn.getDAG()); Variable varMin = bn.getVariables().getVariableByName("Min"); Variable varW = bn.getVariables().getVariableByName("W"); MPEInference mpeInference = new MPEInference(); mpeInference.setModel(bn); System.out.println(bn.toString()); Assignment assignment = new HashMapAssignment(2); assignment.setValue(varW, 0); assignment.setValue(varMin, 0.15); mpeInference.setEvidence(assignment); System.out.println("Evidence: " + assignment.outputString(topologicalOrder) + "\n"); mpeInference.setParallelMode(true); mpeInference.runInference(); System.out.println("MPE = " + mpeInference.getEstimate().outputString(topologicalOrder)); System.out.println("P(MPE) = " + Math.exp(mpeInference.getLogProbabilityOfEstimate())); }  static void main(String[] args); }
MPEInferenceExample { public static void main(String[] args) throws Exception { BayesianNetwork bn = BayesianNetworkLoader.loadFromFile("./networks/simulated/WasteIncinerator.bn"); List<Variable> topologicalOrder = Utils.getTopologicalOrder(bn.getDAG()); Variable varMin = bn.getVariables().getVariableByName("Min"); Variable varW = bn.getVariables().getVariableByName("W"); MPEInference mpeInference = new MPEInference(); mpeInference.setModel(bn); System.out.println(bn.toString()); Assignment assignment = new HashMapAssignment(2); assignment.setValue(varW, 0); assignment.setValue(varMin, 0.15); mpeInference.setEvidence(assignment); System.out.println("Evidence: " + assignment.outputString(topologicalOrder) + "\n"); mpeInference.setParallelMode(true); mpeInference.runInference(); System.out.println("MPE = " + mpeInference.getEstimate().outputString(topologicalOrder)); System.out.println("P(MPE) = " + Math.exp(mpeInference.getLogProbabilityOfEstimate())); }  static void main(String[] args);  }