weka.datagenerators
Class Generator

java.lang.Object
  |
  +--weka.datagenerators.Generator
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
RDG1

public abstract class Generator
extends java.lang.Object
implements java.io.Serializable

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());
   }
 }
 

------------------------------------------------------------------

Version:
$Revision: 1.1 $
Author:
Gabi Schmidberger (gabi@cs.waikato.ac.nz)
See Also:
Serialized Form

Constructor Summary
Generator()
           
 
Method Summary
 boolean getDebug()
          Gets the debug flag.
 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.
static void makeData(Generator generator, java.lang.String[] options)
          Calls the data generator.
 void setDebug(boolean debug)
          Sets the debug flag.
 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.
 void setOutput(java.io.PrintWriter newOutput)
          Sets the print writer.
 void setRelationName(java.lang.String relationName)
          Sets the relation name the dataset should have.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Generator

public Generator()
Method Detail

setDebug

public void setDebug(boolean debug)
Sets the debug flag.

Parameters:
debug - the new debug flag

getDebug

public boolean getDebug()
Gets the debug flag.

Returns:
the debug flag

setRelationName

public void setRelationName(java.lang.String relationName)
Sets the relation name the dataset should have.

Parameters:
relationName - the new relation name

getRelationName

public java.lang.String getRelationName()
Gets the relation name the dataset should have.

Returns:
the relation name the dataset should have

setNumClasses

public void setNumClasses(int numClasses)
Sets the number of classes the dataset should have.

Parameters:
numClasses - the new number of classes

getNumClasses

public int getNumClasses()
Gets the number of classes the dataset should have.

Returns:
the number of classes the dataset should have

setNumExamples

public void setNumExamples(int numExamples)
Sets the number of examples, given by option.

Parameters:
numExamples - the new number of examples

getNumExamples

public int getNumExamples()
Gets the number of examples, given by option.

Returns:
the number of examples, given by option

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

setNumExamplesAct

public void setNumExamplesAct(int numExamplesAct)
Sets the number of examples the dataset should have.

Parameters:
numExamplesAct - the new number of examples

getNumExamplesAct

public int getNumExamplesAct()
Gets the number of examples the dataset should have.

Returns:
the number of examples the dataset should have

setOutput

public void setOutput(java.io.PrintWriter newOutput)
Sets the print writer.

Parameters:
newOutput - the new print writer

getOutput

public java.io.PrintWriter getOutput()
Gets the print writer.

Returns:
print writer object

makeData

public static void makeData(Generator generator,
                            java.lang.String[] options)
                     throws java.lang.Exception
Calls the data generator.

Parameters:
options - options of the data generator
Throws:
java.lang.Exception - if there was an error in the option list


Copyright (c) 2003 David Lindsay, Computer Learning Research Centre, Dept. Computer Science, Royal Holloway, University of London