be.hogent.tarsos.lsh.util
Class TestUtils

java.lang.Object
  extended by be.hogent.tarsos.lsh.util.TestUtils

public class TestUtils
extends java.lang.Object

Makes it easy to generate random test data sets.

Author:
Joren Six

Constructor Summary
TestUtils()
           
 
Method Summary
static void addNeighbours(java.util.List<Vector> dataset, int numberOfNeighboursToAdd, double radius)
          Adds neighbours to each element in a data set.
static java.util.List<Vector> generate(int dimensions, int datasetSize, int maxValue)
          Generate a data set.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestUtils

public TestUtils()
Method Detail

generate

public static java.util.List<Vector> generate(int dimensions,
                                              int datasetSize,
                                              int maxValue)
Generate a data set.

Parameters:
dimensions - The number of dimensions of the vector.
datasetSize - The size of the data set.
maxValue - The maximum value of the coordinates of the vectors (a number between 0 and maxValue is chosen randomly).
Returns:
A data set with the properties described above.

addNeighbours

public static void addNeighbours(java.util.List<Vector> dataset,
                                 int numberOfNeighboursToAdd,
                                 double radius)
Adds neighbours to each element in a data set. Each element gets a number of neighbours added. E.g. If a data set has 10 elements and 2 neighbours are added, you end up with 10 + 2 x 10 = 30 elements. Each element is copied and moved slightly according to radius.

Parameters:
dataset - The data set.
numberOfNeighboursToAdd - The number of neighbours to add. E.g. If a data set has 10 elements and 2 neighbours are added, you end up with 10 + 2 x 10 = 30 elements.
radius - The radius used to create neigbours. In each dimension a random number between -radius and +radius is added to the current value.