weka.classifiers.meta.generators
Class NominalGenerator

java.lang.Object
  extended by weka.classifiers.meta.generators.Generator
      extended by weka.classifiers.meta.generators.RandomizableGenerator
          extended by weka.classifiers.meta.generators.NominalGenerator
All Implemented Interfaces:
java.io.Serializable, NominalAttributeGenerator, OptionHandler

public class NominalGenerator
extends RandomizableGenerator
implements NominalAttributeGenerator

A generator for nominal attributes.

Generates artificial data for nominal attributes. Each attribute value is considered to be possible, i.e. the probability of any value is always non-zero.

Valid options are:

 -D
  If set, generator is run in debug mode and
  may output additional info to the console
 -S <seed>
  Sets the seed of the random number generator of the generator (default: 1)

Version:
$Revision: 5793 $
Author:
Kathryn Hempstalk (kah18 at cs.waikato.ac.nz)
See Also:
Serialized Form

Constructor Summary
NominalGenerator()
           
 
Method Summary
 void buildGenerator(Instances someinstances, Attribute att)
          Sets up the generator with the counts required for generation.
 double generate()
          Generates an index of a nominal attribute as artificial data.
 double getLogProbabilityOf(double valuex)
          Gets the (natural) log of the probability of a given value.
 double getProbabilityOf(double valuex)
          Gets the probability of a given attribute value (provided as an index).
 java.lang.String globalInfo()
          Returns a string describing this class' ability.
 
Methods inherited from class weka.classifiers.meta.generators.RandomizableGenerator
getOptions, getSeed, listOptions, seedTipText, setOptions, setSeed
 
Methods inherited from class weka.classifiers.meta.generators.Generator
copy, debugTipText, forName, getDebug, setDebug
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NominalGenerator

public NominalGenerator()
Method Detail

globalInfo

public java.lang.String globalInfo()
Returns a string describing this class' ability.

Specified by:
globalInfo in class Generator
Returns:
A description of the class.

buildGenerator

public void buildGenerator(Instances someinstances,
                           Attribute att)
Sets up the generator with the counts required for generation.

Specified by:
buildGenerator in interface NominalAttributeGenerator
Parameters:
someinstances - The instances to count up.
att - The attribute to count up with.

generate

public double generate()
Generates an index of a nominal attribute as artificial data.

Specified by:
generate in class Generator
Returns:
The index of the nominal attribute's value.

getProbabilityOf

public double getProbabilityOf(double valuex)
Gets the probability of a given attribute value (provided as an index).

Specified by:
getProbabilityOf in class Generator
Parameters:
valuex - The index to the attribute value.
Returns:
The probability of this value.

getLogProbabilityOf

public double getLogProbabilityOf(double valuex)
Gets the (natural) log of the probability of a given value.

Specified by:
getLogProbabilityOf in class Generator
Parameters:
valuex - The index of the nominal value.
Returns:
The natural log of the probability of valuex.