Package elki.application.benchmark
Class RangeQueryBenchmark<O extends NumberVector>
- java.lang.Object
-
- elki.application.AbstractApplication
-
- elki.application.AbstractDistanceBasedApplication<O>
-
- elki.application.benchmark.RangeQueryBenchmark<O>
-
- Type Parameters:
O
- Vector type
public class RangeQueryBenchmark<O extends NumberVector> extends AbstractDistanceBasedApplication<O>
Benchmarking algorithm that computes a range query for each point. The query points can either come from a separate data source, or from the original database. In the latter case, the database is expected to have an additional, 1-dimensional vector field. For the separate data source, the last dimension will be cut off and used as query radius.The simplest data setup clearly is to have an input file:
x y z label 1 2 3 Example1 4 5 6 Example2 7 8 9 Example3
and a query file:x y z radius 1 2 3 1.2 4 5 6 3.3 7 8 9 4.1
where the additional column is the radius.Alternatively, if you work with a single file, you need to use the filter command -dbc.filter SplitNumberVectorFilter -split.dims 1,2,3 to split the relation into a 3-dimensional data vector, and 1 dimensional radius vector.
TODO: alternatively, allow using a fixed radius?
TODO: use an InputStream instead of a DatabaseConnection for the query set?
- Since:
- 0.5.5
- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description private static Logging
LOG
The logger for this class.protected DatabaseConnection
queries
The alternate query point source.protected double
radius
Query radius.protected RandomFactory
random
Random generator factoryprotected double
sampling
Sampling size.-
Fields inherited from class elki.application.AbstractDistanceBasedApplication
distance, inputstep
-
Fields inherited from class elki.application.AbstractApplication
REFERENCE, VERSION
-
-
Constructor Summary
Constructors Constructor Description RangeQueryBenchmark(InputStep input, Distance<? super O> distance, double radius, double sampling, RandomFactory random)
Constructor.RangeQueryBenchmark(InputStep input, Distance<? super O> distance, DatabaseConnection queries, double sampling, RandomFactory random)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
logIndexStatistics(Database database)
Log index statistics before and after querying.static void
main(java.lang.String[] args)
Runs the benchmarkprotected int
processResult(DoubleDBIDList rres, MeanVariance mv)
Method to test a result.void
run()
Runs the application.protected int
run(RangeSearcher<DBIDRef> rangeQuery, Relation<O> relation, double radius, Duration dur, MeanVariance mv)
Run the algorithm, with constant radiusprotected int
run(RangeSearcher<DBIDRef> rangeQuery, Relation<O> relation, Relation<NumberVector> radrel, Duration dur, MeanVariance mv)
Run the algorithm, with separate radius relationprotected int
run(RangeSearcher<O> rangeQuery, Relation<O> relation, DatabaseConnection queries, Duration dur, MeanVariance mv)
Run the algorithm, with a separate query set.-
Methods inherited from class elki.application.AbstractApplication
printErrorMessage, runCLIApplication, usage
-
-
-
-
Field Detail
-
LOG
private static final Logging LOG
The logger for this class.
-
radius
protected double radius
Query radius.
-
queries
protected DatabaseConnection queries
The alternate query point source. Optional.
-
sampling
protected double sampling
Sampling size.
-
random
protected RandomFactory random
Random generator factory
-
-
Constructor Detail
-
RangeQueryBenchmark
public RangeQueryBenchmark(InputStep input, Distance<? super O> distance, double radius, double sampling, RandomFactory random)
Constructor.- Parameters:
input
- Data inputdistance
- Distance function to useradius
- Query radius to usesampling
- Sampling raterandom
- Random factory
-
RangeQueryBenchmark
public RangeQueryBenchmark(InputStep input, Distance<? super O> distance, DatabaseConnection queries, double sampling, RandomFactory random)
Constructor.- Parameters:
input
- Data inputdistance
- Distance function to usequeries
- Query data set (may be null!)sampling
- Sampling raterandom
- Random factory
-
-
Method Detail
-
run
public void run()
Description copied from class:AbstractApplication
Runs the application.- Specified by:
run
in classAbstractApplication
-
logIndexStatistics
private void logIndexStatistics(Database database)
Log index statistics before and after querying.- Parameters:
database
- Database
-
run
protected int run(RangeSearcher<DBIDRef> rangeQuery, Relation<O> relation, double radius, Duration dur, MeanVariance mv)
Run the algorithm, with constant radius- Parameters:
rangeQuery
- query to testrelation
- Relationradius
- Radiusmv
- Mean and variance statistics- Returns:
- hash code over all results
-
run
protected int run(RangeSearcher<DBIDRef> rangeQuery, Relation<O> relation, Relation<NumberVector> radrel, Duration dur, MeanVariance mv)
Run the algorithm, with separate radius relation- Parameters:
rangeQuery
- query to testrelation
- Relationradrel
- Radius relationmv
- Mean and variance statistics- Returns:
- hash code over all results
-
run
protected int run(RangeSearcher<O> rangeQuery, Relation<O> relation, DatabaseConnection queries, Duration dur, MeanVariance mv)
Run the algorithm, with a separate query set.- Parameters:
rangeQuery
- query to testrelation
- Relationqueries
- Queries database connectionmv
- Statistics output- Returns:
- result hashcode
-
processResult
protected int processResult(DoubleDBIDList rres, MeanVariance mv)
Method to test a result.- Parameters:
rres
- Result to processmv
- Statistics output- Returns:
- hash code
-
main
public static void main(java.lang.String[] args)
Runs the benchmark- Parameters:
args
- parameter list according to description
-
-