Package elki.algorithm.statistics
Class EvaluateRetrievalPerformance<O>
- java.lang.Object
-
- elki.algorithm.statistics.EvaluateRetrievalPerformance<O>
-
- Type Parameters:
O
- Object type
- All Implemented Interfaces:
Algorithm
public class EvaluateRetrievalPerformance<O> extends java.lang.Object implements Algorithm
Evaluate a distance functions performance by computing the mean average precision, ROC, and NN classification performance when ranking the objects by distance.- Since:
- 0.7.0
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EvaluateRetrievalPerformance.KNNEvaluator
Evaluate kNN retrieval performance.static class
EvaluateRetrievalPerformance.RetrievalPerformanceResult
Result object for MAP scores.-
Nested classes/interfaces inherited from interface elki.Algorithm
Algorithm.Utils
-
-
Field Summary
Fields Modifier and Type Field Description protected Distance<? super O>
distance
Distance function used.protected boolean
includeSelf
Include query object in evaluation.private static Logging
LOG
The logger for this class.protected int
maxk
K nearest neighbors to use for classification evaluation.private java.lang.String
PREFIX
Prefix for statistics.protected RandomFactory
random
Random sampling seed.protected double
sampling
Relative number of object to use in sampling.
-
Constructor Summary
Constructors Constructor Description EvaluateRetrievalPerformance(Distance<? super O> distance, double sampling, RandomFactory random, boolean includeSelf, int maxk)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
computeDistances(ModifiableDoubleDBIDList nlist, DBIDIter query, DistanceQuery<O> distQuery, Relation<O> relation)
Compute the distances to the neighbor objects.private void
findMatches(ModifiableDBIDs posn, Relation<?> lrelation, java.lang.Object label)
Find all matching objects.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.EvaluateRetrievalPerformance.RetrievalPerformanceResult
run(Relation<O> relation, Relation<?> lrelation)
Run the algorithm
-
-
-
Field Detail
-
LOG
private static final Logging LOG
The logger for this class.
-
PREFIX
private final java.lang.String PREFIX
Prefix for statistics.
-
sampling
protected double sampling
Relative number of object to use in sampling.
-
random
protected RandomFactory random
Random sampling seed.
-
includeSelf
protected boolean includeSelf
Include query object in evaluation.
-
maxk
protected int maxk
K nearest neighbors to use for classification evaluation.
-
-
Constructor Detail
-
EvaluateRetrievalPerformance
public EvaluateRetrievalPerformance(Distance<? super O> distance, double sampling, RandomFactory random, boolean includeSelf, int maxk)
Constructor.- Parameters:
distance
- Distance functionsampling
- Sampling raterandom
- Random sampling generatorincludeSelf
- Include query object in evaluationmaxk
- Maximum k for kNN 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 EvaluateRetrievalPerformance.RetrievalPerformanceResult 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
-
findMatches
private void findMatches(ModifiableDBIDs posn, Relation<?> lrelation, java.lang.Object label)
Find all matching objects.- Parameters:
posn
- Output set.lrelation
- Label relationlabel
- Query object label
-
computeDistances
private void computeDistances(ModifiableDoubleDBIDList nlist, DBIDIter query, DistanceQuery<O> distQuery, Relation<O> relation)
Compute the distances to the neighbor objects.- Parameters:
nlist
- Neighbor list (output)query
- Query objectdistQuery
- Distance functionrelation
- Data relation
-
-