Search in sources :

Example 1 with OrderingResult

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());
    }
}
Also used : OrderingResult(de.lmu.ifi.dbs.elki.result.OrderingResult) Database(de.lmu.ifi.dbs.elki.database.Database) OutlierResult(de.lmu.ifi.dbs.elki.result.outlier.OutlierResult) SetDBIDs(de.lmu.ifi.dbs.elki.database.ids.SetDBIDs)

Example 2 with OrderingResult

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()));
        }
    }
}
Also used : OrderingResult(de.lmu.ifi.dbs.elki.result.OrderingResult) Database(de.lmu.ifi.dbs.elki.database.Database) OutlierResult(de.lmu.ifi.dbs.elki.result.outlier.OutlierResult) ImageIO(javax.imageio.ImageIO) DBIDIter(de.lmu.ifi.dbs.elki.database.ids.DBIDIter)

Example 3 with OrderingResult

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));
    }
}
Also used : OrderingResult(de.lmu.ifi.dbs.elki.result.OrderingResult) DBIDs(de.lmu.ifi.dbs.elki.database.ids.DBIDs) SetDBIDs(de.lmu.ifi.dbs.elki.database.ids.SetDBIDs) Database(de.lmu.ifi.dbs.elki.database.Database) OutlierResult(de.lmu.ifi.dbs.elki.result.outlier.OutlierResult) SetDBIDs(de.lmu.ifi.dbs.elki.database.ids.SetDBIDs)

Aggregations

Database (de.lmu.ifi.dbs.elki.database.Database)3 OrderingResult (de.lmu.ifi.dbs.elki.result.OrderingResult)3 OutlierResult (de.lmu.ifi.dbs.elki.result.outlier.OutlierResult)3 SetDBIDs (de.lmu.ifi.dbs.elki.database.ids.SetDBIDs)2 DBIDIter (de.lmu.ifi.dbs.elki.database.ids.DBIDIter)1 DBIDs (de.lmu.ifi.dbs.elki.database.ids.DBIDs)1 ImageIO (javax.imageio.ImageIO)1