|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--weka.datagenerators.Generator | +--weka.datagenerators.RDG1
Class to generate data randomly by producing a decision list. The decision list consists of rules. Instances are generated randomly one by one. If decision list fails to classify the current instance, a new rule according to this current instance is generated and added to the decision list.
The option -V switches on voting, which means that at the end of the generation all instances are reclassified to the class value that is supported by the most rules.
This data generator can generate 'boolean' attributes (= nominal with the values {true, false}) and numeric attributes. The rules can be 'A' or 'NOT A' for boolean values and 'B < random_value' or 'B >= random_value' for numeric values.
Valid options are:
-R num
The maximum number of attributes chosen to form a rule (default 10).
-M num
The minimum number of attributes chosen to form a rule (default 1).
-I num
The number of irrelevant attributes (default 0).
-N num
The number of numeric attributes (default 0).
-S seed
Random number seed for random function used (default 1).
-V
Flag to use voting.
Following an example of a generated dataset:
%
% weka.datagenerators.RDG1 -r expl -a 2 -c 3 -n 4 -N 1 -I 0 -M 2 -R 10 -S 2
%
relation expl
attribute a0 {false,true}
attribute a1 numeric
attribute class {c0,c1,c2}
data
true,0.496823,c0
false,0.743158,c1
false,0.408285,c1
false,0.993687,c2
%
% Number of attributes chosen as irrelevant = 0
%
% DECISIONLIST (number of rules = 3):
% RULE 0: c0 := a1 < 0.986, a0
% RULE 1: c1 := a1 < 0.95, not(a0)
% RULE 2: c2 := not(a0), a1 >= 0.562
Constructor Summary | |
RDG1()
|
Method Summary | |
Instances |
defineDataFormat()
Initializes the format for the dataset produced. |
Instance |
generateExample()
Generate an example of the dataset dataset. |
Instances |
generateExamples()
Generate all examples of the dataset. |
Instances |
generateExamples(int num,
java.util.Random random,
Instances format)
Generate all examples of the dataset. |
java.lang.String |
generateFinished()
Compiles documentation about the data generation. |
boolean[] |
getAttList_Irr()
Gets the array that defines which of the attributes are seen to be irrelevant. |
Instances |
getDatasetFormat()
Gets the dataset format. |
int |
getMaxRuleSize()
Gets the maximum number of tests in rules. |
int |
getMinRuleSize()
Gets the minimum number of tests in rules. |
int |
getNumIrrelevant()
Gets the number of irrelevant attributes. |
int |
getNumNumeric()
Gets the number of numerical attributes. |
java.lang.String[] |
getOptions()
Gets the current settings of the datagenerator RDG1. |
java.util.Random |
getRandom()
Gets the random generator. |
int |
getSeed()
Gets the random number seed. |
boolean |
getSingleModeFlag()
Gets the single mode flag. |
boolean |
getVoteFlag()
Gets the vote flag. |
java.lang.String |
globalInfo()
Returns a string describing this data generator. |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options. |
static void |
main(java.lang.String[] argv)
Main method for testing this class. |
void |
setAttList_Irr(boolean[] newAttList_Irr)
Sets the array that defines which of the attributes are seen to be irrelevant. |
void |
setDatasetFormat(Instances newDatasetFormat)
Sets the dataset format. |
void |
setMaxRuleSize(int newMaxRuleSize)
Sets the maximum number of tests in rules. |
void |
setMinRuleSize(int newMinRuleSize)
Sets the minimum number of tests in rules. |
void |
setNumIrrelevant(int newNumIrrelevant)
Sets the number of irrelevant attributes. |
void |
setNumNumeric(int newNumNumeric)
Sets the number of numerical attributes. |
void |
setOptions(java.lang.String[] options)
Parses a list of options for this object. |
void |
setRandom(java.util.Random newRandom)
Sets the random generator. |
void |
setSeed(int newSeed)
Sets the random number seed. |
void |
setVoteFlag(boolean newVoteFlag)
Sets the vote flag. |
Methods inherited from class weka.datagenerators.Generator |
getDebug, getNumAttributes, getNumClasses, getNumExamples, getNumExamplesAct, getOutput, getRelationName, makeData, setDebug, setNumAttributes, setNumClasses, setNumExamples, setNumExamplesAct, setOutput, setRelationName |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public RDG1()
Method Detail |
public java.lang.String globalInfo()
public java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
public void setOptions(java.lang.String[] options) throws java.lang.Exception
For list of valid options see class description.
setOptions
in interface OptionHandler
options
- the list of options as an array of strings
java.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
public java.util.Random getRandom()
public void setRandom(java.util.Random newRandom)
newRandom
- is the random generator.public int getMaxRuleSize()
public void setMaxRuleSize(int newMaxRuleSize)
newMaxRuleSize
- new maximum number of tests allowed in rules.public int getMinRuleSize()
public void setMinRuleSize(int newMinRuleSize)
newMinRuleSize
- new minimum number of test in rules.public int getNumIrrelevant()
public void setNumIrrelevant(int newNumIrrelevant)
public int getNumNumeric()
public void setNumNumeric(int newNumNumeric)
public boolean getVoteFlag()
public void setVoteFlag(boolean newVoteFlag)
newVoteFlag
- boolean with the new setting of the vote flag.public boolean getSingleModeFlag()
getSingleModeFlag
in class Generator
public int getSeed()
public void setSeed(int newSeed)
newSeed
- the new random number seed.public Instances getDatasetFormat()
public void setDatasetFormat(Instances newDatasetFormat)
newDatasetFormat
- the new dataset format.public boolean[] getAttList_Irr()
public void setAttList_Irr(boolean[] newAttList_Irr)
newAttList_Irr
- array that defines the irrelevant attributes.public Instances defineDataFormat() throws java.lang.Exception
defineDataFormat
in class Generator
java.lang.Exception
- data format could not be definedpublic Instance generateExample() throws java.lang.Exception
generateExample
in class Generator
java.lang.Exception
- if format not defined or generating public Instances generateExamples() throws java.lang.Exception
generateExamples
in class Generator
java.lang.Exception
- if format not defined or generating public Instances generateExamples(int num, java.util.Random random, Instances format) throws java.lang.Exception
java.lang.Exception
- if format not defined or generating public java.lang.String generateFinished() throws java.lang.Exception
generateFinished
in class Generator
java.lang.Exception
- no input structure has been definedpublic static void main(java.lang.String[] argv)
argv
- should contain arguments for the data producer:
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright (c) 2003 David Lindsay, Computer Learning Research Centre, Dept. Computer Science, Royal Holloway, University of London