/*
 *   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 .
 */

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

package weka.datagenerators.classifiers.regression;

import java.util.ArrayList;
import java.util.Collections;
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.RegressionGenerator;

/**
 *  A data generator for the simple 'Mexian Hat'
 * function:
* y = sin|x| / |x|
* In addition to this simple function, the amplitude can be changed and * gaussian noise can be added. *

* * * 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 amplitude multiplier (default 1.0).
 * 
* *
 * -R <num>..<num>
 *  The range x is randomly drawn from (default -10.0..10.0).
 * 
* *
 * -N <num>
 *  The noise rate (default 0.0).
 * 
* *
 * -V <num>
 *  The noise variance (default 1.0).
 * 
* * * * @author FracPete (fracpete at waikato dot ac dot nz) * @version $Revision: 10203 $ */ public class MexicanHat extends RegressionGenerator { /** for serialization */ static final long serialVersionUID = 4577016375261512975L; /** the amplitude of y */ protected double m_Amplitude; /** the lower boundary of the range, x is drawn from */ protected double m_MinRange; /** the upper boundary of the range, x is drawn from */ protected double m_MaxRange; /** the rate of the gaussian noise */ protected double m_NoiseRate; /** the variance of the gaussian noise */ protected double m_NoiseVariance; /** the random number generator for the noise */ protected Random m_NoiseRandom = null; /** * initializes the generator */ public MexicanHat() { super(); setAmplitude(defaultAmplitude()); setMinRange(defaultMinRange()); setMaxRange(defaultMaxRange()); setNoiseRate(defaultNoiseRate()); setNoiseVariance(defaultNoiseVariance()); } /** * 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 "A data generator for the simple 'Mexian Hat' function:\n" + " y = sin|x| / |x|\n" + "In addition to this simple function, the amplitude can be changed and " + "gaussian noise can be added."; } /** * Returns an enumeration describing the available options. * * @return an enumeration of all the available options */ @Override public Enumeration

Ads help maintain this website.