Class MexicanHat
- java.lang.Object
-
- weka.datagenerators.DataGenerator
-
- weka.datagenerators.RegressionGenerator
-
- weka.datagenerators.classifiers.regression.MexicanHat
-
- All Implemented Interfaces:
Serializable,OptionHandler,Randomizable,RevisionHandler
- Direct Known Subclasses:
Expression
public class MexicanHat extends 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).
- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MexicanHat()initializes the generator
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringamplitudeTipText()Returns the tip text for this propertyInstancesdefineDataFormat()Initializes the format for the dataset produced.InstancegenerateExample()Generates one example of the dataset.InstancesgenerateExamples()Generates all examples of the dataset.StringgenerateFinished()Generates a comment string that documentats the data generator.StringgenerateStart()Generates a comment string that documentates the data generator.doublegetAmplitude()Gets the amplitude multiplier.doublegetMaxRange()Gets the upper boundary for the range of xdoublegetMinRange()Gets the lower boundary for the range of xdoublegetNoiseRate()Gets the gaussian noise rate.doublegetNoiseVariance()Gets the noise varianceString[]getOptions()Gets the current settings of the datagenerator BIRCHCluster.StringgetRevision()Returns the revision string.booleangetSingleModeFlag()Return if single mode is set for the given data generator mode depends on option setting and or generator type.StringglobalInfo()Returns a string describing this data generator.Enumeration<Option>listOptions()Returns an enumeration describing the available options.static voidmain(String[] args)Main method for testing this class.StringmaxRangeTipText()Returns the tip text for this propertyStringminRangeTipText()Returns the tip text for this propertyStringnoiseRateTipText()Returns the tip text for this propertyStringnoiseVarianceTipText()Returns the tip text for this propertyvoidsetAmplitude(double value)Sets the amplitude multiplier.voidsetMaxRange(double value)Sets the upper boundary for the range of xvoidsetMinRange(double value)Sets the lower boundary for the range of xvoidsetNoiseRate(double value)Sets the gaussian noise rate.voidsetNoiseVariance(double value)Sets the noise variancevoidsetOptions(String[] options)Parses a list of options for this object.-
Methods inherited from class weka.datagenerators.RegressionGenerator
getNumExamples, numExamplesTipText, setNumExamples
-
Methods inherited from class weka.datagenerators.DataGenerator
debugTipText, defaultOutput, enumToVector, formatTipText, getDatasetFormat, getDebug, getEpilogue, getNumExamplesAct, getOutput, getPrologue, getRandom, getRelationName, getSeed, makeData, outputTipText, randomTipText, relationNameTipText, runDataGenerator, seedTipText, setDatasetFormat, setDebug, setOutput, setRandom, setRelationName, setSeed
-
-
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing this data generator.- Returns:
- a description of the data generator suitable for displaying in the explorer/experimenter gui
-
listOptions
public Enumeration<Option> listOptions()
Returns an enumeration describing the available options.- Specified by:
listOptionsin interfaceOptionHandler- Overrides:
listOptionsin classRegressionGenerator- Returns:
- an enumeration of all the available options
-
setOptions
public void setOptions(String[] options) throws Exception
Parses a list of options for this object. 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).
- Specified by:
setOptionsin interfaceOptionHandler- Overrides:
setOptionsin classRegressionGenerator- Parameters:
options- the list of options as an array of strings- Throws:
Exception- if an option is not supported
-
getOptions
public String[] getOptions()
Gets the current settings of the datagenerator BIRCHCluster.- Specified by:
getOptionsin interfaceOptionHandler- Overrides:
getOptionsin classRegressionGenerator- Returns:
- an array of strings suitable for passing to setOptions
- See Also:
DataGenerator.removeBlacklist(String[])
-
getAmplitude
public double getAmplitude()
Gets the amplitude multiplier.- Returns:
- the amplitude multiplier
-
setAmplitude
public void setAmplitude(double value)
Sets the amplitude multiplier.- Parameters:
value- the amplitude multiplier
-
amplitudeTipText
public String amplitudeTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setMinRange
public void setMinRange(double value)
Sets the lower boundary for the range of x- Parameters:
value- the lower boundary
-
getMinRange
public double getMinRange()
Gets the lower boundary for the range of x- Returns:
- the lower boundary for the range of x
-
minRangeTipText
public String minRangeTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setMaxRange
public void setMaxRange(double value)
Sets the upper boundary for the range of x- Parameters:
value- the upper boundary
-
getMaxRange
public double getMaxRange()
Gets the upper boundary for the range of x- Returns:
- the upper boundary for the range of x
-
maxRangeTipText
public String maxRangeTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getNoiseRate
public double getNoiseRate()
Gets the gaussian noise rate.- Returns:
- the gaussian noise rate
-
setNoiseRate
public void setNoiseRate(double value)
Sets the gaussian noise rate.- Parameters:
value- the gaussian noise rate
-
noiseRateTipText
public String noiseRateTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getNoiseVariance
public double getNoiseVariance()
Gets the noise variance- Returns:
- the noise variance
-
setNoiseVariance
public void setNoiseVariance(double value)
Sets the noise variance- Parameters:
value- the noise variance
-
noiseVarianceTipText
public String noiseVarianceTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getSingleModeFlag
public boolean getSingleModeFlag() throws ExceptionReturn if single mode is set for the given data generator mode depends on option setting and or generator type.- Specified by:
getSingleModeFlagin classDataGenerator- Returns:
- single mode flag
- Throws:
Exception- if mode is not set yet
-
defineDataFormat
public Instances defineDataFormat() throws Exception
Initializes the format for the dataset produced. Must be called before the generateExample or generateExamples methods are used. Re-initializes the random number generator with the given seed.- Overrides:
defineDataFormatin classDataGenerator- Returns:
- the format for the dataset
- Throws:
Exception- if the generating of the format failed- See Also:
DataGenerator.getSeed()
-
generateExample
public Instance generateExample() throws Exception
Generates one example of the dataset.- Specified by:
generateExamplein classDataGenerator- Returns:
- the generated example
- Throws:
Exception- if the format of the dataset is not yet definedException- if the generator only works with generateExamples which means in non single mode
-
generateExamples
public Instances generateExamples() throws Exception
Generates all examples of the dataset. Re-initializes the random number generator with the given seed, before generating instances.- Specified by:
generateExamplesin classDataGenerator- Returns:
- the generated dataset
- Throws:
Exception- if the format of the dataset is not yet definedException- if the generator only works with generateExample, which means in single mode- See Also:
DataGenerator.getSeed()
-
generateStart
public String generateStart()
Generates a comment string that documentates the data generator. By default this string is added at the beginning of the produced output as ARFF file type, next after the options.- Specified by:
generateStartin classDataGenerator- Returns:
- string contains info about the generated rules
-
generateFinished
public String generateFinished() throws Exception
Generates a comment string that documentats the data generator. By default this string is added at the end of theproduces output as ARFF file type.- Specified by:
generateFinishedin classDataGenerator- Returns:
- string contains info about the generated rules
- Throws:
Exception- if the generating of the documentaion fails
-
getRevision
public String getRevision()
Returns the revision string.- Returns:
- the revision
-
main
public static void main(String[] args)
Main method for testing this class.- Parameters:
args- should contain arguments for the data producer:
-
-