@Test public void test() throws Exception { System.out.println("Working Directory = " + System.getProperty("user.dir")); DynamicModelLearning.main(null); DynamicModelInference.main(null); }
public static void main(String[] args) throws IOException, ClassNotFoundException { DynamicBayesianNetwork dbn = DynamicBayesianNetworkLoader.loadFromFile("networks/simulated/exampleDBN.dbn"); System.out.println(dbn); String filenamePredict = "datasets/simulated/cajamar.arff"; DataStream<DynamicDataInstance> dataPredict = DynamicDataStreamLoader.open(filenamePredict); InferenceAlgorithmForDBN infer = new FactoredFrontierForDBN(new ImportanceSampling()); infer.setModel(dbn); Variable varTarget = dbn.getDynamicVariables().getVariableByName("discreteHiddenVar"); UnivariateDistribution posterior = null; int t = 0; for (DynamicDataInstance instance : dataPredict) { if (instance.getSequenceID()>0) break; infer.addDynamicEvidence(instance); infer.runInference(); posterior = infer.getFilteredPosterior(varTarget); System.out.println("t="+t+", P(discreteHiddenVar | Evidence) = " + posterior); posterior = infer.getPredictivePosterior(varTarget, 2); System.out.println("t="+t+"+5, P(discreteHiddenVar | Evidence) = " + posterior); t++; } }
DynamicModelInference { public static void main(String[] args) throws IOException, ClassNotFoundException { DynamicBayesianNetwork dbn = DynamicBayesianNetworkLoader.loadFromFile("networks/simulated/exampleDBN.dbn"); System.out.println(dbn); String filenamePredict = "datasets/simulated/cajamar.arff"; DataStream<DynamicDataInstance> dataPredict = DynamicDataStreamLoader.open(filenamePredict); InferenceAlgorithmForDBN infer = new FactoredFrontierForDBN(new ImportanceSampling()); infer.setModel(dbn); Variable varTarget = dbn.getDynamicVariables().getVariableByName("discreteHiddenVar"); UnivariateDistribution posterior = null; int t = 0; for (DynamicDataInstance instance : dataPredict) { if (instance.getSequenceID()>0) break; infer.addDynamicEvidence(instance); infer.runInference(); posterior = infer.getFilteredPosterior(varTarget); System.out.println("t="+t+", P(discreteHiddenVar | Evidence) = " + posterior); posterior = infer.getPredictivePosterior(varTarget, 2); System.out.println("t="+t+"+5, P(discreteHiddenVar | Evidence) = " + posterior); t++; } } }
DynamicModelInference { public static void main(String[] args) throws IOException, ClassNotFoundException { DynamicBayesianNetwork dbn = DynamicBayesianNetworkLoader.loadFromFile("networks/simulated/exampleDBN.dbn"); System.out.println(dbn); String filenamePredict = "datasets/simulated/cajamar.arff"; DataStream<DynamicDataInstance> dataPredict = DynamicDataStreamLoader.open(filenamePredict); InferenceAlgorithmForDBN infer = new FactoredFrontierForDBN(new ImportanceSampling()); infer.setModel(dbn); Variable varTarget = dbn.getDynamicVariables().getVariableByName("discreteHiddenVar"); UnivariateDistribution posterior = null; int t = 0; for (DynamicDataInstance instance : dataPredict) { if (instance.getSequenceID()>0) break; infer.addDynamicEvidence(instance); infer.runInference(); posterior = infer.getFilteredPosterior(varTarget); System.out.println("t="+t+", P(discreteHiddenVar | Evidence) = " + posterior); posterior = infer.getPredictivePosterior(varTarget, 2); System.out.println("t="+t+"+5, P(discreteHiddenVar | Evidence) = " + posterior); t++; } }  }
DynamicModelInference { public static void main(String[] args) throws IOException, ClassNotFoundException { DynamicBayesianNetwork dbn = DynamicBayesianNetworkLoader.loadFromFile("networks/simulated/exampleDBN.dbn"); System.out.println(dbn); String filenamePredict = "datasets/simulated/cajamar.arff"; DataStream<DynamicDataInstance> dataPredict = DynamicDataStreamLoader.open(filenamePredict); InferenceAlgorithmForDBN infer = new FactoredFrontierForDBN(new ImportanceSampling()); infer.setModel(dbn); Variable varTarget = dbn.getDynamicVariables().getVariableByName("discreteHiddenVar"); UnivariateDistribution posterior = null; int t = 0; for (DynamicDataInstance instance : dataPredict) { if (instance.getSequenceID()>0) break; infer.addDynamicEvidence(instance); infer.runInference(); posterior = infer.getFilteredPosterior(varTarget); System.out.println("t="+t+", P(discreteHiddenVar | Evidence) = " + posterior); posterior = infer.getPredictivePosterior(varTarget, 2); System.out.println("t="+t+"+5, P(discreteHiddenVar | Evidence) = " + posterior); t++; } }  static void main(String[] args); }
DynamicModelInference { public static void main(String[] args) throws IOException, ClassNotFoundException { DynamicBayesianNetwork dbn = DynamicBayesianNetworkLoader.loadFromFile("networks/simulated/exampleDBN.dbn"); System.out.println(dbn); String filenamePredict = "datasets/simulated/cajamar.arff"; DataStream<DynamicDataInstance> dataPredict = DynamicDataStreamLoader.open(filenamePredict); InferenceAlgorithmForDBN infer = new FactoredFrontierForDBN(new ImportanceSampling()); infer.setModel(dbn); Variable varTarget = dbn.getDynamicVariables().getVariableByName("discreteHiddenVar"); UnivariateDistribution posterior = null; int t = 0; for (DynamicDataInstance instance : dataPredict) { if (instance.getSequenceID()>0) break; infer.addDynamicEvidence(instance); infer.runInference(); posterior = infer.getFilteredPosterior(varTarget); System.out.println("t="+t+", P(discreteHiddenVar | Evidence) = " + posterior); posterior = infer.getPredictivePosterior(varTarget, 2); System.out.println("t="+t+"+5, P(discreteHiddenVar | Evidence) = " + posterior); t++; } }  static void main(String[] args);  }