@Test public void test() throws Exception { DynamicNaiveBayesClassifierDemo.main(null); }
public static void main(String[] args) throws IOException { BayesianNetworkGenerator.setNumberOfGaussianVars(0); BayesianNetworkGenerator.setNumberOfMultinomialVars(5, 3); BayesianNetworkGenerator.setSeed(0); BayesianNetwork bn = BayesianNetworkGenerator.generateNaiveBayes(2); int sampleSize = 1000000; BayesianNetworkSampler sampler = new BayesianNetworkSampler(bn); String file = "./datasets/simulated/randomdata.arff"; DataStream<DataInstance> dataStream = sampler.sampleToDataStream(sampleSize); DataStreamWriter.writeDataToFile(dataStream, file); DataStream<DynamicDataInstance> data = DynamicDataStreamLoader.loadFromFile(file); DynamicNaiveBayesClassifier model = new DynamicNaiveBayesClassifier(); model.setClassVarID(data.getAttributes().getNumberOfAttributes() - 1); model.setParallelMode(true); model.learn(data); DynamicBayesianNetwork nbClassifier = model.getDynamicBNModel(); System.out.println(nbClassifier.toString()); }
DynamicNaiveBayesClassifierDemo { public static void main(String[] args) throws IOException { BayesianNetworkGenerator.setNumberOfGaussianVars(0); BayesianNetworkGenerator.setNumberOfMultinomialVars(5, 3); BayesianNetworkGenerator.setSeed(0); BayesianNetwork bn = BayesianNetworkGenerator.generateNaiveBayes(2); int sampleSize = 1000000; BayesianNetworkSampler sampler = new BayesianNetworkSampler(bn); String file = "./datasets/simulated/randomdata.arff"; DataStream<DataInstance> dataStream = sampler.sampleToDataStream(sampleSize); DataStreamWriter.writeDataToFile(dataStream, file); DataStream<DynamicDataInstance> data = DynamicDataStreamLoader.loadFromFile(file); DynamicNaiveBayesClassifier model = new DynamicNaiveBayesClassifier(); model.setClassVarID(data.getAttributes().getNumberOfAttributes() - 1); model.setParallelMode(true); model.learn(data); DynamicBayesianNetwork nbClassifier = model.getDynamicBNModel(); System.out.println(nbClassifier.toString()); } }
DynamicNaiveBayesClassifierDemo { public static void main(String[] args) throws IOException { BayesianNetworkGenerator.setNumberOfGaussianVars(0); BayesianNetworkGenerator.setNumberOfMultinomialVars(5, 3); BayesianNetworkGenerator.setSeed(0); BayesianNetwork bn = BayesianNetworkGenerator.generateNaiveBayes(2); int sampleSize = 1000000; BayesianNetworkSampler sampler = new BayesianNetworkSampler(bn); String file = "./datasets/simulated/randomdata.arff"; DataStream<DataInstance> dataStream = sampler.sampleToDataStream(sampleSize); DataStreamWriter.writeDataToFile(dataStream, file); DataStream<DynamicDataInstance> data = DynamicDataStreamLoader.loadFromFile(file); DynamicNaiveBayesClassifier model = new DynamicNaiveBayesClassifier(); model.setClassVarID(data.getAttributes().getNumberOfAttributes() - 1); model.setParallelMode(true); model.learn(data); DynamicBayesianNetwork nbClassifier = model.getDynamicBNModel(); System.out.println(nbClassifier.toString()); }  }
DynamicNaiveBayesClassifierDemo { public static void main(String[] args) throws IOException { BayesianNetworkGenerator.setNumberOfGaussianVars(0); BayesianNetworkGenerator.setNumberOfMultinomialVars(5, 3); BayesianNetworkGenerator.setSeed(0); BayesianNetwork bn = BayesianNetworkGenerator.generateNaiveBayes(2); int sampleSize = 1000000; BayesianNetworkSampler sampler = new BayesianNetworkSampler(bn); String file = "./datasets/simulated/randomdata.arff"; DataStream<DataInstance> dataStream = sampler.sampleToDataStream(sampleSize); DataStreamWriter.writeDataToFile(dataStream, file); DataStream<DynamicDataInstance> data = DynamicDataStreamLoader.loadFromFile(file); DynamicNaiveBayesClassifier model = new DynamicNaiveBayesClassifier(); model.setClassVarID(data.getAttributes().getNumberOfAttributes() - 1); model.setParallelMode(true); model.learn(data); DynamicBayesianNetwork nbClassifier = model.getDynamicBNModel(); System.out.println(nbClassifier.toString()); }  static void main(String[] args); }
DynamicNaiveBayesClassifierDemo { public static void main(String[] args) throws IOException { BayesianNetworkGenerator.setNumberOfGaussianVars(0); BayesianNetworkGenerator.setNumberOfMultinomialVars(5, 3); BayesianNetworkGenerator.setSeed(0); BayesianNetwork bn = BayesianNetworkGenerator.generateNaiveBayes(2); int sampleSize = 1000000; BayesianNetworkSampler sampler = new BayesianNetworkSampler(bn); String file = "./datasets/simulated/randomdata.arff"; DataStream<DataInstance> dataStream = sampler.sampleToDataStream(sampleSize); DataStreamWriter.writeDataToFile(dataStream, file); DataStream<DynamicDataInstance> data = DynamicDataStreamLoader.loadFromFile(file); DynamicNaiveBayesClassifier model = new DynamicNaiveBayesClassifier(); model.setClassVarID(data.getAttributes().getNumberOfAttributes() - 1); model.setParallelMode(true); model.learn(data); DynamicBayesianNetwork nbClassifier = model.getDynamicBNModel(); System.out.println(nbClassifier.toString()); }  static void main(String[] args);  }