use of de.lmu.ifi.dbs.elki.result.OrderingResult in project elki by elki-project.
the class OutlierSmROCCurve method processNewResult.
@Override
public void processNewResult(ResultHierarchy hier, Result result) {
Database db = ResultUtil.findDatabase(hier);
// Prepare
SetDBIDs positiveids = DBIDUtil.ensureSet(DatabaseUtil.getObjectsByLabelMatch(db, positiveClassName));
if (positiveids.size() == 0) {
LOG.warning("Computing a ROC curve failed - no objects matched.");
return;
}
List<OutlierResult> oresults = OutlierResult.getOutlierResults(result);
List<OrderingResult> orderings = ResultUtil.getOrderingResults(result);
for (OutlierResult o : oresults) {
db.getHierarchy().add(o, computeSmROCResult(positiveids, o));
orderings.remove(o.getOrdering());
}
}
use of de.lmu.ifi.dbs.elki.result.OrderingResult in project elki by elki-project.
the class ComputeSimilarityMatrixImage method processNewResult.
@Override
public void processNewResult(ResultHierarchy hier, Result result) {
Database db = ResultUtil.findDatabase(hier);
boolean nonefound = true;
List<OutlierResult> oresults = OutlierResult.getOutlierResults(result);
List<OrderingResult> orderings = ResultUtil.getOrderingResults(result);
// Outlier results are the main use case.
for (OutlierResult o : oresults) {
final OrderingResult or = o.getOrdering();
Relation<O> relation = db.getRelation(distanceFunction.getInputTypeRestriction());
db.getHierarchy().add(or, computeSimilarityMatrixImage(relation, or.order(relation.getDBIDs()).iter()));
// Process them only once.
orderings.remove(or);
nonefound = false;
}
// otherwise apply an ordering to the database IDs.
for (OrderingResult or : orderings) {
Relation<O> relation = db.getRelation(distanceFunction.getInputTypeRestriction());
DBIDIter iter = or.order(relation.getDBIDs()).iter();
db.getHierarchy().add(or, computeSimilarityMatrixImage(relation, iter));
nonefound = false;
}
if (nonefound) {
// Use the database ordering.
// But be careful to NOT cause a loop, process new databases only.
List<Database> iter = ResultUtil.filterResults(hier, Database.class);
for (Database database : iter) {
// Get an arbitrary representation
Relation<O> relation = database.getRelation(distanceFunction.getInputTypeRestriction());
db.getHierarchy().add(db, computeSimilarityMatrixImage(relation, relation.iterDBIDs()));
}
}
}
use of de.lmu.ifi.dbs.elki.result.OrderingResult in project elki by elki-project.
the class OutlierPrecisionAtKCurve method processNewResult.
@Override
public void processNewResult(ResultHierarchy hier, Result result) {
Database db = ResultUtil.findDatabase(hier);
// Prepare
SetDBIDs positiveids = DBIDUtil.ensureSet(DatabaseUtil.getObjectsByLabelMatch(db, positiveClassName));
if (positiveids.size() == 0) {
LOG.warning("Computing a ROC curve failed - no objects matched.");
return;
}
List<OutlierResult> oresults = OutlierResult.getOutlierResults(result);
List<OrderingResult> orderings = ResultUtil.getOrderingResults(result);
// Outlier results are the main use case.
for (OutlierResult o : oresults) {
DBIDs sorted = o.getOrdering().order(o.getOrdering().getDBIDs());
db.getHierarchy().add(o, computePrecisionResult(o.getScores().size(), positiveids, sorted));
// Process them only once.
orderings.remove(o.getOrdering());
}
// otherwise apply an ordering to the database IDs.
for (OrderingResult or : orderings) {
DBIDs sorted = or.order(or.getDBIDs());
db.getHierarchy().add(or, computePrecisionResult(or.getDBIDs().size(), positiveids, sorted));
}
}
Aggregations