weka.gui.boundaryvisualizer
Class EMDataGenerator

java.lang.Object
  extended byweka.gui.boundaryvisualizer.EMDataGenerator
All Implemented Interfaces:
DataGenerator, java.io.Serializable

public class EMDataGenerator
extends java.lang.Object
implements DataGenerator, java.io.Serializable

Class that uses EM to build a probabilistic clustering model of supplied input data and then generates new random instances based that model.

See Also:
Serialized Form

Constructor Summary
EMDataGenerator()
           
 
Method Summary
 void buildGenerator(Instances inputInstances)
          Builds the data generator
 Instance generateInstance()
          Generate a new instance.
 Instance generateInstanceFast()
          Generate a new instance.
 int getClusterUsedToGenerateLastInstanceFrom()
          Return the number of the cluster from which the next instance will be generated from
 EM getEMModel()
          Return the EM model of the data
 int getNumGeneratingModels()
          Return the number of clusters generated by EM
static void main(java.lang.String[] args)
          Main method for tesing this class
 void setWeightingDimensions(boolean[] dims)
          Set which dimensions to use when computing a weight for the next instance to generate
 void setWeightingValues(double[] vals)
          Set the values for the weighting dimensions to be used when computing the weight for the next instance to be generated
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EMDataGenerator

public EMDataGenerator()
Method Detail

buildGenerator

public void buildGenerator(Instances inputInstances)
                    throws java.lang.Exception
Builds the data generator

Specified by:
buildGenerator in interface DataGenerator
Parameters:
inputInstances - Instances to construct the clusterer with
Throws:
java.lang.Exception - if an error occurs

generateInstance

public Instance generateInstance()
                          throws java.lang.Exception
Generate a new instance. Returns the instance in an brand new Instance object.

Specified by:
generateInstance in interface DataGenerator
Returns:
an Instance value
Throws:
java.lang.Exception - if an error occurs

generateInstanceFast

public Instance generateInstanceFast()
                              throws java.lang.Exception
Generate a new instance. Reuses an existing instance object to speed up the process.

Specified by:
generateInstanceFast in interface DataGenerator
Returns:
an Instance value
Throws:
java.lang.Exception - if an error occurs

setWeightingDimensions

public void setWeightingDimensions(boolean[] dims)
Set which dimensions to use when computing a weight for the next instance to generate

Specified by:
setWeightingDimensions in interface DataGenerator
Parameters:
dims - an array of booleans indicating which dimensions to use

setWeightingValues

public void setWeightingValues(double[] vals)
Set the values for the weighting dimensions to be used when computing the weight for the next instance to be generated

Specified by:
setWeightingValues in interface DataGenerator
Parameters:
vals - an array of doubles containing the values of the weighting dimensions (corresponding to the entries that are set to true throw setWeightingDimensions)

getEMModel

public EM getEMModel()
Return the EM model of the data

Returns:
an EM value

getNumGeneratingModels

public int getNumGeneratingModels()
Return the number of clusters generated by EM

Specified by:
getNumGeneratingModels in interface DataGenerator
Returns:
an int value

getClusterUsedToGenerateLastInstanceFrom

public int getClusterUsedToGenerateLastInstanceFrom()
Return the number of the cluster from which the next instance will be generated from

Returns:
an int value

main

public static void main(java.lang.String[] args)
Main method for tesing this class

Parameters:
args - a String[] value