use of de.lmu.ifi.dbs.elki.data.type.NoSupportedDataTypeException in project elki by elki-project.
the class ByLabelOrAllInOneClustering method run.
@Override
public Clustering<Model> run(Database database) {
// Prefer a true class label
try {
Relation<ClassLabel> relation = database.getRelation(TypeUtil.CLASSLABEL);
return run(relation);
} catch (NoSupportedDataTypeException e) {
// Ignore.
}
try {
Relation<ClassLabel> relation = database.getRelation(TypeUtil.GUESSED_LABEL);
return run(relation);
} catch (NoSupportedDataTypeException e) {
// Ignore.
}
final DBIDs ids = database.getRelation(TypeUtil.ANY).getDBIDs();
Clustering<Model> result = new Clustering<>("All-in-one trivial Clustering", "allinone-clustering");
Cluster<Model> c = new Cluster<Model>(ids, ClusterModel.CLUSTER);
result.addToplevelCluster(c);
return result;
}
use of de.lmu.ifi.dbs.elki.data.type.NoSupportedDataTypeException in project elki by elki-project.
the class VisualizerContext method generateDefaultClustering.
/**
* Generate a default (fallback) clustering.
*
* @return generated clustering
*/
private Clustering<Model> generateDefaultClustering() {
final Database db = ResultUtil.findDatabase(hier);
Clustering<Model> c = null;
try {
// Try to cluster by labels
ByLabelHierarchicalClustering split = new ByLabelHierarchicalClustering();
c = split.run(db);
} catch (NoSupportedDataTypeException e) {
// Put everything into one
c = new TrivialAllInOne().run(db);
}
return c;
}
Aggregations