@Test public void test() throws Exception { ParallelMLExample.main(null); }
public static void main(String[] args) throws Exception { boolean hadoop_cluster = false; if (args.length>1){ hadoop_cluster = Boolean.parseBoolean(args[0]); } final ExecutionEnvironment env; if(hadoop_cluster){ env = ExecutionEnvironment.getExecutionEnvironment(); env.getConfig().disableSysoutLogging(); }else{ Configuration conf = new Configuration(); conf.setInteger("taskmanager.network.numberOfBuffers", 12000); conf.setInteger("taskmanager.numberOfTaskSlots",Main.PARALLELISM); env = ExecutionEnvironment.createLocalEnvironment(conf); env.setParallelism(Main.PARALLELISM); env.getConfig().disableSysoutLogging(); } DataFlink<DataInstance> dataFlink = new DataSetGenerator().generate(env,1234,1000,5,0); DAG dag = DAGGenerator.getNaiveBayesStructure(dataFlink.getAttributes(), "DiscreteVar4"); System.out.println(dag.toString()); ParameterLearningAlgorithm learningAlgorithmFlink = new ParallelMaximumLikelihood(); learningAlgorithmFlink.setBatchSize(10); learningAlgorithmFlink.setDAG(dag); learningAlgorithmFlink.initLearning(); learningAlgorithmFlink.updateModel(dataFlink); BayesianNetwork bn = learningAlgorithmFlink.getLearntBayesianNetwork(); System.out.println(bn); }
ParallelMLExample { public static void main(String[] args) throws Exception { boolean hadoop_cluster = false; if (args.length>1){ hadoop_cluster = Boolean.parseBoolean(args[0]); } final ExecutionEnvironment env; if(hadoop_cluster){ env = ExecutionEnvironment.getExecutionEnvironment(); env.getConfig().disableSysoutLogging(); }else{ Configuration conf = new Configuration(); conf.setInteger("taskmanager.network.numberOfBuffers", 12000); conf.setInteger("taskmanager.numberOfTaskSlots",Main.PARALLELISM); env = ExecutionEnvironment.createLocalEnvironment(conf); env.setParallelism(Main.PARALLELISM); env.getConfig().disableSysoutLogging(); } DataFlink<DataInstance> dataFlink = new DataSetGenerator().generate(env,1234,1000,5,0); DAG dag = DAGGenerator.getNaiveBayesStructure(dataFlink.getAttributes(), "DiscreteVar4"); System.out.println(dag.toString()); ParameterLearningAlgorithm learningAlgorithmFlink = new ParallelMaximumLikelihood(); learningAlgorithmFlink.setBatchSize(10); learningAlgorithmFlink.setDAG(dag); learningAlgorithmFlink.initLearning(); learningAlgorithmFlink.updateModel(dataFlink); BayesianNetwork bn = learningAlgorithmFlink.getLearntBayesianNetwork(); System.out.println(bn); } }
ParallelMLExample { public static void main(String[] args) throws Exception { boolean hadoop_cluster = false; if (args.length>1){ hadoop_cluster = Boolean.parseBoolean(args[0]); } final ExecutionEnvironment env; if(hadoop_cluster){ env = ExecutionEnvironment.getExecutionEnvironment(); env.getConfig().disableSysoutLogging(); }else{ Configuration conf = new Configuration(); conf.setInteger("taskmanager.network.numberOfBuffers", 12000); conf.setInteger("taskmanager.numberOfTaskSlots",Main.PARALLELISM); env = ExecutionEnvironment.createLocalEnvironment(conf); env.setParallelism(Main.PARALLELISM); env.getConfig().disableSysoutLogging(); } DataFlink<DataInstance> dataFlink = new DataSetGenerator().generate(env,1234,1000,5,0); DAG dag = DAGGenerator.getNaiveBayesStructure(dataFlink.getAttributes(), "DiscreteVar4"); System.out.println(dag.toString()); ParameterLearningAlgorithm learningAlgorithmFlink = new ParallelMaximumLikelihood(); learningAlgorithmFlink.setBatchSize(10); learningAlgorithmFlink.setDAG(dag); learningAlgorithmFlink.initLearning(); learningAlgorithmFlink.updateModel(dataFlink); BayesianNetwork bn = learningAlgorithmFlink.getLearntBayesianNetwork(); System.out.println(bn); }  }
ParallelMLExample { public static void main(String[] args) throws Exception { boolean hadoop_cluster = false; if (args.length>1){ hadoop_cluster = Boolean.parseBoolean(args[0]); } final ExecutionEnvironment env; if(hadoop_cluster){ env = ExecutionEnvironment.getExecutionEnvironment(); env.getConfig().disableSysoutLogging(); }else{ Configuration conf = new Configuration(); conf.setInteger("taskmanager.network.numberOfBuffers", 12000); conf.setInteger("taskmanager.numberOfTaskSlots",Main.PARALLELISM); env = ExecutionEnvironment.createLocalEnvironment(conf); env.setParallelism(Main.PARALLELISM); env.getConfig().disableSysoutLogging(); } DataFlink<DataInstance> dataFlink = new DataSetGenerator().generate(env,1234,1000,5,0); DAG dag = DAGGenerator.getNaiveBayesStructure(dataFlink.getAttributes(), "DiscreteVar4"); System.out.println(dag.toString()); ParameterLearningAlgorithm learningAlgorithmFlink = new ParallelMaximumLikelihood(); learningAlgorithmFlink.setBatchSize(10); learningAlgorithmFlink.setDAG(dag); learningAlgorithmFlink.initLearning(); learningAlgorithmFlink.updateModel(dataFlink); BayesianNetwork bn = learningAlgorithmFlink.getLearntBayesianNetwork(); System.out.println(bn); }  static void main(String[] args); }
ParallelMLExample { public static void main(String[] args) throws Exception { boolean hadoop_cluster = false; if (args.length>1){ hadoop_cluster = Boolean.parseBoolean(args[0]); } final ExecutionEnvironment env; if(hadoop_cluster){ env = ExecutionEnvironment.getExecutionEnvironment(); env.getConfig().disableSysoutLogging(); }else{ Configuration conf = new Configuration(); conf.setInteger("taskmanager.network.numberOfBuffers", 12000); conf.setInteger("taskmanager.numberOfTaskSlots",Main.PARALLELISM); env = ExecutionEnvironment.createLocalEnvironment(conf); env.setParallelism(Main.PARALLELISM); env.getConfig().disableSysoutLogging(); } DataFlink<DataInstance> dataFlink = new DataSetGenerator().generate(env,1234,1000,5,0); DAG dag = DAGGenerator.getNaiveBayesStructure(dataFlink.getAttributes(), "DiscreteVar4"); System.out.println(dag.toString()); ParameterLearningAlgorithm learningAlgorithmFlink = new ParallelMaximumLikelihood(); learningAlgorithmFlink.setBatchSize(10); learningAlgorithmFlink.setDAG(dag); learningAlgorithmFlink.initLearning(); learningAlgorithmFlink.updateModel(dataFlink); BayesianNetwork bn = learningAlgorithmFlink.getLearntBayesianNetwork(); System.out.println(bn); }  static void main(String[] args);  }