|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectweka.datagenerators.DataGenerator
weka.datagenerators.ClassificationGenerator
weka.datagenerators.classifiers.classification.RDG1
public class RDG1
A data generator that produces 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.
-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)
-R <num> maximum size for rules (default 10)
-M <num> minimum size for rules (default 1)
-I <num> number of irrelevant attributes (default 0)
-N number of numeric attributes (default 0)
-V switch on voting (default is no 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()
initializes the generator with default values |
|
| Method Summary | |
|---|---|
java.lang.String |
attList_IrrTipText()
Returns the tip text for this property |
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. |
java.lang.String |
generateStart()
Generates a comment string that documentates the data generator. |
boolean[] |
getAttList_Irr()
Gets the array that defines which of the attributes are seen to be irrelevant. |
int |
getMaxRuleSize()
Gets the maximum number of tests in rules. |
int |
getMinRuleSize()
Gets the minimum number of tests in rules. |
int |
getNumAttributes()
Gets the number of attributes that should be produced. |
int |
getNumClasses()
Gets the number of classes the dataset should have. |
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.lang.String |
getRevision()
Returns the revision string. |
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[] args)
Main method for testing this class. |
java.lang.String |
maxRuleSizeTipText()
Returns the tip text for this property |
java.lang.String |
minRuleSizeTipText()
Returns the tip text for this property |
java.lang.String |
numAttributesTipText()
Returns the tip text for this property |
java.lang.String |
numClassesTipText()
Returns the tip text for this property |
java.lang.String |
numIrrelevantTipText()
Returns the tip text for this property |
java.lang.String |
numNumericTipText()
Returns the tip text for this property |
void |
setAttList_Irr(boolean[] newAttList_Irr)
Sets the array that defines which of the attributes are seen to be irrelevant. |
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 |
setNumAttributes(int numAttributes)
Sets the number of attributes the dataset should have. |
void |
setNumClasses(int numClasses)
Sets the number of classes the dataset should have. |
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 |
setVoteFlag(boolean newVoteFlag)
Sets the vote flag. |
java.lang.String |
voteFlagTipText()
Returns the tip text for this property |
| Methods inherited from class weka.datagenerators.ClassificationGenerator |
|---|
getNumExamples, numExamplesTipText, setNumExamples |
| Methods inherited from class weka.datagenerators.DataGenerator |
|---|
debugTipText, defaultOutput, formatTipText, getDatasetFormat, getDebug, getNumExamplesAct, getOutput, getRandom, getRelationName, getSeed, makeData, outputTipText, randomTipText, relationNameTipText, seedTipText, setDatasetFormat, setDebug, setOutput, setRandom, setRelationName, setSeed |
| 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 OptionHandlerlistOptions in class ClassificationGenerator
public void setOptions(java.lang.String[] options)
throws java.lang.Exception
-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)
-R <num> maximum size for rules (default 10)
-M <num> minimum size for rules (default 1)
-I <num> number of irrelevant attributes (default 0)
-N number of numeric attributes (default 0)
-V switch on voting (default is no voting)
setOptions in interface OptionHandlersetOptions in class ClassificationGeneratoroptions - 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 OptionHandlergetOptions in class ClassificationGeneratorDataGenerator.removeBlacklist(String[])public void setNumAttributes(int numAttributes)
numAttributes - the new number of attributespublic int getNumAttributes()
public java.lang.String numAttributesTipText()
public void setNumClasses(int numClasses)
numClasses - the new number of classespublic int getNumClasses()
public java.lang.String numClassesTipText()
public int getMaxRuleSize()
public void setMaxRuleSize(int newMaxRuleSize)
newMaxRuleSize - new maximum number of tests allowed in rules.public java.lang.String maxRuleSizeTipText()
public int getMinRuleSize()
public void setMinRuleSize(int newMinRuleSize)
newMinRuleSize - new minimum number of test in rules.public java.lang.String minRuleSizeTipText()
public int getNumIrrelevant()
public void setNumIrrelevant(int newNumIrrelevant)
newNumIrrelevant - the number of irrelevant attributes.public java.lang.String numIrrelevantTipText()
public int getNumNumeric()
public void setNumNumeric(int newNumNumeric)
newNumNumeric - the number of numerical attributes.public java.lang.String numNumericTipText()
public boolean getVoteFlag()
public void setVoteFlag(boolean newVoteFlag)
newVoteFlag - boolean with the new setting of the vote flag.public java.lang.String voteFlagTipText()
public boolean getSingleModeFlag()
getSingleModeFlag in class DataGeneratorpublic boolean[] getAttList_Irr()
public void setAttList_Irr(boolean[] newAttList_Irr)
newAttList_Irr - array that defines the irrelevant attributes.public java.lang.String attList_IrrTipText()
public Instances defineDataFormat()
throws java.lang.Exception
defineDataFormat in class DataGeneratorjava.lang.Exception - data format could not be definedDataGenerator.defaultRelationName()
public Instance generateExample()
throws java.lang.Exception
generateExample in class DataGeneratorjava.lang.Exception - if format not defined or generating
public Instances generateExamples()
throws java.lang.Exception
generateExamples in class DataGeneratorjava.lang.Exception - if format not defined or generating
public Instances generateExamples(int num,
java.util.Random random,
Instances format)
throws java.lang.Exception
num - the number of examples to generaterandom - the random number generator to useformat - the dataset format
java.lang.Exception - if format not defined or generating public java.lang.String generateStart()
generateStart in class DataGenerator
public java.lang.String generateFinished()
throws java.lang.Exception
generateFinished in class DataGeneratorjava.lang.Exception - no input structure has been definedpublic java.lang.String getRevision()
public static void main(java.lang.String[] args)
args - should contain arguments for the data producer:
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||