Package elki.evaluation.scores.adapter
Class AbstractVectorIter
- java.lang.Object
-
- elki.evaluation.scores.adapter.AbstractVectorIter
-
- All Implemented Interfaces:
ScoreEvaluation.Adapter
,ArrayIter
,Iter
- Direct Known Subclasses:
DecreasingVectorIter
,IncreasingVectorIter
public abstract class AbstractVectorIter extends java.lang.Object implements ScoreEvaluation.Adapter, ArrayIter
Class to iterate over a number vector in decreasing order.- Since:
- 0.7.0
- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description protected int
numPositive
Number of positive examples in the vector.protected int
pos
Current position.protected NumberVector
positive
Vector of positive examples.protected int[]
sort
Order of dimensions.protected NumberVector
vec
Data vector.
-
Constructor Summary
Constructors Constructor Description AbstractVectorIter(NumberVector positive, NumberVector vec)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AbstractVectorIter
advance()
Moves the iterator forward to the next entry.AbstractVectorIter
advance(int count)
Moves the iterator forward or backward by the given offset.int
dim()
Get the dimension in the original vector.int
getOffset()
Get current iterator offset.int
numPositive()
Return the number of positive ids.int
numTotal()
Return the number of all ids.AbstractVectorIter
retract()
Moves the iterator backward to the previous entry.AbstractVectorIter
seek(int off)
Moves the iterator to the given positionboolean
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
-
sort
protected int[] sort
Order of dimensions.
-
positive
protected NumberVector positive
Vector of positive examples.
-
vec
protected NumberVector vec
Data vector.
-
pos
protected int pos
Current position.
-
numPositive
protected int numPositive
Number of positive examples in the vector.
-
-
Constructor Detail
-
AbstractVectorIter
public AbstractVectorIter(NumberVector positive, NumberVector vec)
Constructor.- Parameters:
positive
- Positive examplesvec
- Vector to iterate over.
-
-
Method Detail
-
dim
public int dim()
Get the dimension in the original vector.- Returns:
- Vector position.
-
valid
public boolean valid()
Description copied from interface:Iter
Returns true if the iterator currently points to a valid object.
-
advance
public AbstractVectorIter 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
-
getOffset
public int getOffset()
Description copied from interface:ArrayIter
Get current iterator offset.
-
advance
public AbstractVectorIter advance(int count)
Description copied from interface:ArrayIter
Moves the iterator forward or backward by the given offset.
-
retract
public AbstractVectorIter retract()
Description copied from interface:ArrayIter
Moves the iterator backward to the previous entry.
-
seek
public AbstractVectorIter seek(int off)
Description copied from interface:ArrayIter
Moves the iterator to the given position
-
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.
-
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
-
-