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 intnumPositiveNumber of positive examples in the vector.protected intposCurrent position.protected NumberVectorpositiveVector of positive examples.protected int[]sortOrder of dimensions.protected NumberVectorvecData 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 AbstractVectorIteradvance()Moves the iterator forward to the next entry.AbstractVectorIteradvance(int count)Moves the iterator forward or backward by the given offset.intdim()Get the dimension in the original vector.intgetOffset()Get current iterator offset.intnumPositive()Return the number of positive ids.intnumTotal()Return the number of all ids.AbstractVectorIterretract()Moves the iterator backward to the previous entry.AbstractVectorIterseek(int off)Moves the iterator to the given positionbooleantest()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
-
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:IterReturns true if the iterator currently points to a valid object.
-
advance
public AbstractVectorIter 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
-
getOffset
public int getOffset()
Description copied from interface:ArrayIterGet current iterator offset.
-
advance
public AbstractVectorIter advance(int count)
Description copied from interface:ArrayIterMoves the iterator forward or backward by the given offset.
-
retract
public AbstractVectorIter retract()
Description copied from interface:ArrayIterMoves the iterator backward to the previous entry.
-
seek
public AbstractVectorIter seek(int off)
Description copied from interface:ArrayIterMoves the iterator to the given position
-
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.
-
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
-
-