Search in sources :

Example 1 with SamplingResult

use of de.lmu.ifi.dbs.elki.result.SamplingResult in project elki by elki-project.

the class VisualizerParameterizer method newContext.

/**
 * Make a new visualization context
 *
 * @param hier Result hierarchy
 * @param start Starting result
 * @return New context
 */
public VisualizerContext newContext(ResultHierarchy hier, Result start) {
    Collection<Relation<?>> rels = ResultUtil.filterResults(hier, Relation.class);
    for (Relation<?> rel : rels) {
        if (samplesize == 0) {
            continue;
        }
        if (!ResultUtil.filterResults(hier, rel, SamplingResult.class).isEmpty()) {
            continue;
        }
        if (rel.size() > samplesize) {
            SamplingResult sample = new SamplingResult(rel);
            sample.setSample(DBIDUtil.randomSample(sample.getSample(), samplesize, rnd));
            ResultUtil.addChildResult(rel, sample);
        }
    }
    return new VisualizerContext(hier, start, stylelib, factories);
}
Also used : Relation(de.lmu.ifi.dbs.elki.database.relation.Relation) SamplingResult(de.lmu.ifi.dbs.elki.result.SamplingResult)

Aggregations

Relation (de.lmu.ifi.dbs.elki.database.relation.Relation)1 SamplingResult (de.lmu.ifi.dbs.elki.result.SamplingResult)1