Class BayesNet
java.lang.Object
weka.datagenerators.DataGenerator
weka.datagenerators.ClassificationGenerator
weka.datagenerators.classifiers.classification.BayesNet
- All Implemented Interfaces:
Serializable,OptionHandler,Randomizable,RevisionHandler
Generates random instances based on a Bayes network.
Valid options are:
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 arcs to use. (default 20)
-N <num> The number of attributes to generate. (default 10)
-C <num> The cardinality of the attributes and the class. (default 2)
- Version:
- $Revision: 11753 $
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the tip text for this propertyInitializes the format for the dataset produced.Generates one example of the dataset.Generates all examples of the dataset.Generates a comment string that documentats the data generator.Generates a comment string that documentates the data generator.intGets the cardinality of the attributes (incl class attribute)intGets the number of arcs for the bayesian netintGets the number of attributes that should be produced.intGets the number of examples, given by option.String[]Gets the current settings of the datagenerator.Returns the revision string.intgetSeed()Gets the random number seed.booleanReturn if single mode is set for the given data generator mode depends on option setting and or generator type.Returns a string describing this data generator.Returns an enumeration describing the available options.static voidMain method for executing this class.Returns the tip text for this propertyReturns the tip text for this propertyvoidsetCardinality(int value) Sets the cardinality of the attributes (incl class attribute)voidsetNumArcs(int value) Sets the number of arcs for the bayesian netvoidsetNumAttributes(int numAttributes) Sets the number of attributes the dataset should have.voidsetNumExamples(int numExamples) Sets the number of examples, given by option.voidsetOptions(String[] options) Parses a list of options for this object.voidsetSeed(int newSeed) Sets the random number seed.Methods inherited from class weka.datagenerators.ClassificationGenerator
numExamplesTipTextMethods inherited from class weka.datagenerators.DataGenerator
debugTipText, defaultOutput, enumToVector, formatTipText, getDatasetFormat, getDebug, getEpilogue, getNumExamplesAct, getOutput, getPrologue, getRandom, getRelationName, makeData, outputTipText, randomTipText, relationNameTipText, runDataGenerator, seedTipText, setDatasetFormat, setDebug, setOutput, setRandom, setRelationName
-
Constructor Details
-
BayesNet
public BayesNet()initializes the generator
-
-
Method Details
-
globalInfo
Returns a string describing this data generator.- Returns:
- a description of the data generator suitable for displaying in the explorer/experimenter gui
-
listOptions
Returns an enumeration describing the available options.- Specified by:
listOptionsin interfaceOptionHandler- Overrides:
listOptionsin classClassificationGenerator- Returns:
- an enumeration of all the available options
-
setOptions
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 number of arcs to use. (default 20)
-N <num> The number of attributes to generate. (default 10)
-C <num> The cardinality of the attributes and the class. (default 2)
- Specified by:
setOptionsin interfaceOptionHandler- Overrides:
setOptionsin classClassificationGenerator- Parameters:
options- the list of options as an array of strings- Throws:
Exception- if an option is not supported
-
getOptions
Gets the current settings of the datagenerator.- Specified by:
getOptionsin interfaceOptionHandler- Overrides:
getOptionsin classClassificationGenerator- Returns:
- an array of strings suitable for passing to setOptions
- See Also:
-
DataGenerator.removeBlacklist(String[])
-
setNumAttributes
public void setNumAttributes(int numAttributes) Sets the number of attributes the dataset should have.- Parameters:
numAttributes- the new number of attributes
-
getNumAttributes
public int getNumAttributes()Gets the number of attributes that should be produced.- Returns:
- the number of attributes that should be produced
-
numAttributesTipText
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setCardinality
public void setCardinality(int value) Sets the cardinality of the attributes (incl class attribute)- Parameters:
value- the cardinality
-
getCardinality
public int getCardinality()Gets the cardinality of the attributes (incl class attribute)- Returns:
- the cardinality of the attributes
-
cardinalityTipText
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setNumArcs
public void setNumArcs(int value) Sets the number of arcs for the bayesian net- Parameters:
value- the number of arcs
-
getNumArcs
public int getNumArcs()Gets the number of arcs for the bayesian net- Returns:
- the number of arcs
-
numArcsTipText
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setNumExamples
public void setNumExamples(int numExamples) Sets the number of examples, given by option.- Overrides:
setNumExamplesin classClassificationGenerator- Parameters:
numExamples- the new number of examples
-
getNumExamples
public int getNumExamples()Gets the number of examples, given by option.- Overrides:
getNumExamplesin classClassificationGenerator- Returns:
- the number of examples, given by option
-
getSeed
public int getSeed()Gets the random number seed.- Specified by:
getSeedin interfaceRandomizable- Overrides:
getSeedin classDataGenerator- Returns:
- the random number seed.
-
setSeed
public void setSeed(int newSeed) Sets the random number seed.- Specified by:
setSeedin interfaceRandomizable- Overrides:
setSeedin classDataGenerator- Parameters:
newSeed- the new random number seed.
-
getSingleModeFlag
Return 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
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:
-
generateExample
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
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:
-
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
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
Returns the revision string.- Returns:
- the revision
-
main
Main method for executing this class.- Parameters:
args- should contain arguments for the data producer:
-