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 DistanceResultAdapter
advance()
Moves the iterator forward to the next entry.int
numPositive()
Return the number of positive ids.int
numTotal()
Return the number of all ids.boolean
test()
True if the current object is a positive example.boolean
tiedToPrevious()
Test whether the score is the same as the previous objects score.boolean
valid()
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:Iter
Returns true if the iterator currently points to a valid object.
-
advance
public DistanceResultAdapter advance()
Description copied from interface:Iter
Moves the iterator forward to the next entry.
-
tiedToPrevious
public boolean tiedToPrevious()
Description copied from interface:ScoreEvaluation.Adapter
Test whether the score is the same as the previous objects score. When there is no previous result, implementations should return false!- Specified by:
tiedToPrevious
in interfaceScoreEvaluation.Adapter
- Returns:
- Boolean
-
numPositive
public int numPositive()
Description copied from interface:ScoreEvaluation.Adapter
Return the number of positive ids.- Specified by:
numPositive
in interfaceScoreEvaluation.Adapter
- Returns:
- Number of positive elements
-
numTotal
public int numTotal()
Description copied from interface:ScoreEvaluation.Adapter
Return the number of all ids.- Specified by:
numTotal
in interfaceScoreEvaluation.Adapter
- Returns:
- Number of all elements
-
test
public boolean test()
Description copied from interface:ScoreEvaluation.Adapter
True if the current object is a positive example.- Specified by:
test
in interfaceScoreEvaluation.Adapter
- Returns:
true
when positive.
-
-