Search in sources :

Example 1 with HaltonUniformDistribution

use of de.lmu.ifi.dbs.elki.math.statistics.distribution.HaltonUniformDistribution in project elki by elki-project.

the class GeneratorXMLDatabaseConnection method processElementHalton.

/**
 * Process a 'halton' Element in the XML stream.
 *
 * @param cluster
 * @param cur Current document nod
 */
private void processElementHalton(GeneratorSingleCluster cluster, Node cur) {
    double min = 0.0;
    double max = 1.0;
    String minstr = ((Element) cur).getAttribute(ATTR_MIN);
    if (minstr != null && minstr.length() > 0) {
        min = ParseUtil.parseDouble(minstr);
    }
    String maxstr = ((Element) cur).getAttribute(ATTR_MAX);
    if (maxstr != null && maxstr.length() > 0) {
        max = ParseUtil.parseDouble(maxstr);
    }
    // *** new uniform generator
    Random random = cluster.getNewRandomGenerator();
    Distribution generator = new HaltonUniformDistribution(min, max, random);
    cluster.addGenerator(generator);
    // TODO: check for unknown attributes.
    XMLNodeIterator iter = new XMLNodeIterator(cur.getFirstChild());
    while (iter.hasNext()) {
        Node child = iter.next();
        if (child.getNodeType() == Node.ELEMENT_NODE) {
            LOG.warning("Unknown element in XML specification file: " + child.getNodeName());
        }
    }
}
Also used : Random(java.util.Random) HaltonUniformDistribution(de.lmu.ifi.dbs.elki.math.statistics.distribution.HaltonUniformDistribution) Element(org.w3c.dom.Element) Distribution(de.lmu.ifi.dbs.elki.math.statistics.distribution.Distribution) NormalDistribution(de.lmu.ifi.dbs.elki.math.statistics.distribution.NormalDistribution) UniformDistribution(de.lmu.ifi.dbs.elki.math.statistics.distribution.UniformDistribution) GammaDistribution(de.lmu.ifi.dbs.elki.math.statistics.distribution.GammaDistribution) HaltonUniformDistribution(de.lmu.ifi.dbs.elki.math.statistics.distribution.HaltonUniformDistribution) Node(org.w3c.dom.Node) XMLNodeIterator(de.lmu.ifi.dbs.elki.utilities.xml.XMLNodeIterator)

Aggregations

Distribution (de.lmu.ifi.dbs.elki.math.statistics.distribution.Distribution)1 GammaDistribution (de.lmu.ifi.dbs.elki.math.statistics.distribution.GammaDistribution)1 HaltonUniformDistribution (de.lmu.ifi.dbs.elki.math.statistics.distribution.HaltonUniformDistribution)1 NormalDistribution (de.lmu.ifi.dbs.elki.math.statistics.distribution.NormalDistribution)1 UniformDistribution (de.lmu.ifi.dbs.elki.math.statistics.distribution.UniformDistribution)1 XMLNodeIterator (de.lmu.ifi.dbs.elki.utilities.xml.XMLNodeIterator)1 Random (java.util.Random)1 Element (org.w3c.dom.Element)1 Node (org.w3c.dom.Node)1