|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object weka.datagenerators.Generator
Abstract class for data generators. -------------------------------------------------------------------
General options are:
-r string
Name of the relation of the generated dataset.
(default = name built using name of used generator and options)
-a num
Number of attributes. (default = 10)
-c num
Number of classes. (default = 2)
-n num
Number of examples. (default = 100)
-o filename
writes the generated dataset to the given file using ARFF-Format.
(default = stdout).
-------------------------------------------------------------------
Example usage as the main of a datagenerator called RandomGenerator:
public static void main(String [] args) {
try {
DataGenerator.makeData(new RandomGenerator(), argv);
} catch (Exception e) {
System.err.println(e.getMessage());
}
}
------------------------------------------------------------------
Field Summary | |
private boolean |
m_Debug
|
private Instances |
m_Format
|
private int |
m_NumAttributes
|
private int |
m_NumClasses
|
private int |
m_NumExamples
|
private int |
m_NumExamplesAct
|
private java.io.PrintWriter |
m_Output
|
private java.lang.String |
m_RelationName
|
Constructor Summary | |
Generator()
|
Method Summary | |
(package private) abstract Instances |
defineDataFormat()
Initializes the format for the dataset produced. |
(package private) abstract Instance |
generateExample()
Generates one example of the dataset. |
(package private) abstract Instances |
generateExamples()
Generates all examples of the dataset. |
(package private) abstract java.lang.String |
generateFinished()
Generates a comment string that documentats the data generator. |
boolean |
getDebug()
Gets the debug flag. |
protected Instances |
getFormat()
Gets the format of the dataset that is to be generated. |
private java.lang.String[] |
getGenericOptions()
Gets the current generic settings of the datagenerator. |
int |
getNumAttributes()
Gets the number of attributes that should be produced. |
int |
getNumClasses()
Gets the number of classes the dataset should have. |
int |
getNumExamples()
Gets the number of examples, given by option. |
int |
getNumExamplesAct()
Gets the number of examples the dataset should have. |
java.io.PrintWriter |
getOutput()
Gets the print writer. |
java.lang.String |
getRelationName()
Gets the relation name the dataset should have. |
(package private) abstract boolean |
getSingleModeFlag()
Return if single mode is set for the given data generator mode depends on option setting and or generator type. |
private static java.lang.String |
listGenericOptions(Generator generator)
Method for listing generic options. |
private java.lang.String |
listSpecificOptions(Generator generator)
Makes a string with the options of the specific data generator. |
static void |
makeData(Generator generator,
java.lang.String[] options)
Calls the data generator. |
void |
setDebug(boolean debug)
Sets the debug flag. |
protected void |
setFormat(Instances newFormat)
Sets the format of the dataset that is to be generated. |
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 |
setNumExamples(int numExamples)
Sets the number of examples, given by option. |
void |
setNumExamplesAct(int numExamplesAct)
Sets the number of examples the dataset should have. |
private static void |
setOptions(Generator generator,
java.lang.String[] options)
Sets the generic options and specific options. |
void |
setOutput(java.io.PrintWriter newOutput)
Sets the print writer. |
void |
setRelationName(java.lang.String relationName)
Sets the relation name the dataset should have. |
protected java.lang.String |
toStringFormat()
Returns a string representing the dataset in the instance queue. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private boolean m_Debug
private Instances m_Format
private java.lang.String m_RelationName
private int m_NumAttributes
private int m_NumClasses
private int m_NumExamples
private int m_NumExamplesAct
private java.io.PrintWriter m_Output
Constructor Detail |
public Generator()
Method Detail |
abstract Instances defineDataFormat() throws java.lang.Exception
java.lang.Exception
- if the generating of the format failedabstract Instance generateExample() throws java.lang.Exception
java.lang.Exception
- if the format of the dataset is not yet defined
java.lang.Exception
- if the generator only works with generateExamples
which means in non single modeabstract Instances generateExamples() throws java.lang.Exception
java.lang.Exception
- if the format of the dataset is not yet defined
java.lang.Exception
- if the generator only works with generateExample,
which means in single modeabstract java.lang.String generateFinished() throws java.lang.Exception
java.lang.Exception
- if the generating of the documentaion failsabstract boolean getSingleModeFlag() throws java.lang.Exception
java.lang.Exception
- if mode is not set yetpublic void setDebug(boolean debug)
debug
- the new debug flagpublic boolean getDebug()
public void setRelationName(java.lang.String relationName)
relationName
- the new relation namepublic java.lang.String getRelationName()
public void setNumClasses(int numClasses)
numClasses
- the new number of classespublic int getNumClasses()
public void setNumExamples(int numExamples)
numExamples
- the new number of examplespublic int getNumExamples()
public void setNumAttributes(int numAttributes)
numAttributes
- the new number of attributespublic int getNumAttributes()
public void setNumExamplesAct(int numExamplesAct)
numExamplesAct
- the new number of examplespublic int getNumExamplesAct()
public void setOutput(java.io.PrintWriter newOutput)
newOutput
- the new print writerpublic java.io.PrintWriter getOutput()
protected void setFormat(Instances newFormat)
protected Instances getFormat()
protected java.lang.String toStringFormat()
public static void makeData(Generator generator, java.lang.String[] options) throws java.lang.Exception
options
- options of the data generator
java.lang.Exception
- if there was an error in the option listprivate java.lang.String listSpecificOptions(Generator generator)
generator
- the datagenerator that is used
private static void setOptions(Generator generator, java.lang.String[] options) throws java.lang.Exception
generator
- the data generator usedoptions
- the generic options and the specific options
java.lang.Exception
- if help request or any invalid optionprivate static java.lang.String listGenericOptions(Generator generator)
generator
- the data generator
private java.lang.String[] getGenericOptions()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |