@Test public void test() throws Exception { InferenceEngineExample.main(null); }
public static void main(String[] args) throws Exception { BayesianNetwork bn = BayesianNetworkLoader.loadFromFile("./networks/simulated/WasteIncinerator.bn"); Variable varMout = bn.getVariables().getVariableByName("Mout"); Variable varW = bn.getVariables().getVariableByName("W"); Assignment assignment = new HashMapAssignment(1); assignment.setValue(varW,0); System.out.println("P(Mout|W=0) = " + InferenceEngine.getPosterior(varMout, bn, assignment)); System.out.println("P(0.7<Mout<6.59 | W=0) = " + InferenceEngine.getExpectedValue(varMout, bn, v -> (0.7 < v && v < 6.59) ? 1.0 : 0.0 )); }
InferenceEngineExample { public static void main(String[] args) throws Exception { BayesianNetwork bn = BayesianNetworkLoader.loadFromFile("./networks/simulated/WasteIncinerator.bn"); Variable varMout = bn.getVariables().getVariableByName("Mout"); Variable varW = bn.getVariables().getVariableByName("W"); Assignment assignment = new HashMapAssignment(1); assignment.setValue(varW,0); System.out.println("P(Mout|W=0) = " + InferenceEngine.getPosterior(varMout, bn, assignment)); System.out.println("P(0.7<Mout<6.59 | W=0) = " + InferenceEngine.getExpectedValue(varMout, bn, v -> (0.7 < v && v < 6.59) ? 1.0 : 0.0 )); } }
InferenceEngineExample { public static void main(String[] args) throws Exception { BayesianNetwork bn = BayesianNetworkLoader.loadFromFile("./networks/simulated/WasteIncinerator.bn"); Variable varMout = bn.getVariables().getVariableByName("Mout"); Variable varW = bn.getVariables().getVariableByName("W"); Assignment assignment = new HashMapAssignment(1); assignment.setValue(varW,0); System.out.println("P(Mout|W=0) = " + InferenceEngine.getPosterior(varMout, bn, assignment)); System.out.println("P(0.7<Mout<6.59 | W=0) = " + InferenceEngine.getExpectedValue(varMout, bn, v -> (0.7 < v && v < 6.59) ? 1.0 : 0.0 )); }  }
InferenceEngineExample { public static void main(String[] args) throws Exception { BayesianNetwork bn = BayesianNetworkLoader.loadFromFile("./networks/simulated/WasteIncinerator.bn"); Variable varMout = bn.getVariables().getVariableByName("Mout"); Variable varW = bn.getVariables().getVariableByName("W"); Assignment assignment = new HashMapAssignment(1); assignment.setValue(varW,0); System.out.println("P(Mout|W=0) = " + InferenceEngine.getPosterior(varMout, bn, assignment)); System.out.println("P(0.7<Mout<6.59 | W=0) = " + InferenceEngine.getExpectedValue(varMout, bn, v -> (0.7 < v && v < 6.59) ? 1.0 : 0.0 )); }  static void main(String[] args); }
InferenceEngineExample { public static void main(String[] args) throws Exception { BayesianNetwork bn = BayesianNetworkLoader.loadFromFile("./networks/simulated/WasteIncinerator.bn"); Variable varMout = bn.getVariables().getVariableByName("Mout"); Variable varW = bn.getVariables().getVariableByName("W"); Assignment assignment = new HashMapAssignment(1); assignment.setValue(varW,0); System.out.println("P(Mout|W=0) = " + InferenceEngine.getPosterior(varMout, bn, assignment)); System.out.println("P(0.7<Mout<6.59 | W=0) = " + InferenceEngine.getExpectedValue(varMout, bn, v -> (0.7 < v && v < 6.59) ? 1.0 : 0.0 )); }  static void main(String[] args);  }