org.apache.flink.api.common.aggregators.ConvergenceCriterion Java Examples
The following examples show how to use
org.apache.flink.api.common.aggregators.ConvergenceCriterion.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TaskConfig.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
public void setConvergenceCriterion(String aggregatorName, ConvergenceCriterion<?> convCriterion) { try { InstantiationUtil.writeObjectToConfig(convCriterion, this.config, ITERATION_CONVERGENCE_CRITERION); } catch (IOException e) { throw new RuntimeException("Error while writing the convergence criterion object to the task configuration."); } this.config.setString(ITERATION_CONVERGENCE_CRITERION_AGG_NAME, aggregatorName); }
Example #2
Source File: TaskConfig.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
/** * Sets the default convergence criterion of a {@link DeltaIteration} * * @param aggregatorName * @param convCriterion */ public void setImplicitConvergenceCriterion(String aggregatorName, ConvergenceCriterion<?> convCriterion) { try { InstantiationUtil.writeObjectToConfig(convCriterion, this.config, ITERATION_IMPLICIT_CONVERGENCE_CRITERION); } catch (IOException e) { throw new RuntimeException("Error while writing the implicit convergence criterion object to the task configuration."); } this.config.setString(ITERATION_IMPLICIT_CONVERGENCE_CRITERION_AGG_NAME, aggregatorName); }
Example #3
Source File: TaskConfig.java From flink with Apache License 2.0 | 5 votes |
/** * Sets the default convergence criterion of a {@link DeltaIteration} * * @param aggregatorName * @param convCriterion */ public void setImplicitConvergenceCriterion(String aggregatorName, ConvergenceCriterion<?> convCriterion) { try { InstantiationUtil.writeObjectToConfig(convCriterion, this.config, ITERATION_IMPLICIT_CONVERGENCE_CRITERION); } catch (IOException e) { throw new RuntimeException("Error while writing the implicit convergence criterion object to the task configuration."); } this.config.setString(ITERATION_IMPLICIT_CONVERGENCE_CRITERION_AGG_NAME, aggregatorName); }
Example #4
Source File: TaskConfig.java From flink with Apache License 2.0 | 5 votes |
public void setConvergenceCriterion(String aggregatorName, ConvergenceCriterion<?> convCriterion) { try { InstantiationUtil.writeObjectToConfig(convCriterion, this.config, ITERATION_CONVERGENCE_CRITERION); } catch (IOException e) { throw new RuntimeException("Error while writing the convergence criterion object to the task configuration."); } this.config.setString(ITERATION_CONVERGENCE_CRITERION_AGG_NAME, aggregatorName); }
Example #5
Source File: TaskConfig.java From flink with Apache License 2.0 | 5 votes |
public void setConvergenceCriterion(String aggregatorName, ConvergenceCriterion<?> convCriterion) { try { InstantiationUtil.writeObjectToConfig(convCriterion, this.config, ITERATION_CONVERGENCE_CRITERION); } catch (IOException e) { throw new RuntimeException("Error while writing the convergence criterion object to the task configuration."); } this.config.setString(ITERATION_CONVERGENCE_CRITERION_AGG_NAME, aggregatorName); }
Example #6
Source File: TaskConfig.java From flink with Apache License 2.0 | 5 votes |
/** * Sets the default convergence criterion of a {@link DeltaIteration} * * @param aggregatorName * @param convCriterion */ public void setImplicitConvergenceCriterion(String aggregatorName, ConvergenceCriterion<?> convCriterion) { try { InstantiationUtil.writeObjectToConfig(convCriterion, this.config, ITERATION_IMPLICIT_CONVERGENCE_CRITERION); } catch (IOException e) { throw new RuntimeException("Error while writing the implicit convergence criterion object to the task configuration."); } this.config.setString(ITERATION_IMPLICIT_CONVERGENCE_CRITERION_AGG_NAME, aggregatorName); }
Example #7
Source File: dVMPv1.java From toolbox with Apache License 2.0 | 4 votes |
public double updateModel(DataFlink<DataInstance> dataUpdate){ try{ final ExecutionEnvironment env = dataUpdate.getDataSet().getExecutionEnvironment(); // get input data CompoundVector parameterPrior = this.svb.getNaturalParameterPrior(); DataSet<CompoundVector> paramSet = env.fromElements(parameterPrior); ConvergenceCriterion convergenceELBO; if(timeLimit == -1) { convergenceELBO = new ConvergenceELBO(this.globalThreshold, System.nanoTime()); } else { convergenceELBO = new ConvergenceELBObyTime(this.timeLimit, System.nanoTime(), this.idenitifableModelling.getNumberOfEpochs()); this.setMaximumGlobalIterations(5000); } // set number of bulk iterations for KMeans algorithm IterativeDataSet<CompoundVector> loop = paramSet.iterate(maximumGlobalIterations) .registerAggregationConvergenceCriterion("ELBO_" + this.dag.getName(), new DoubleSumAggregator(),convergenceELBO); Configuration config = new Configuration(); config.setString(ParameterLearningAlgorithm.BN_NAME, this.dag.getName()); config.setBytes(SVB, Serialization.serializeObject(svb)); //We add an empty batched data set to emit the updated prior. DataOnMemory<DataInstance> emtpyBatch = new DataOnMemoryListContainer<DataInstance>(dataUpdate.getAttributes()); DataSet<DataOnMemory<DataInstance>> unionData = null; unionData = dataUpdate.getBatchedDataSet(this.batchSize) .union(env.fromCollection(Arrays.asList(emtpyBatch), TypeExtractor.getForClass((Class<DataOnMemory<DataInstance>>) Class.forName("eu.amidst.core.datastream.DataOnMemory")))); DataSet<CompoundVector> newparamSet = unionData .map(new ParallelVBMap(randomStart, idenitifableModelling)) .withParameters(config) .withBroadcastSet(loop, "VB_PARAMS_" + this.dag.getName()) .reduce(new ParallelVBReduce()); // feed new centroids back into next iteration DataSet<CompoundVector> finlparamSet = loop.closeWith(newparamSet); parameterPrior = finlparamSet.collect().get(0); this.svb.updateNaturalParameterPosteriors(parameterPrior); this.svb.updateNaturalParameterPrior(parameterPrior); if(timeLimit == -1) this.globalELBO = ((ConvergenceELBO)loop.getAggregators().getConvergenceCriterion()).getELBO(); else this.globalELBO = ((ConvergenceELBObyTime)loop.getAggregators().getConvergenceCriterion()).getELBO(); this.svb.applyTransition(); }catch(Exception ex){ System.out.println(ex.getMessage().toString()); ex.printStackTrace(); throw new RuntimeException(ex.getMessage()); } this.randomStart=false; return this.getLogMarginalProbability(); }
Example #8
Source File: DistributedVI.java From toolbox with Apache License 2.0 | 4 votes |
@Override public double updateModel(DataFlink<DataInstance> dataUpdate){ try{ final ExecutionEnvironment env = dataUpdate.getDataSet().getExecutionEnvironment(); // get input data CompoundVector parameterPrior = this.svb.getNaturalParameterPrior(); DataSet<CompoundVector> paramSet = env.fromElements(parameterPrior); ConvergenceCriterion convergenceELBO; if(timeLimit == -1) { convergenceELBO = new ConvergenceELBO(this.globalThreshold, System.nanoTime()); } else { convergenceELBO = new ConvergenceELBObyTime(this.timeLimit, System.nanoTime()); this.setMaximumGlobalIterations(5000); } // set number of bulk iterations for KMeans algorithm IterativeDataSet<CompoundVector> loop = paramSet.iterate(maximumGlobalIterations) .registerAggregationConvergenceCriterion("ELBO_" + this.dag.getName(), new DoubleSumAggregator(),convergenceELBO); Configuration config = new Configuration(); config.setString(ParameterLearningAlgorithm.BN_NAME, this.dag.getName()); config.setBytes(SVB, Serialization.serializeObject(svb)); //We add an empty batched data set to emit the updated prior. DataOnMemory<DataInstance> emtpyBatch = new DataOnMemoryListContainer<DataInstance>(dataUpdate.getAttributes()); DataSet<DataOnMemory<DataInstance>> unionData = null; unionData = dataUpdate.getBatchedDataSet(this.batchSize) .union(env.fromCollection(Arrays.asList(emtpyBatch), TypeExtractor.getForClass((Class<DataOnMemory<DataInstance>>) Class.forName("eu.amidst.core.datastream.DataOnMemory")))); DataSet<CompoundVector> newparamSet = unionData .map(new ParallelVBMap(randomStart, idenitifableModelling)) .withParameters(config) .withBroadcastSet(loop, "VB_PARAMS_" + this.dag.getName()) .reduce(new ParallelVBReduce()); // feed new centroids back into next iteration DataSet<CompoundVector> finlparamSet = loop.closeWith(newparamSet); parameterPrior = finlparamSet.collect().get(0); this.svb.updateNaturalParameterPosteriors(parameterPrior); this.svb.updateNaturalParameterPrior(parameterPrior); if(timeLimit == -1) this.globalELBO = ((ConvergenceELBO)loop.getAggregators().getConvergenceCriterion()).getELBO(); else this.globalELBO = ((ConvergenceELBObyTime)loop.getAggregators().getConvergenceCriterion()).getELBO(); this.svb.applyTransition(); }catch(Exception ex){ throw new RuntimeException(ex.getMessage()); } this.randomStart=false; return this.getLogMarginalProbability(); }
Example #9
Source File: ParallelVB.java From toolbox with Apache License 2.0 | 4 votes |
public double updateModel(DataFlink<DataInstance> dataUpdate){ try{ final ExecutionEnvironment env = dataUpdate.getDataSet().getExecutionEnvironment(); // get input data CompoundVector parameterPrior = this.svb.getNaturalParameterPrior(); DataSet<CompoundVector> paramSet = env.fromElements(parameterPrior); ConvergenceCriterion convergenceELBO; if(timeLimit == -1) { convergenceELBO = new ConvergenceELBO(this.globalThreshold, System.nanoTime()); } else { convergenceELBO = new ConvergenceELBObyTime(this.timeLimit, System.nanoTime()); this.setMaximumGlobalIterations(5000); } // set number of bulk iterations for KMeans algorithm IterativeDataSet<CompoundVector> loop = paramSet.iterate(maximumGlobalIterations) .registerAggregationConvergenceCriterion("ELBO_" + this.dag.getName(), new DoubleSumAggregator(),convergenceELBO); Configuration config = new Configuration(); config.setString(ParameterLearningAlgorithm.BN_NAME, this.dag.getName()); config.setBytes(SVB, Serialization.serializeObject(svb)); //We add an empty batched data set to emit the updated prior. DataOnMemory<DataInstance> emtpyBatch = new DataOnMemoryListContainer<DataInstance>(dataUpdate.getAttributes()); DataSet<DataOnMemory<DataInstance>> unionData = null; unionData = dataUpdate.getBatchedDataSet(this.batchSize) .union(env.fromCollection(Arrays.asList(emtpyBatch), TypeExtractor.getForClass((Class<DataOnMemory<DataInstance>>) Class.forName("eu.amidst.core.datastream.DataOnMemory")))); DataSet<CompoundVector> newparamSet = unionData .map(new ParallelVBMap(randomStart, idenitifableModelling)) .withParameters(config) .withBroadcastSet(loop, "VB_PARAMS_" + this.dag.getName()) .reduce(new ParallelVBReduce()); // feed new centroids back into next iteration DataSet<CompoundVector> finlparamSet = loop.closeWith(newparamSet); parameterPrior = finlparamSet.collect().get(0); this.svb.updateNaturalParameterPosteriors(parameterPrior); this.svb.updateNaturalParameterPrior(parameterPrior); if(timeLimit == -1) this.globalELBO = ((ConvergenceELBO)loop.getAggregators().getConvergenceCriterion()).getELBO(); else this.globalELBO = ((ConvergenceELBObyTime)loop.getAggregators().getConvergenceCriterion()).getELBO(); this.svb.applyTransition(); }catch(Exception ex){ throw new RuntimeException(ex.getMessage()); } this.randomStart=false; return this.getLogMarginalProbability(); }
Example #10
Source File: dVMP.java From toolbox with Apache License 2.0 | 4 votes |
@Override public double updateModel(DataFlink<DataInstance> dataUpdate){ try{ final ExecutionEnvironment env = dataUpdate.getDataSet().getExecutionEnvironment(); // get input data CompoundVector parameterPrior = this.svb.getNaturalParameterPrior(); DataSet<CompoundVector> paramSet = env.fromElements(parameterPrior); ConvergenceCriterion convergenceELBO; if(timeLimit == -1) { convergenceELBO = new ConvergenceELBO(this.globalThreshold, System.nanoTime()); } else { convergenceELBO = new ConvergenceELBObyTime(this.timeLimit, System.nanoTime()); this.setMaximumGlobalIterations(5000); } // set number of bulk iterations for KMeans algorithm IterativeDataSet<CompoundVector> loop = paramSet.iterate(maximumGlobalIterations) .registerAggregationConvergenceCriterion("ELBO_" + this.getName(), new DoubleSumAggregator(),convergenceELBO); Configuration config = new Configuration(); config.setString(ParameterLearningAlgorithm.BN_NAME, this.getName()); config.setBytes(SVB, Serialization.serializeObject(svb)); //We add an empty batched data set to emit the updated prior. DataOnMemory<DataInstance> emtpyBatch = new DataOnMemoryListContainer<DataInstance>(dataUpdate.getAttributes()); DataSet<DataOnMemory<DataInstance>> unionData = null; unionData = dataUpdate.getBatchedDataSet(this.batchSize, batchConverter) .union(env.fromCollection(Arrays.asList(emtpyBatch), TypeExtractor.getForClass((Class<DataOnMemory<DataInstance>>) Class.forName("eu.amidst.core.datastream.DataOnMemory")))); DataSet<CompoundVector> newparamSet = unionData .map(new ParallelVBMap(randomStart, idenitifableModelling)) .withParameters(config) .withBroadcastSet(loop, "VB_PARAMS_" + this.getName()) .reduce(new ParallelVBReduce()); // feed new centroids back into next iteration DataSet<CompoundVector> finlparamSet = loop.closeWith(newparamSet); parameterPrior = finlparamSet.collect().get(0); this.svb.updateNaturalParameterPosteriors(parameterPrior); this.svb.updateNaturalParameterPrior(parameterPrior); if(timeLimit == -1) this.globalELBO = ((ConvergenceELBO)loop.getAggregators().getConvergenceCriterion()).getELBO(); else this.globalELBO = ((ConvergenceELBObyTime)loop.getAggregators().getConvergenceCriterion()).getELBO(); this.svb.applyTransition(); }catch(Exception ex){ System.out.println(ex.getMessage().toString()); ex.printStackTrace(); throw new RuntimeException(ex.getMessage()); } this.randomStart=false; return this.getLogMarginalProbability(); }
Example #11
Source File: CollectionExecutor.java From flink with Apache License 2.0 | 4 votes |
@SuppressWarnings("unchecked") private <T> List<T> executeBulkIteration(BulkIterationBase<?> iteration) throws Exception { Operator<?> inputOp = iteration.getInput(); if (inputOp == null) { throw new InvalidProgramException("The iteration " + iteration.getName() + " has no input (initial partial solution)."); } if (iteration.getNextPartialSolution() == null) { throw new InvalidProgramException("The iteration " + iteration.getName() + " has no next partial solution defined (is not closed)."); } List<T> inputData = (List<T>) execute(inputOp); // get the operators that are iterative Set<Operator<?>> dynamics = new LinkedHashSet<Operator<?>>(); DynamicPathCollector dynCollector = new DynamicPathCollector(dynamics); iteration.getNextPartialSolution().accept(dynCollector); if (iteration.getTerminationCriterion() != null) { iteration.getTerminationCriterion().accept(dynCollector); } // register the aggregators for (AggregatorWithName<?> a : iteration.getAggregators().getAllRegisteredAggregators()) { aggregators.put(a.getName(), a.getAggregator()); } String convCriterionAggName = iteration.getAggregators().getConvergenceCriterionAggregatorName(); ConvergenceCriterion<Value> convCriterion = (ConvergenceCriterion<Value>) iteration.getAggregators().getConvergenceCriterion(); List<T> currentResult = inputData; final int maxIterations = iteration.getMaximumNumberOfIterations(); for (int superstep = 1; superstep <= maxIterations; superstep++) { // set the input to the current partial solution this.intermediateResults.put(iteration.getPartialSolution(), currentResult); // set the superstep number iterationSuperstep = superstep; // grab the current iteration result currentResult = (List<T>) execute(iteration.getNextPartialSolution(), superstep); // evaluate the termination criterion if (iteration.getTerminationCriterion() != null) { execute(iteration.getTerminationCriterion(), superstep); } // evaluate the aggregator convergence criterion if (convCriterion != null && convCriterionAggName != null) { Value v = aggregators.get(convCriterionAggName).getAggregate(); if (convCriterion.isConverged(superstep, v)) { break; } } // clear the dynamic results for (Operator<?> o : dynamics) { intermediateResults.remove(o); } // set the previous iteration's aggregates and reset the aggregators for (Map.Entry<String, Aggregator<?>> e : aggregators.entrySet()) { previousAggregates.put(e.getKey(), e.getValue().getAggregate()); e.getValue().reset(); } } previousAggregates.clear(); aggregators.clear(); return currentResult; }
Example #12
Source File: CollectionExecutor.java From flink with Apache License 2.0 | 4 votes |
@SuppressWarnings("unchecked") private <T> List<T> executeBulkIteration(BulkIterationBase<?> iteration) throws Exception { Operator<?> inputOp = iteration.getInput(); if (inputOp == null) { throw new InvalidProgramException("The iteration " + iteration.getName() + " has no input (initial partial solution)."); } if (iteration.getNextPartialSolution() == null) { throw new InvalidProgramException("The iteration " + iteration.getName() + " has no next partial solution defined (is not closed)."); } List<T> inputData = (List<T>) execute(inputOp); // get the operators that are iterative Set<Operator<?>> dynamics = new LinkedHashSet<Operator<?>>(); DynamicPathCollector dynCollector = new DynamicPathCollector(dynamics); iteration.getNextPartialSolution().accept(dynCollector); if (iteration.getTerminationCriterion() != null) { iteration.getTerminationCriterion().accept(dynCollector); } // register the aggregators for (AggregatorWithName<?> a : iteration.getAggregators().getAllRegisteredAggregators()) { aggregators.put(a.getName(), a.getAggregator()); } String convCriterionAggName = iteration.getAggregators().getConvergenceCriterionAggregatorName(); ConvergenceCriterion<Value> convCriterion = (ConvergenceCriterion<Value>) iteration.getAggregators().getConvergenceCriterion(); List<T> currentResult = inputData; final int maxIterations = iteration.getMaximumNumberOfIterations(); for (int superstep = 1; superstep <= maxIterations; superstep++) { // set the input to the current partial solution this.intermediateResults.put(iteration.getPartialSolution(), currentResult); // set the superstep number iterationSuperstep = superstep; // grab the current iteration result currentResult = (List<T>) execute(iteration.getNextPartialSolution(), superstep); // evaluate the termination criterion if (iteration.getTerminationCriterion() != null) { execute(iteration.getTerminationCriterion(), superstep); } // evaluate the aggregator convergence criterion if (convCriterion != null && convCriterionAggName != null) { Value v = aggregators.get(convCriterionAggName).getAggregate(); if (convCriterion.isConverged(superstep, v)) { break; } } // clear the dynamic results for (Operator<?> o : dynamics) { intermediateResults.remove(o); } // set the previous iteration's aggregates and reset the aggregators for (Map.Entry<String, Aggregator<?>> e : aggregators.entrySet()) { previousAggregates.put(e.getKey(), e.getValue().getAggregate()); e.getValue().reset(); } } previousAggregates.clear(); aggregators.clear(); return currentResult; }
Example #13
Source File: CollectionExecutor.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@SuppressWarnings("unchecked") private <T> List<T> executeBulkIteration(BulkIterationBase<?> iteration) throws Exception { Operator<?> inputOp = iteration.getInput(); if (inputOp == null) { throw new InvalidProgramException("The iteration " + iteration.getName() + " has no input (initial partial solution)."); } if (iteration.getNextPartialSolution() == null) { throw new InvalidProgramException("The iteration " + iteration.getName() + " has no next partial solution defined (is not closed)."); } List<T> inputData = (List<T>) execute(inputOp); // get the operators that are iterative Set<Operator<?>> dynamics = new LinkedHashSet<Operator<?>>(); DynamicPathCollector dynCollector = new DynamicPathCollector(dynamics); iteration.getNextPartialSolution().accept(dynCollector); if (iteration.getTerminationCriterion() != null) { iteration.getTerminationCriterion().accept(dynCollector); } // register the aggregators for (AggregatorWithName<?> a : iteration.getAggregators().getAllRegisteredAggregators()) { aggregators.put(a.getName(), a.getAggregator()); } String convCriterionAggName = iteration.getAggregators().getConvergenceCriterionAggregatorName(); ConvergenceCriterion<Value> convCriterion = (ConvergenceCriterion<Value>) iteration.getAggregators().getConvergenceCriterion(); List<T> currentResult = inputData; final int maxIterations = iteration.getMaximumNumberOfIterations(); for (int superstep = 1; superstep <= maxIterations; superstep++) { // set the input to the current partial solution this.intermediateResults.put(iteration.getPartialSolution(), currentResult); // set the superstep number iterationSuperstep = superstep; // grab the current iteration result currentResult = (List<T>) execute(iteration.getNextPartialSolution(), superstep); // evaluate the termination criterion if (iteration.getTerminationCriterion() != null) { execute(iteration.getTerminationCriterion(), superstep); } // evaluate the aggregator convergence criterion if (convCriterion != null && convCriterionAggName != null) { Value v = aggregators.get(convCriterionAggName).getAggregate(); if (convCriterion.isConverged(superstep, v)) { break; } } // clear the dynamic results for (Operator<?> o : dynamics) { intermediateResults.remove(o); } // set the previous iteration's aggregates and reset the aggregators for (Map.Entry<String, Aggregator<?>> e : aggregators.entrySet()) { previousAggregates.put(e.getKey(), e.getValue().getAggregate()); e.getValue().reset(); } } previousAggregates.clear(); aggregators.clear(); return currentResult; }
Example #14
Source File: DeltaIteration.java From flink with Apache License 2.0 | 3 votes |
/** * Registers an {@link Aggregator} for the iteration together with a {@link ConvergenceCriterion}. For a general description * of aggregators, see {@link #registerAggregator(String, Aggregator)} and {@link Aggregator}. * At the end of each iteration, the convergence criterion takes the aggregator's global aggregate value and decides whether * the iteration should terminate. A typical use case is to have an aggregator that sums up the total error of change * in an iteration step and have to have a convergence criterion that signals termination as soon as the aggregate value * is below a certain threshold. * * @param name The name under which the aggregator is registered. * @param aggregator The aggregator class. * @param convergenceCheck The convergence criterion. * * @return The DeltaIteration itself, to allow chaining function calls. */ @PublicEvolving public <X extends Value> DeltaIteration<ST, WT> registerAggregationConvergenceCriterion( String name, Aggregator<X> aggregator, ConvergenceCriterion<X> convergenceCheck) { this.aggregators.registerAggregationConvergenceCriterion(name, aggregator, convergenceCheck); return this; }
Example #15
Source File: IterativeDataSet.java From flink with Apache License 2.0 | 3 votes |
/** * Registers an {@link Aggregator} for the iteration together with a {@link ConvergenceCriterion}. For a general description * of aggregators, see {@link #registerAggregator(String, Aggregator)} and {@link Aggregator}. * At the end of each iteration, the convergence criterion takes the aggregator's global aggregate value and decided whether * the iteration should terminate. A typical use case is to have an aggregator that sums up the total error of change * in an iteration step and have to have a convergence criterion that signals termination as soon as the aggregate value * is below a certain threshold. * * @param name The name under which the aggregator is registered. * @param aggregator The aggregator class. * @param convergenceCheck The convergence criterion. * * @return The IterativeDataSet itself, to allow chaining function calls. */ @PublicEvolving public <X extends Value> IterativeDataSet<T> registerAggregationConvergenceCriterion( String name, Aggregator<X> aggregator, ConvergenceCriterion<X> convergenceCheck) { this.aggregators.registerAggregationConvergenceCriterion(name, aggregator, convergenceCheck); return this; }
Example #16
Source File: DeltaIteration.java From flink with Apache License 2.0 | 3 votes |
/** * Registers an {@link Aggregator} for the iteration together with a {@link ConvergenceCriterion}. For a general description * of aggregators, see {@link #registerAggregator(String, Aggregator)} and {@link Aggregator}. * At the end of each iteration, the convergence criterion takes the aggregator's global aggregate value and decides whether * the iteration should terminate. A typical use case is to have an aggregator that sums up the total error of change * in an iteration step and have to have a convergence criterion that signals termination as soon as the aggregate value * is below a certain threshold. * * @param name The name under which the aggregator is registered. * @param aggregator The aggregator class. * @param convergenceCheck The convergence criterion. * * @return The DeltaIteration itself, to allow chaining function calls. */ @PublicEvolving public <X extends Value> DeltaIteration<ST, WT> registerAggregationConvergenceCriterion( String name, Aggregator<X> aggregator, ConvergenceCriterion<X> convergenceCheck) { this.aggregators.registerAggregationConvergenceCriterion(name, aggregator, convergenceCheck); return this; }
Example #17
Source File: IterativeDataSet.java From flink with Apache License 2.0 | 3 votes |
/** * Registers an {@link Aggregator} for the iteration together with a {@link ConvergenceCriterion}. For a general description * of aggregators, see {@link #registerAggregator(String, Aggregator)} and {@link Aggregator}. * At the end of each iteration, the convergence criterion takes the aggregator's global aggregate value and decided whether * the iteration should terminate. A typical use case is to have an aggregator that sums up the total error of change * in an iteration step and have to have a convergence criterion that signals termination as soon as the aggregate value * is below a certain threshold. * * @param name The name under which the aggregator is registered. * @param aggregator The aggregator class. * @param convergenceCheck The convergence criterion. * * @return The IterativeDataSet itself, to allow chaining function calls. */ @PublicEvolving public <X extends Value> IterativeDataSet<T> registerAggregationConvergenceCriterion( String name, Aggregator<X> aggregator, ConvergenceCriterion<X> convergenceCheck) { this.aggregators.registerAggregationConvergenceCriterion(name, aggregator, convergenceCheck); return this; }
Example #18
Source File: DeltaIteration.java From Flink-CEPplus with Apache License 2.0 | 3 votes |
/** * Registers an {@link Aggregator} for the iteration together with a {@link ConvergenceCriterion}. For a general description * of aggregators, see {@link #registerAggregator(String, Aggregator)} and {@link Aggregator}. * At the end of each iteration, the convergence criterion takes the aggregator's global aggregate value and decides whether * the iteration should terminate. A typical use case is to have an aggregator that sums up the total error of change * in an iteration step and have to have a convergence criterion that signals termination as soon as the aggregate value * is below a certain threshold. * * @param name The name under which the aggregator is registered. * @param aggregator The aggregator class. * @param convergenceCheck The convergence criterion. * * @return The DeltaIteration itself, to allow chaining function calls. */ @PublicEvolving public <X extends Value> DeltaIteration<ST, WT> registerAggregationConvergenceCriterion( String name, Aggregator<X> aggregator, ConvergenceCriterion<X> convergenceCheck) { this.aggregators.registerAggregationConvergenceCriterion(name, aggregator, convergenceCheck); return this; }
Example #19
Source File: IterativeDataSet.java From Flink-CEPplus with Apache License 2.0 | 3 votes |
/** * Registers an {@link Aggregator} for the iteration together with a {@link ConvergenceCriterion}. For a general description * of aggregators, see {@link #registerAggregator(String, Aggregator)} and {@link Aggregator}. * At the end of each iteration, the convergence criterion takes the aggregator's global aggregate value and decided whether * the iteration should terminate. A typical use case is to have an aggregator that sums up the total error of change * in an iteration step and have to have a convergence criterion that signals termination as soon as the aggregate value * is below a certain threshold. * * @param name The name under which the aggregator is registered. * @param aggregator The aggregator class. * @param convergenceCheck The convergence criterion. * * @return The IterativeDataSet itself, to allow chaining function calls. */ @PublicEvolving public <X extends Value> IterativeDataSet<T> registerAggregationConvergenceCriterion( String name, Aggregator<X> aggregator, ConvergenceCriterion<X> convergenceCheck) { this.aggregators.registerAggregationConvergenceCriterion(name, aggregator, convergenceCheck); return this; }