Package elki.evaluation.scores.adapter
Class DistanceResultAdapter
- java.lang.Object
-
- elki.evaluation.scores.adapter.DistanceResultAdapter
-
- All Implemented Interfaces:
ScoreEvaluation.Adapter,Iter
- Direct Known Subclasses:
FilteredDistanceResultAdapter
public class DistanceResultAdapter extends java.lang.Object implements ScoreEvaluation.Adapter
This adapter is used to process a list of (double, DBID) objects. The list must be sorted appropriately, the score is only used to detect ties.- Since:
- 0.7.0
- Author:
- Erich Schubert
-
-
Constructor Summary
Constructors Constructor Description DistanceResultAdapter(DBIDs set, DoubleDBIDListIter iter, int size)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DistanceResultAdapteradvance()Moves the iterator forward to the next entry.intnumPositive()Return the number of positive ids.intnumTotal()Return the number of all ids.booleantest()True if the current object is a positive example.booleantiedToPrevious()Test whether the score is the same as the previous objects score.booleanvalid()Returns true if the iterator currently points to a valid object.
-
-
-
Field Detail
-
set
private DBIDs set
Set of positive examples.
-
iter
protected DoubleDBIDListIter iter
Original iterator
-
size
private int size
Number of IDs
-
prevDist
protected double prevDist
Distance of previous.
-
-
Constructor Detail
-
DistanceResultAdapter
public DistanceResultAdapter(DBIDs set, DoubleDBIDListIter iter, int size)
Constructor- Parameters:
set- Set of positive examplesiter- Iterator for distance resultssize- Number of IDs
-
-
Method Detail
-
valid
public boolean valid()
Description copied from interface:IterReturns true if the iterator currently points to a valid object.
-
advance
public DistanceResultAdapter advance()
Description copied from interface:IterMoves the iterator forward to the next entry.
-
tiedToPrevious
public boolean tiedToPrevious()
Description copied from interface:ScoreEvaluation.AdapterTest whether the score is the same as the previous objects score. When there is no previous result, implementations should return false!- Specified by:
tiedToPreviousin interfaceScoreEvaluation.Adapter- Returns:
- Boolean
-
numPositive
public int numPositive()
Description copied from interface:ScoreEvaluation.AdapterReturn the number of positive ids.- Specified by:
numPositivein interfaceScoreEvaluation.Adapter- Returns:
- Number of positive elements
-
numTotal
public int numTotal()
Description copied from interface:ScoreEvaluation.AdapterReturn the number of all ids.- Specified by:
numTotalin interfaceScoreEvaluation.Adapter- Returns:
- Number of all elements
-
test
public boolean test()
Description copied from interface:ScoreEvaluation.AdapterTrue if the current object is a positive example.- Specified by:
testin interfaceScoreEvaluation.Adapter- Returns:
truewhen positive.
-
-