本文整理汇总了Java中de.lmu.ifi.dbs.elki.result.ResultUtil.removeRecursive方法的典型用法代码示例。如果您正苦于以下问题:Java ResultUtil.removeRecursive方法的具体用法?Java ResultUtil.removeRecursive怎么用?Java ResultUtil.removeRecursive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类de.lmu.ifi.dbs.elki.result.ResultUtil
的用法示例。
在下文中一共展示了ResultUtil.removeRecursive方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removePreviousRelation
import de.lmu.ifi.dbs.elki.result.ResultUtil; //导入方法依赖的package包/类
/**
* Remove the previous relation.
*
* Manually also log index statistics, as we may be removing indexes.
*
* @param relation Relation to remove
*/
protected void removePreviousRelation(Relation<?> relation) {
if(keep) {
return;
}
boolean first = true;
for(It<Index> it = relation.getHierarchy().iterDescendants(relation).filter(Index.class); it.valid(); it.advance()) {
if(first) {
Logging.getLogger(getClass()).statistics("Index statistics when removing initial data relation.");
first = false;
}
it.get().logStatistics();
}
ResultUtil.removeRecursive(relation.getHierarchy(), relation);
}
示例2: run
import de.lmu.ifi.dbs.elki.result.ResultUtil; //导入方法依赖的package包/类
@Override
public void run() throws UnableToComplyException {
// Force the logging level to include statistics, so we always see the
// runtimes measured below.
LoggingConfiguration.setStatistics();
// Start a timer to measure overall runtime:
MillisTimeDuration timerAll = new MillisTimeDuration("algorithm.runtime.all").begin();
// We let the ELKI input step take care of loading the data
// This way, the user can choose the file type, parser, add filters, and use
// compressed files.
Database database = input.getDatabase();
// Create a progress bar (if -verbose is set).
FiniteProgress progress = LOG.isVerbose() ? new FiniteProgress("Repetitions", repetitions, LOG) : null;
MillisTimeDuration timer = new MillisTimeDuration("algorithm.runtime");
for(int i = 0; i < repetitions; i++) {
// Create our algorithm.
// We want some extra control here, so we do this in plain Java:
ExampleAlgorithm<NumberVector> alg = new ExampleAlgorithm<NumberVector>();
// AbstractAlgorithm will choose the appropriate data relation
// automatically, based on the data type information:
timer.begin();
Result result = alg.run(database);
LOG.statistics(timer.end()); // Log the time taken.
// Drop the result, to not leak memory across repetitions:
ResultUtil.removeRecursive(database.getHierarchy(), result);
LOG.incrementProcessed(progress);
}
// Close the progress bar
LOG.ensureCompleted(progress);
// Log the total runtime (including overhead!)
LOG.statistics(timerAll.end());
// Log the average runtime (including overhead!)
LOG.statistics(new DoubleStatistic("algorithm.runtime.average", timerAll.getDuration() / (double) repetitions));
// Log how many repetitions we did, for later analysis
LOG.statistics(new LongStatistic("algorithm.repetitions", repetitions));
}