private String getName(){ if (dag!=null) return dag.getName(); else return ""; }
public DataSet<DataPosterior> computePosterior(){ Attribute seq_id = this.dataFlink.getAttributes().getSeq_id(); if (seq_id==null) throw new IllegalArgumentException("Functionality only available for data sets with a seq_id attribute"); try{ Configuration config = new Configuration(); config.setString(ParameterLearningAlgorithm.BN_NAME, this.dag.getName()); config.setBytes(SVB, Serialization.serializeObject(svb)); return this.dataFlink .getBatchedDataSet(this.batchSize) .flatMap(new ParallelVBMapInference()) .withParameters(config); }catch(Exception ex){ throw new UndeclaredThrowableException(ex); } }
public DataSet<DataPosterior> computePosterior(DataFlink<DataInstance> dataFlink){ Attribute seq_id = dataFlink.getAttributes().getSeq_id(); if (seq_id==null) throw new IllegalArgumentException("Functionality only available for data sets with a seq_id attribute"); try{ Configuration config = new Configuration(); config.setString(ParameterLearningAlgorithm.BN_NAME, this.dag.getName()); config.setBytes(SVB, Serialization.serializeObject(svb)); return dataFlink .getBatchedDataSet(this.batchSize) .flatMap(new ParallelVBMapInference()) .withParameters(config); }catch(Exception ex){ throw new UndeclaredThrowableException(ex); } } public double updateModel(DataFlink<DataInstance> dataUpdate){
public DataSet<DataPosterior> computePosterior(DataFlink<DataInstance> dataFlink){ Attribute seq_id = dataFlink.getAttributes().getSeq_id(); if (seq_id==null) throw new IllegalArgumentException("Functionality only available for data sets with a seq_id attribute"); try{ Configuration config = new Configuration(); config.setString(ParameterLearningAlgorithm.BN_NAME, this.dag.getName()); config.setBytes(SVB, Serialization.serializeObject(svb)); return dataFlink .getBatchedDataSet(this.batchSize) .flatMap(new ParallelVBMapInference()) .withParameters(config); }catch(Exception ex){ throw new UndeclaredThrowableException(ex); } } public double updateModel(DataFlink<DataInstance> dataUpdate){
public DataSet<DataPosteriorAssignment> computePosteriorAssignment(List<Variable> latentVariables){ Attribute seq_id = this.dataFlink.getAttributes().getSeq_id(); if (seq_id==null) throw new IllegalArgumentException("Functionality only available for data sets with a seq_id attribute"); try{ Configuration config = new Configuration(); config.setString(ParameterLearningAlgorithm.BN_NAME, this.dag.getName()); config.setBytes(SVB, Serialization.serializeObject(svb)); config.setBytes(LATENT_VARS, Serialization.serializeObject(latentVariables)); return this.dataFlink .getBatchedDataSet(this.batchSize) .flatMap(new ParallelVBMapInferenceAssignment()) .withParameters(config); }catch(Exception ex){ throw new UndeclaredThrowableException(ex); } }
public DataSet<DataPosteriorAssignment> computePosteriorAssignment(DataFlink<DataInstance> dataFlink, List<Variable> latentVariables){ Attribute seq_id = dataFlink.getAttributes().getSeq_id(); if (seq_id==null) throw new IllegalArgumentException("Functionality only available for data sets with a seq_id attribute"); try{ Configuration config = new Configuration(); config.setString(ParameterLearningAlgorithm.BN_NAME, this.dag.getName()); config.setBytes(SVB, Serialization.serializeObject(svb)); config.setBytes(LATENT_VARS, Serialization.serializeObject(latentVariables)); return dataFlink .getBatchedDataSet(this.batchSize) .flatMap(new ParallelVBMapInferenceAssignment()) .withParameters(config); }catch(Exception ex){ throw new UndeclaredThrowableException(ex); } }
public DataSet<DataPosterior> computePosterior(DataFlink<DataInstance> dataFlink, List<Variable> latentVariables){ Attribute seq_id = dataFlink.getAttributes().getSeq_id(); if (seq_id==null) throw new IllegalArgumentException("Functionality only available for data sets with a seq_id attribute"); try{ Configuration config = new Configuration(); config.setString(ParameterLearningAlgorithm.BN_NAME, this.dag.getName()); config.setBytes(SVB, Serialization.serializeObject(svb)); config.setBytes(LATENT_VARS, Serialization.serializeObject(latentVariables)); return dataFlink .getBatchedDataSet(this.batchSize) .flatMap(new ParallelVBMapInference()) .withParameters(config); }catch(Exception ex){ throw new UndeclaredThrowableException(ex); } }
public DataSet<DataPosteriorAssignment> computePosteriorAssignment(DataFlink<DataInstance> dataFlink, List<Variable> latentVariables){ Attribute seq_id = dataFlink.getAttributes().getSeq_id(); if (seq_id==null) throw new IllegalArgumentException("Functionality only available for data sets with a seq_id attribute"); try{ Configuration config = new Configuration(); config.setString(ParameterLearningAlgorithm.BN_NAME, this.dag.getName()); config.setBytes(SVB, Serialization.serializeObject(svb)); config.setBytes(LATENT_VARS, Serialization.serializeObject(latentVariables)); return dataFlink .getBatchedDataSet(this.batchSize) .flatMap(new ParallelVBMapInferenceAssignment()) .withParameters(config); }catch(Exception ex){ throw new UndeclaredThrowableException(ex); } }
public DataSet<DataPosterior> computePosterior(List<Variable> latentVariables){ Attribute seq_id = this.dataFlink.getAttributes().getSeq_id(); if (seq_id==null) throw new IllegalArgumentException("Functionality only available for data sets with a seq_id attribute"); try{ Configuration config = new Configuration(); config.setString(ParameterLearningAlgorithm.BN_NAME, this.dag.getName()); config.setBytes(SVB, Serialization.serializeObject(svb)); config.setBytes(LATENT_VARS, Serialization.serializeObject(latentVariables)); return this.dataFlink .getBatchedDataSet(this.batchSize) .flatMap(new ParallelVBMapInference()) .withParameters(config); }catch(Exception ex){ throw new UndeclaredThrowableException(ex); } }
public DataSet<DataPosterior> computePosterior(DataFlink<DataInstance> dataFlink, List<Variable> latentVariables){ Attribute seq_id = dataFlink.getAttributes().getSeq_id(); if (seq_id==null) throw new IllegalArgumentException("Functionality only available for data sets with a seq_id attribute"); try{ Configuration config = new Configuration(); config.setString(ParameterLearningAlgorithm.BN_NAME, this.dag.getName()); config.setBytes(SVB, Serialization.serializeObject(svb)); config.setBytes(LATENT_VARS, Serialization.serializeObject(latentVariables)); return dataFlink .getBatchedDataSet(this.batchSize) .flatMap(new ParallelVBMapInference()) .withParameters(config); }catch(Exception ex){ throw new UndeclaredThrowableException(ex); } }
/** * {@inheritDoc} */ @Override public double updateModel(DataFlink<DataInstance> dataUpdate) { try { Configuration config = new Configuration(); config.setString(BN_NAME, this.dag.getName()); config.setBytes(EFBN_NAME, Serialization.serializeObject(efBayesianNetwork)); DataSet<DataInstance> dataset = dataUpdate.getDataSet(); this.sumSS = dataset.map(new SufficientSatisticsMAP()) .withParameters(config) .reduce(new SufficientSatisticsReduce()) .collect().get(0); //Add the prior sumSS.sum(efBayesianNetwork.createInitSufficientStatistics()); JobExecutionResult result = dataset.getExecutionEnvironment().getLastJobExecutionResult(); numInstances = result.getAccumulatorResult(ParallelMaximumLikelihood.COUNTER_NAME+"_"+this.dag.getName()); numInstances++;//Initial counts }catch(Exception ex){ throw new UndeclaredThrowableException(ex); } return this.getLogMarginalProbability(); }
/** * {@inheritDoc} */ @Override public double updateModel(DataFlink<DataInstance> dataUpdate) { try { this.initLearning(); Configuration config = new Configuration(); config.setString(ParameterLearningAlgorithm.BN_NAME, this.dag.getName()); config.setBytes(EFBN_NAME, Serialization.serializeObject(efBayesianNetwork)); DataSet<DataInstance> dataset = dataUpdate.getDataSet(); this.sumSS = dataset.mapPartition(new SufficientSatisticsMAP()) .withParameters(config) .reduce(new SufficientSatisticsReduce()) .collect().get(0); //Add the prior sumSS.sum(efBayesianNetwork.createInitSufficientStatistics()); JobExecutionResult result = dataset.getExecutionEnvironment().getLastJobExecutionResult(); numInstances = result.getAccumulatorResult(ParallelMaximumLikelihood2.COUNTER_NAME+"_"+this.dag.getName()); numInstances++;//Initial counts }catch(Exception ex){ throw new UndeclaredThrowableException(ex); } return this.getLogMarginalProbability(); }
.registerAggregationConvergenceCriterion("ELBO_" + this.dag.getName(), new DoubleSumAggregator(),convergenceELBO); config.setString(ParameterLearningAlgorithm.BN_NAME, this.dag.getName()); config.setBytes(SVB, Serialization.serializeObject(svb)); .map(new ParallelVBMap(randomStart, idenitifableModelling)) .withParameters(config) .withBroadcastSet(loop, "VB_PARAMS_" + this.dag.getName()) .reduce(new ParallelVBReduce());
.registerAggregationConvergenceCriterion("ELBO_" + this.dag.getName(), new DoubleSumAggregator(),convergenceELBO); config.setString(ParameterLearningAlgorithm.BN_NAME, this.dag.getName()); config.setBytes(SVB, Serialization.serializeObject(svb)); .map(new ParallelVBMap(randomStart, idenitifableModelling)) .withParameters(config) .withBroadcastSet(loop, "VB_PARAMS_" + this.dag.getName()) .reduce(new ParallelVBReduce());
.registerAggregationConvergenceCriterion("ELBO_" + this.dag.getName(), new DoubleSumAggregator(),convergenceELBO); config.setString(ParameterLearningAlgorithm.BN_NAME, this.dag.getName()); config.setBytes(SVB, Serialization.serializeObject(svb)); .map(new ParallelVBMap(randomStart, idenitifableModelling)) .withParameters(config) .withBroadcastSet(loop, "VB_PARAMS_" + this.dag.getName()) .reduce(new ParallelVBReduce());
.registerAggregationConvergenceCriterion("ELBO_" + this.dagTimeT.getName(), new DoubleSumAggregator(), new eu.amidst.flinklink.core.learning.parametric.ParallelVB.ConvergenceELBO( this.globalThreshold, System.nanoTime())); config.setString(eu.amidst.flinklink.core.learning.parametric.ParameterLearningAlgorithm.BN_NAME, this.dagTimeT.getName()); config.setBytes(eu.amidst.flinklink.core.learning.parametric.ParallelVB.SVB, Serialization.serializeObject(svbTimeT)); config.setBytes(LATENT_INTERFACE_VARIABLE_NAMES, Serialization.serializeObject(this.latentInterfaceVariablesNames)); .map(new DynamicParallelVB.ParallelVBMap(data.getAttributes(), this.dagTimeT.getVariables().getListOfVariables(),randomStart, idenitifableModelling)) .withParameters(config) .withBroadcastSet(loop, "VB_PARAMS_" + this.dagTimeT.getName()) .reduce(new eu.amidst.flinklink.core.learning.parametric.ParallelVB.ParallelVBReduce()); config.setString(eu.amidst.flinklink.core.learning.parametric.ParameterLearningAlgorithm.BN_NAME, this.dagTimeT.getName()); config.setBytes(eu.amidst.flinklink.core.learning.parametric.ParallelVB.SVB, Serialization.serializeObject(svbTimeT)); config.setBytes(LATENT_VARIABLE_NAMES, Serialization.serializeObject(this.latentVariablesNames));