use of de.lmu.ifi.dbs.elki.data.Clustering in project elki by elki-project.
the class EvaluateSquaredErrors method processNewResult.
@Override
public void processNewResult(ResultHierarchy hier, Result result) {
List<Clustering<?>> crs = Clustering.getClusteringResults(result);
if (crs.isEmpty()) {
return;
}
Database db = ResultUtil.findDatabase(hier);
Relation<NumberVector> rel = db.getRelation(distance.getInputTypeRestriction());
for (Clustering<?> c : crs) {
evaluateClustering(db, rel, c);
}
}
use of de.lmu.ifi.dbs.elki.data.Clustering in project elki by elki-project.
the class EvaluateClustering method processNewResult.
@Override
public void processNewResult(ResultHierarchy hier, Result newResult) {
// We may just have added this result.
if (newResult instanceof Clustering && isReferenceResult((Clustering<?>) newResult)) {
return;
}
Database db = ResultUtil.findDatabase(hier);
List<Clustering<?>> crs = Clustering.getClusteringResults(newResult);
if (crs == null || crs.isEmpty()) {
return;
}
// Compute the reference clustering
Clustering<?> refc = null;
// Try to find an existing reference clustering (globally)
{
Collection<Clustering<?>> cs = ResultUtil.filterResults(hier, db, Clustering.class);
for (Clustering<?> test : cs) {
if (isReferenceResult(test)) {
refc = test;
break;
}
}
}
// Try to find an existing reference clustering (locally)
if (refc == null) {
Collection<Clustering<?>> cs = ResultUtil.filterResults(hier, newResult, Clustering.class);
for (Clustering<?> test : cs) {
if (isReferenceResult(test)) {
refc = test;
break;
}
}
}
if (refc == null) {
LOG.debug("Generating a new reference clustering.");
Result refres = referencealg.run(db);
List<Clustering<?>> refcrs = Clustering.getClusteringResults(refres);
if (refcrs.isEmpty()) {
LOG.warning("Reference algorithm did not return a clustering result!");
return;
}
if (refcrs.size() > 1) {
LOG.warning("Reference algorithm returned more than one result!");
}
refc = refcrs.get(0);
} else {
LOG.debug("Using existing clustering: " + refc.getLongName() + " " + refc.getShortName());
}
for (Clustering<?> c : crs) {
if (c == refc) {
continue;
}
evaluteResult(db, c, refc);
}
}
use of de.lmu.ifi.dbs.elki.data.Clustering in project elki by elki-project.
the class OpenGL3DParallelCoordinates method getStylePolicy.
/**
* Hack: Get/Create the style result.
*
* @return Style result
*/
public StylingPolicy getStylePolicy(ResultHierarchy hier, StyleLibrary stylelib) {
Database db = ResultUtil.findDatabase(hier);
AutomaticEvaluation.ensureClusteringResult(db, db);
List<Clustering<? extends Model>> clusterings = Clustering.getClusteringResults(db);
if (clusterings.size() > 0) {
return new ClusterStylingPolicy(clusterings.get(0), stylelib);
} else {
throw new AbortException("No clustering result generated?!?");
}
}
Aggregations