public class RandomIndexVectorGenerator extends Object implements IntegerVectorGenerator<TernaryVector>, Serializable
RandomTernaryVector
instances based on
configurable properties. This class supports two properties:
"edu.ucla.sspace.index.RandomIndexVectorGenerator.values"
"edu.ucla.sspace.index.RandomIndexVectorGenerator.variance"
=4
and setting this property to 2
would mean that 4 ± 2
value would be randomly set in
each index vector.
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_INDEX_VECTOR_LENGTH
The default number of dimensions to create in each
TernaryVector . |
static int |
DEFAULT_INDEX_VECTOR_VALUES
The default number of values to set in an
TernaryVector . |
static int |
DEFAULT_INDEX_VECTOR_VARIANCE
The default random variance in the number of values that are set in an
TernaryVector . |
static String |
INDEX_VECTOR_VARIANCE_PROPERTY
The property to specify the variance in the number of values to set in an
TernaryVector . |
static Random |
RANDOM
A random number generator that can be accessed to other classes which
will rely on the same source of random values.
|
static String |
VALUES_TO_SET_PROPERTY
The property to specify the number of values to set in an
TernaryVector . |
Constructor and Description |
---|
RandomIndexVectorGenerator(int indexVectorLength)
Constructs this instance using the system properties.
|
RandomIndexVectorGenerator(int indexVectorLength,
Properties properties)
Constructs this instance using the provided properties.
|
public static final Random RANDOM
public static final String VALUES_TO_SET_PROPERTY
TernaryVector
.public static final String INDEX_VECTOR_VARIANCE_PROPERTY
TernaryVector
.public static final int DEFAULT_INDEX_VECTOR_VALUES
TernaryVector
.public static final int DEFAULT_INDEX_VECTOR_LENGTH
TernaryVector
.public static final int DEFAULT_INDEX_VECTOR_VARIANCE
TernaryVector
.public RandomIndexVectorGenerator(int indexVectorLength)
public RandomIndexVectorGenerator(int indexVectorLength, Properties properties)
public TernaryVector generate()
TernaryVector
with the provided length.generate
in interface IntegerVectorGenerator<TernaryVector>
generate
in interface Generator<TernaryVector>
length
- the length of the index vectorCopyright © 2012. All Rights Reserved.