Package elki.algorithm.statistics
Class AveragePrecisionAtK<O>
- java.lang.Object
-
- elki.algorithm.statistics.AveragePrecisionAtK<O>
-
- Type Parameters:
O
- Object type
- All Implemented Interfaces:
Algorithm
public class AveragePrecisionAtK<O> extends java.lang.Object implements Algorithm
Evaluate a distance functions performance by computing the average precision at k, when ranking the objects by distance.- Since:
- 0.5.0
- Author:
- Erich Schubert
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface elki.Algorithm
Algorithm.Utils
-
-
Field Summary
Fields Modifier and Type Field Description private Distance<? super O>
distance
Distance function used.private boolean
includeSelf
Include query object in evaluation.private int
k
The parameter k - the number of neighbors to retrieve.private static Logging
LOG
The logger for this class.private RandomFactory
random
Random sampling seed.private double
sampling
Relative number of object to use in sampling.
-
Constructor Summary
Constructors Constructor Description AveragePrecisionAtK(Distance<? super O> distance, int k, double sampling, RandomFactory random, boolean includeSelf)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TypeInformation[]
getInputTypeRestriction()
Get the input type restriction used for negotiating the data query.protected static boolean
match(java.lang.Object ref, java.lang.Object test)
Test whether two relation agree.CollectionResult<double[]>
run(Relation<O> relation, Relation<?> lrelation)
Run the algorithm
-
-
-
Field Detail
-
LOG
private static final Logging LOG
The logger for this class.
-
k
private int k
The parameter k - the number of neighbors to retrieve.
-
sampling
private double sampling
Relative number of object to use in sampling.
-
random
private RandomFactory random
Random sampling seed.
-
includeSelf
private boolean includeSelf
Include query object in evaluation.
-
-
Constructor Detail
-
AveragePrecisionAtK
public AveragePrecisionAtK(Distance<? super O> distance, int k, double sampling, RandomFactory random, boolean includeSelf)
Constructor.- Parameters:
distance
- Distance functionk
- K parametersampling
- Sampling raterandom
- Random sampling generatorincludeSelf
- Include query object in evaluation
-
-
Method Detail
-
getInputTypeRestriction
public TypeInformation[] getInputTypeRestriction()
Description copied from interface:Algorithm
Get the input type restriction used for negotiating the data query.- Specified by:
getInputTypeRestriction
in interfaceAlgorithm
- Returns:
- Type restriction
-
run
public CollectionResult<double[]> run(Relation<O> relation, Relation<?> lrelation)
Run the algorithm- Parameters:
relation
- Relation for distance computationslrelation
- Relation for class label comparison- Returns:
- Vectors containing mean and standard deviation.
-
match
protected static boolean match(java.lang.Object ref, java.lang.Object test)
Test whether two relation agree.- Parameters:
ref
- Reference objecttest
- Test object- Returns:
true
if the objects match
-
-