node1 = network.getBeliefNode("Cloudy");
// alternative way to set observation, it should work for more general
// situation where evidence is not just observation but a probability distribution
PT de = TableFactory.createObservation(node1.getDiscretizedDomain(),
"false");
// normally this is better to use for seting evidence, there is easy way with observations
inference.setEvidence("Cloudy", de);
inference.run();
Set<BNNode> nodes = network.vertexSet();
for (BNNode node : nodes) {
System.out.println(
node.getName() + ":\n" + node.getMarginal().toString()
+ "\n");
}
PT de1 = TableFactory.createObservation(node1.getDiscretizedDomain(),
"false");
// normally this is better to use for seting evidence, there is easy way with observations
inference.setEvidence("Cloudy", de1);
inference.run();