Package elki.datasource
Class GeneratorXMLDatabaseConnection
- java.lang.Object
-
- elki.datasource.AbstractDatabaseConnection
-
- elki.datasource.GeneratorXMLDatabaseConnection
-
- All Implemented Interfaces:
DatabaseConnection
public class GeneratorXMLDatabaseConnection extends AbstractDatabaseConnection
Data source from an XML specification.This data source will generate random (or pseudo-random, fixed seeds are supported) data sets that satisfy a given specification file.
- Since:
- 0.2
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GeneratorXMLDatabaseConnection.Par
Parameterization class.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ATTR_ANGLE
Rotation anglestatic java.lang.String
ATTR_AXIS1
First axis for rotation planestatic java.lang.String
ATTR_AXIS2
Second axis for rotation planestatic java.lang.String
ATTR_DENSITY
Density correction factorstatic java.lang.String
ATTR_K
Gamma kstatic java.lang.String
ATTR_MAX
Maximum valuestatic java.lang.String
ATTR_MEAN
Meanstatic java.lang.String
ATTR_MIN
Minimum valuestatic java.lang.String
ATTR_NAME
Cluster nanestatic java.lang.String
ATTR_SEED
Random seedstatic java.lang.String
ATTR_SIZE
Cluster sizestatic java.lang.String
ATTR_STDDEV
Standard deviationstatic java.lang.String
ATTR_TEST
Attribute to control model testingstatic java.lang.String
ATTR_THETA
Gamma thetastatic java.lang.String
ATTR_VECTOR
Vectorprivate RandomFactory
clusterRandom
Random generator used for initializing cluster generators.static java.lang.String
GENERATOR_SCHEMA_FILE
File name of the generators XML Schema file.private static Logging
LOG
Logger(package private) java.util.regex.Pattern
reassign
Pattern for clusters to reassign.private boolean
reassignByDistance
Reassign objects by distance instead of density(package private) double
sizescale
Parameter for scaling the cluster sizes.(package private) java.net.URI
specfile
The configuration file.static java.lang.String
TAG_CLIP
Clippingstatic java.lang.String
TAG_CLUSTER
Cluster tagstatic java.lang.String
TAG_DATASET
Dataset tagstatic java.lang.String
TAG_GAMMA
Gamma distributionstatic java.lang.String
TAG_HALTON
Halton pseudo uniform distribution.static java.lang.String
TAG_NORMAL
Normal distributionstatic java.lang.String
TAG_POINT
Point in static clusterstatic java.lang.String
TAG_ROTATE
Rotationstatic java.lang.String
TAG_STATIC
Static clusterstatic java.lang.String
TAG_TRANSLATE
Translationstatic java.lang.String
TAG_UNIFORM
Uniform distributionprivate java.lang.Boolean
testAgainstModel
Set testAgainstModel flagstatic java.util.regex.Pattern
WHITESPACE_PATTERN
A pattern defining whitespace.-
Fields inherited from class elki.datasource.AbstractDatabaseConnection
filters, LABEL_CONCATENATION
-
-
Constructor Summary
Constructors Constructor Description GeneratorXMLDatabaseConnection(java.util.List<? extends ObjectFilter> filters, java.net.URI specfile, double sizescale, java.util.regex.Pattern reassign, boolean reassignByDistance, RandomFactory clusterRandom)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Logging
getLogger()
Get the logger for this database connection.MultipleObjectsBundle
loadData()
Returns the initial data for a database.private GeneratorMain
loadXMLSpecification()
Load the XML configuration file.private double[]
parseVector(java.lang.String s)
Parse a string into a vector.private void
processElementClipping(GeneratorSingleCluster cluster, org.w3c.dom.Node cur)
Process a 'clipping' Element in the XML stream.private void
processElementCluster(GeneratorMain gen, org.w3c.dom.Node cur)
Process a 'cluster' Element in the XML stream.private void
processElementDataset(GeneratorMain gen, org.w3c.dom.Node cur)
Process a 'dataset' Element in the XML stream.private void
processElementGamma(GeneratorSingleCluster cluster, org.w3c.dom.Node cur)
Process a 'gamma' Element in the XML stream.private void
processElementHalton(GeneratorSingleCluster cluster, org.w3c.dom.Node cur)
Process a 'halton' Element in the XML stream.private void
processElementNormal(GeneratorSingleCluster cluster, org.w3c.dom.Node cur)
Process a 'normal' Element in the XML stream.private void
processElementPoint(java.util.List<double[]> points, org.w3c.dom.Node cur)
Parse a 'point' element (point vector for a static cluster)private void
processElementRotate(GeneratorSingleCluster cluster, org.w3c.dom.Node cur)
Process a 'rotate' Element in the XML stream.private void
processElementStatic(GeneratorMain gen, org.w3c.dom.Node cur)
Process a 'static' cluster Element in the XML stream.private void
processElementTranslate(GeneratorSingleCluster cluster, org.w3c.dom.Node cur)
Process a 'translate' Element in the XML stream.private void
processElementUniform(GeneratorSingleCluster cluster, org.w3c.dom.Node cur)
Process a 'uniform' Element in the XML stream.-
Methods inherited from class elki.datasource.AbstractDatabaseConnection
invokeBundleFilters, invokeStreamFilters
-
-
-
-
Field Detail
-
TAG_DATASET
public static final java.lang.String TAG_DATASET
Dataset tag- See Also:
- Constant Field Values
-
TAG_CLUSTER
public static final java.lang.String TAG_CLUSTER
Cluster tag- See Also:
- Constant Field Values
-
TAG_UNIFORM
public static final java.lang.String TAG_UNIFORM
Uniform distribution- See Also:
- Constant Field Values
-
TAG_NORMAL
public static final java.lang.String TAG_NORMAL
Normal distribution- See Also:
- Constant Field Values
-
TAG_GAMMA
public static final java.lang.String TAG_GAMMA
Gamma distribution- See Also:
- Constant Field Values
-
TAG_HALTON
public static final java.lang.String TAG_HALTON
Halton pseudo uniform distribution.- See Also:
- Constant Field Values
-
TAG_ROTATE
public static final java.lang.String TAG_ROTATE
Rotation- See Also:
- Constant Field Values
-
TAG_TRANSLATE
public static final java.lang.String TAG_TRANSLATE
Translation- See Also:
- Constant Field Values
-
TAG_CLIP
public static final java.lang.String TAG_CLIP
Clipping- See Also:
- Constant Field Values
-
TAG_STATIC
public static final java.lang.String TAG_STATIC
Static cluster- See Also:
- Constant Field Values
-
TAG_POINT
public static final java.lang.String TAG_POINT
Point in static cluster- See Also:
- Constant Field Values
-
ATTR_TEST
public static final java.lang.String ATTR_TEST
Attribute to control model testing- See Also:
- Constant Field Values
-
ATTR_SEED
public static final java.lang.String ATTR_SEED
Random seed- See Also:
- Constant Field Values
-
ATTR_DENSITY
public static final java.lang.String ATTR_DENSITY
Density correction factor- See Also:
- Constant Field Values
-
ATTR_NAME
public static final java.lang.String ATTR_NAME
Cluster nane- See Also:
- Constant Field Values
-
ATTR_SIZE
public static final java.lang.String ATTR_SIZE
Cluster size- See Also:
- Constant Field Values
-
ATTR_MIN
public static final java.lang.String ATTR_MIN
Minimum value- See Also:
- Constant Field Values
-
ATTR_MAX
public static final java.lang.String ATTR_MAX
Maximum value- See Also:
- Constant Field Values
-
ATTR_MEAN
public static final java.lang.String ATTR_MEAN
Mean- See Also:
- Constant Field Values
-
ATTR_STDDEV
public static final java.lang.String ATTR_STDDEV
Standard deviation- See Also:
- Constant Field Values
-
ATTR_K
public static final java.lang.String ATTR_K
Gamma k- See Also:
- Constant Field Values
-
ATTR_THETA
public static final java.lang.String ATTR_THETA
Gamma theta- See Also:
- Constant Field Values
-
ATTR_VECTOR
public static final java.lang.String ATTR_VECTOR
Vector- See Also:
- Constant Field Values
-
ATTR_AXIS1
public static final java.lang.String ATTR_AXIS1
First axis for rotation plane- See Also:
- Constant Field Values
-
ATTR_AXIS2
public static final java.lang.String ATTR_AXIS2
Second axis for rotation plane- See Also:
- Constant Field Values
-
ATTR_ANGLE
public static final java.lang.String ATTR_ANGLE
Rotation angle- See Also:
- Constant Field Values
-
LOG
private static final Logging LOG
Logger
-
WHITESPACE_PATTERN
public static final java.util.regex.Pattern WHITESPACE_PATTERN
A pattern defining whitespace.
-
GENERATOR_SCHEMA_FILE
public static final java.lang.String GENERATOR_SCHEMA_FILE
File name of the generators XML Schema file.
-
specfile
java.net.URI specfile
The configuration file.
-
sizescale
double sizescale
Parameter for scaling the cluster sizes.
-
reassign
java.util.regex.Pattern reassign
Pattern for clusters to reassign.
-
clusterRandom
private RandomFactory clusterRandom
Random generator used for initializing cluster generators.
-
testAgainstModel
private java.lang.Boolean testAgainstModel
Set testAgainstModel flag
-
reassignByDistance
private boolean reassignByDistance
Reassign objects by distance instead of density
-
-
Constructor Detail
-
GeneratorXMLDatabaseConnection
public GeneratorXMLDatabaseConnection(java.util.List<? extends ObjectFilter> filters, java.net.URI specfile, double sizescale, java.util.regex.Pattern reassign, boolean reassignByDistance, RandomFactory clusterRandom)
Constructor.- Parameters:
filters
- Filters.specfile
- Specification filesizescale
- Size scalingreassign
- Reassignment patternreassignByDistance
- Reassign objects by distance instead of densityclusterRandom
- Random number generator
-
-
Method Detail
-
loadData
public MultipleObjectsBundle loadData()
Description copied from interface:DatabaseConnection
Returns the initial data for a database.- Returns:
- a database object bundle
-
loadXMLSpecification
private GeneratorMain loadXMLSpecification()
Load the XML configuration file.- Returns:
- Generator
-
processElementDataset
private void processElementDataset(GeneratorMain gen, org.w3c.dom.Node cur)
Process a 'dataset' Element in the XML stream.- Parameters:
gen
- Generatorcur
- Current document nod
-
processElementCluster
private void processElementCluster(GeneratorMain gen, org.w3c.dom.Node cur)
Process a 'cluster' Element in the XML stream.- Parameters:
gen
- Generatorcur
- Current document nod
-
processElementUniform
private void processElementUniform(GeneratorSingleCluster cluster, org.w3c.dom.Node cur)
Process a 'uniform' Element in the XML stream.- Parameters:
cluster
-cur
- Current document nod
-
processElementNormal
private void processElementNormal(GeneratorSingleCluster cluster, org.w3c.dom.Node cur)
Process a 'normal' Element in the XML stream.- Parameters:
cluster
-cur
- Current document nod
-
processElementGamma
private void processElementGamma(GeneratorSingleCluster cluster, org.w3c.dom.Node cur)
Process a 'gamma' Element in the XML stream.- Parameters:
cluster
-cur
- Current document nod
-
processElementHalton
private void processElementHalton(GeneratorSingleCluster cluster, org.w3c.dom.Node cur)
Process a 'halton' Element in the XML stream.- Parameters:
cluster
-cur
- Current document nod
-
processElementRotate
private void processElementRotate(GeneratorSingleCluster cluster, org.w3c.dom.Node cur)
Process a 'rotate' Element in the XML stream.- Parameters:
cluster
-cur
- Current document nod
-
processElementTranslate
private void processElementTranslate(GeneratorSingleCluster cluster, org.w3c.dom.Node cur)
Process a 'translate' Element in the XML stream.- Parameters:
cluster
-cur
- Current document nod
-
processElementClipping
private void processElementClipping(GeneratorSingleCluster cluster, org.w3c.dom.Node cur)
Process a 'clipping' Element in the XML stream.- Parameters:
cluster
-cur
- Current document nod
-
processElementStatic
private void processElementStatic(GeneratorMain gen, org.w3c.dom.Node cur)
Process a 'static' cluster Element in the XML stream.- Parameters:
gen
- Generatorcur
- Current document nod
-
processElementPoint
private void processElementPoint(java.util.List<double[]> points, org.w3c.dom.Node cur)
Parse a 'point' element (point vector for a static cluster)- Parameters:
points
- current list of points (to append to)cur
- Current document nod
-
parseVector
private double[] parseVector(java.lang.String s)
Parse a string into a vector.TODO: Rewrite this using the new Tokenizer
- Parameters:
s
- String to parse- Returns:
- Vector
-
getLogger
protected Logging getLogger()
Description copied from class:AbstractDatabaseConnection
Get the logger for this database connection.- Specified by:
getLogger
in classAbstractDatabaseConnection
- Returns:
- Logger
-
-