/*
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see .
 */

/*
 * RandomRBF.java
 * Copyright (C) 2005-2012 University of Waikato, Hamilton, New Zealand
 *
 */

package weka.datagenerators.classifiers.classification;

import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Random;
import java.util.Vector;

import weka.core.Attribute;
import weka.core.DenseInstance;
import weka.core.Instance;
import weka.core.Instances;
import weka.core.Option;
import weka.core.RevisionUtils;
import weka.core.Utils;
import weka.datagenerators.ClassificationGenerator;

/**
 *  RandomRBF data is generated by first creating a
 * random set of centers for each class. Each center is randomly assigned a
 * weight, a central point per attribute, and a standard deviation. To generate
 * new instances, a center is chosen at random taking the weights of each center
 * into consideration. Attribute values are randomly generated and offset from
 * the center, where the overall vector has been scaled so that its length
 * equals a value sampled randomly from the Gaussian distribution of the center.
 * The particular center chosen determines the class of the instance.
* RandomRBF data contains only numeric attributes as it is non-trivial to * include nominal values. *

* * * Valid options are: *

* *

 * -h
 *  Prints this help.
 * 
* *
 * -o <file>
 *  The name of the output file, otherwise the generated data is
 *  printed to stdout.
 * 
* *
 * -r <name>
 *  The name of the relation.
 * 
* *
 * -d
 *  Whether to print debug informations.
 * 
* *
 * -S
 *  The seed for random function (default 1)
 * 
* *
 * -n <num>
 *  The number of examples to generate (default 100)
 * 
* *
 * -a <num>
 *  The number of attributes (default 10).
 * 
* *
 * -c <num>
 *  The number of classes (default 2)
 * 
* *
 * -C <num>
 *  The number of centroids to use. (default 50)
 * 
* * * * @author Richard Kirkby (rkirkby at cs dot waikato dot ac dot nz) * @author FracPete (fracpete at waikato dot ac dot nz) * @version $Revision: 10203 $ */ public class RandomRBF extends ClassificationGenerator { /** for serialization */ static final long serialVersionUID = 6069033710635728720L; /** Number of attribute the dataset should have */ protected int m_NumAttributes; /** Number of Classes the dataset should have */ protected int m_NumClasses; /** the number of centroids to use for generation */ protected int m_NumCentroids; /** the centroids */ protected double[][] m_centroids; /** the classes of the centroids */ protected int[] m_centroidClasses; /** the weights of the centroids */ protected double[] m_centroidWeights; /** the stddevs of the centroids */ protected double[] m_centroidStdDevs; /** * initializes the generator with default values */ public RandomRBF() { super(); setNumAttributes(defaultNumAttributes()); setNumClasses(defaultNumClasses()); setNumCentroids(defaultNumCentroids()); } /** * Returns a string describing this data generator. * * @return a description of the data generator suitable for displaying in the * explorer/experimenter gui */ public String globalInfo() { return "RandomRBF data is generated by first creating a random set of " + "centers for each class. Each center is randomly assigned a weight, " + "a central point per attribute, and a standard deviation. To " + "generate new instances, a center is chosen at random taking the " + "weights of each center into consideration. Attribute values are " + "randomly generated and offset from the center, where the overall " + "vector has been scaled so that its length equals a value sampled " + "randomly from the Gaussian distribution of the center. The " + "particular center chosen determines the class of the instance.\n " + "RandomRBF data contains only numeric attributes as it is " + "non-trivial to include nominal values."; } /** * Returns an enumeration describing the available options. * * @return an enumeration of all the available options */ @Override public Enumeration

Ads help maintain this website.