weka.datagenerators
Class ClusterGenerator

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

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

Abstract class for cluster 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 = 2)

-k num
Number of clusters. (default = 4)

-c
Class Flag. If set, cluster is listed in extra class attribute.

-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
ClusterGenerator()
           
 
Method Summary
 boolean getClassFlag()
          Gets the class flag.
 boolean getDebug()
          Gets the debug flag.
 int getNumAttributes()
          Gets the number of attributes that should be produced.
 int getNumClusters()
          Gets the number of clusters the dataset should have.
 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(ClusterGenerator generator, java.lang.String[] options)
          Calls the data generator.
 void setClassFlag(boolean classFlag)
          Sets the class flag, if class flag is set, the cluster is listed as class atrribute in an extra attribute.
 void setDebug(boolean debug)
          Sets the debug flag.
 void setNumAttributes(int numAttributes)
          Sets the number of attributes the dataset should have.
 void setNumClusters(int numClusters)
          Sets the number of clusters the dataset should have.
 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

ClusterGenerator

public ClusterGenerator()
Method Detail

setClassFlag

public void setClassFlag(boolean classFlag)
Sets the class flag, if class flag is set, the cluster is listed as class atrribute in an extra attribute.

Parameters:
classFlag - the new class flag

getClassFlag

public boolean getClassFlag()
Gets the class flag.

Returns:
the class flag

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

setNumClusters

public void setNumClusters(int numClusters)
Sets the number of clusters the dataset should have.

Parameters:
numClusters - the new number of clusters

getNumClusters

public int getNumClusters()
Gets the number of clusters the dataset should have.

Returns:
the number of clusters the dataset should have

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(ClusterGenerator 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