V
- Vector typeD
- Distance typepublic class AveragePrecisionAtK<V,D extends NumberDistance<D,?>> extends AbstractDistanceBasedAlgorithm<V,D,CollectionResult<DoubleVector>>
Modifier and Type | Class and Description |
---|---|
static class |
AveragePrecisionAtK.Parameterizer<V extends NumberVector<?>,D extends NumberDistance<D,?>>
Parameterization class.
|
Modifier and Type | Field and Description |
---|---|
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 double |
sampling
Relative number of object to use in sampling.
|
private Long |
seed
Random sampling seed.
|
DISTANCE_FUNCTION_ID
Constructor and Description |
---|
AveragePrecisionAtK(DistanceFunction<? super V,D> distanceFunction,
int k,
double sampling,
Long seed,
boolean includeSelf)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
TypeInformation[] |
getInputTypeRestriction()
Get the input type restriction used for negotiating the data query.
|
protected Logging |
getLogger()
Get the (STATIC) logger for this class.
|
CollectionResult<DoubleVector> |
run(Database database,
Relation<V> relation,
Relation<ClassLabel> lrelation)
Run the algorithm
|
getDistanceFunction
makeParameterDistanceFunction, run
private static final Logging LOG
private int k
private double sampling
private Long seed
private boolean includeSelf
public AveragePrecisionAtK(DistanceFunction<? super V,D> distanceFunction, int k, double sampling, Long seed, boolean includeSelf)
distanceFunction
- Distance functionk
- K parametersampling
- Sampling rateseed
- Random sampling seed (may be null)includeSelf
- Include query object in evaluationpublic CollectionResult<DoubleVector> run(Database database, Relation<V> relation, Relation<ClassLabel> lrelation)
database
- Database to run on (for kNN queries)relation
- Relation for distance computationslrelation
- Relation for class label comparisonpublic TypeInformation[] getInputTypeRestriction()
AbstractAlgorithm
getInputTypeRestriction
in interface Algorithm
getInputTypeRestriction
in class AbstractAlgorithm<CollectionResult<DoubleVector>>
protected Logging getLogger()
AbstractAlgorithm
getLogger
in class AbstractAlgorithm<CollectionResult<DoubleVector>>