Search in sources :

Example 26 with StepProgress

use of de.lmu.ifi.dbs.elki.logging.progress.StepProgress in project elki by elki-project.

the class MaterializeKNNPreprocessor method objectsInserted.

/**
 * Called after new objects have been inserted, updates the materialized
 * neighborhood.
 *
 * @param ids the ids of the newly inserted objects
 */
protected void objectsInserted(DBIDs ids) {
    // Could be subclass
    final Logging log = getLogger();
    StepProgress stepprog = log.isVerbose() ? new StepProgress(3) : null;
    ArrayDBIDs aids = DBIDUtil.ensureArray(ids);
    // materialize the new kNNs
    log.beginStep(stepprog, 1, "New insertions ocurred, materialize their new kNNs.");
    // Bulk-query kNNs
    List<? extends KNNList> kNNList = knnQuery.getKNNForBulkDBIDs(aids, k);
    // Store in storage
    DBIDIter iter = aids.iter();
    for (int i = 0; i < aids.size(); i++, iter.advance()) {
        storage.put(iter, kNNList.get(i));
    }
    // update the affected kNNs
    log.beginStep(stepprog, 2, "New insertions ocurred, update the affected kNNs.");
    ArrayDBIDs rkNN_ids = updateKNNsAfterInsertion(ids);
    // inform listener
    log.beginStep(stepprog, 3, "New insertions ocurred, inform listeners.");
    fireKNNsInserted(ids, rkNN_ids);
    log.setCompleted(stepprog);
}
Also used : Logging(de.lmu.ifi.dbs.elki.logging.Logging) ArrayDBIDs(de.lmu.ifi.dbs.elki.database.ids.ArrayDBIDs) StepProgress(de.lmu.ifi.dbs.elki.logging.progress.StepProgress) DBIDIter(de.lmu.ifi.dbs.elki.database.ids.DBIDIter)

Aggregations

StepProgress (de.lmu.ifi.dbs.elki.logging.progress.StepProgress)26 WritableDoubleDataStore (de.lmu.ifi.dbs.elki.database.datastore.WritableDoubleDataStore)13 DoubleMinMax (de.lmu.ifi.dbs.elki.math.DoubleMinMax)12 DBIDs (de.lmu.ifi.dbs.elki.database.ids.DBIDs)11 DoubleRelation (de.lmu.ifi.dbs.elki.database.relation.DoubleRelation)11 MaterializedDoubleRelation (de.lmu.ifi.dbs.elki.database.relation.MaterializedDoubleRelation)11 OutlierResult (de.lmu.ifi.dbs.elki.result.outlier.OutlierResult)11 OutlierScoreMeta (de.lmu.ifi.dbs.elki.result.outlier.OutlierScoreMeta)11 DBIDIter (de.lmu.ifi.dbs.elki.database.ids.DBIDIter)7 Cluster (de.lmu.ifi.dbs.elki.data.Cluster)6 FiniteProgress (de.lmu.ifi.dbs.elki.logging.progress.FiniteProgress)6 QuotientOutlierScoreMeta (de.lmu.ifi.dbs.elki.result.outlier.QuotientOutlierScoreMeta)6 ArrayList (java.util.ArrayList)6 Clustering (de.lmu.ifi.dbs.elki.data.Clustering)5 List (java.util.List)5 ArrayDBIDs (de.lmu.ifi.dbs.elki.database.ids.ArrayDBIDs)4 ModifiableDBIDs (de.lmu.ifi.dbs.elki.database.ids.ModifiableDBIDs)4 Subspace (de.lmu.ifi.dbs.elki.data.Subspace)3 Model (de.lmu.ifi.dbs.elki.data.model.Model)3 SubspaceModel (de.lmu.ifi.dbs.elki.data.model.SubspaceModel)3