Class MOA

  • All Implemented Interfaces:
    Serializable, weka.core.OptionHandler, weka.core.Randomizable, weka.core.RevisionHandler

    public class MOA
    extends weka.datagenerators.ClassificationGenerator
    A wrapper around MOA instance streams.

    Valid options are:

     -h
      Prints this help.
     -o <file>
      The name of the output file, otherwise the generated data is
      printed to stdout.
     -r <name>
      The name of the relation.
     -d
      Whether to print debug informations.
     -S
      The seed for random function (default 1)
     -n <num>
      The number of examples to generate (default 100)
     -B <classname + options>
      The MOA stream generator.
      (default: moa.streams.generators.LEDGenerator)
    Version:
    $Revision$
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected SamoaToWekaInstanceConverter instanceConverter  
      protected InstanceStream m_ActualGenerator
      the actual data generator.
      protected ClassOption m_Generator
      for manipulating the generator through the GUI.
      • Fields inherited from class weka.datagenerators.ClassificationGenerator

        m_NumExamples
      • Fields inherited from class weka.datagenerators.DataGenerator

        m_CreatingRelationName, m_DatasetFormat, m_Debug, m_DefaultOutput, m_NumExamplesAct, m_OptionBlacklist, m_Output, m_Random, m_RelationName, m_Seed
    • Constructor Summary

      Constructors 
      Constructor Description
      MOA()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      weka.core.Instances defineDataFormat()
      Initializes the format for the dataset produced.
      weka.core.Instance generateExample()
      Generates one example of the dataset.
      weka.core.Instances generateExamples()
      Generates all examples of the dataset.
      String generateFinished()
      Generates a comment string that documentats the data generator.
      String generateStart()
      Generates a comment string that documentates the data generator.
      String generatorTipText()
      Returns the tooltip displayed in the GUI.
      ClassOption getGenerator()
      Returns the current MOA stream generator in use.
      String[] getOptions()
      Gets the current settings of the datagenerator.
      String getRevision()
      Returns the revision string.
      boolean getSingleModeFlag()
      Return if single mode is set for the given data generator mode depends on option setting and or generator type.
      String globalInfo()
      Returns a string describing this data generator.
      Enumeration listOptions()
      Returns an enumeration describing the available options.
      static void main​(String[] args)
      Main method for executing this class.
      void setGenerator​(ClassOption value)
      Sets the MOA stream generator to use.
      void setOptions​(String[] options)
      Parses a list of options for this object.
      • Methods inherited from class weka.datagenerators.ClassificationGenerator

        defaultNumExamples, getNumExamples, numExamplesTipText, setNumExamples
      • Methods inherited from class weka.datagenerators.DataGenerator

        addToBlacklist, clearBlacklist, debugTipText, defaultNumExamplesAct, defaultOutput, defaultRelationName, defaultSeed, enumToVector, formatTipText, getDatasetFormat, getDebug, getEpilogue, getNumExamplesAct, getOutput, getPrologue, getRandom, getRelationName, getRelationNameToUse, getSeed, isOnBlacklist, makeData, makeOptionString, numExamplesActTipText, outputTipText, randomTipText, relationNameTipText, removeBlacklist, runDataGenerator, seedTipText, setDatasetFormat, setDebug, setNumExamplesAct, setOutput, setRandom, setRelationName, setSeed, toStringFormat
    • Constructor Detail

      • MOA

        public MOA()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing this data generator.
        Returns:
        a description of the data generator suitable for displaying in the explorer/experimenter gui
      • listOptions

        public Enumeration listOptions()
        Returns an enumeration describing the available options.
        Specified by:
        listOptions in interface weka.core.OptionHandler
        Overrides:
        listOptions in class weka.datagenerators.ClassificationGenerator
        Returns:
        an enumeration of all the available options
      • setOptions

        public void setOptions​(String[] options)
                        throws Exception
        Parses a list of options for this object.

        Valid options are:

         -h
          Prints this help.
         -o <file>
          The name of the output file, otherwise the generated data is
          printed to stdout.
         -r <name>
          The name of the relation.
         -d
          Whether to print debug informations.
         -S
          The seed for random function (default 1)
         -n <num>
          The number of examples to generate (default 100)
         -B <classname + options>
          The MOA stream generator.
          (default: moa.streams.generators.LEDGenerator)
        Specified by:
        setOptions in interface weka.core.OptionHandler
        Overrides:
        setOptions in class weka.datagenerators.ClassificationGenerator
        Parameters:
        options - the list of options as an array of strings
        Throws:
        Exception - if an option is not supported
      • getOptions

        public String[] getOptions()
        Gets the current settings of the datagenerator.
        Specified by:
        getOptions in interface weka.core.OptionHandler
        Overrides:
        getOptions in class weka.datagenerators.ClassificationGenerator
        Returns:
        an array of strings suitable for passing to setOptions
      • setGenerator

        public void setGenerator​(ClassOption value)
        Sets the MOA stream generator to use.
        Parameters:
        value - the stream generator to use
      • getGenerator

        public ClassOption getGenerator()
        Returns the current MOA stream generator in use.
        Returns:
        the stream generator in use
      • generatorTipText

        public String generatorTipText()
        Returns the tooltip displayed in the GUI.
        Returns:
        the tooltip
      • getSingleModeFlag

        public boolean getSingleModeFlag()
                                  throws Exception
        Return if single mode is set for the given data generator mode depends on option setting and or generator type.
        Specified by:
        getSingleModeFlag in class weka.datagenerators.DataGenerator
        Returns:
        single mode flag, always true
        Throws:
        Exception - if mode is not set yet
      • defineDataFormat

        public weka.core.Instances defineDataFormat()
                                             throws Exception
        Initializes the format for the dataset produced.
        Overrides:
        defineDataFormat in class weka.datagenerators.DataGenerator
        Returns:
        the format for the dataset
        Throws:
        Exception - if the generating of the format failed
      • generateExample

        public weka.core.Instance generateExample()
                                           throws Exception
        Generates one example of the dataset.
        Specified by:
        generateExample in class weka.datagenerators.DataGenerator
        Returns:
        the generated example, null if no further example available
        Throws:
        Exception - if the format of the dataset is not yet defined
        Exception - if the generator only works with generateExamples which means in non single mode
      • generateExamples

        public weka.core.Instances generateExamples()
                                             throws Exception
        Generates all examples of the dataset. Re-initializes the random number generator with the given seed, before generating instances.
        Specified by:
        generateExamples in class weka.datagenerators.DataGenerator
        Returns:
        the generated dataset
        Throws:
        Exception - if the format of the dataset is not yet defined
        Exception - if the generator only works with generateExample, which means in single mode
        See Also:
        DataGenerator.getSeed()
      • generateStart

        public String generateStart()
        Generates a comment string that documentates the data generator. By default this string is added at the beginning of the produced output as ARFF file type, next after the options.
        Specified by:
        generateStart in class weka.datagenerators.DataGenerator
        Returns:
        string contains info about the generated rules
      • generateFinished

        public String generateFinished()
                                throws Exception
        Generates a comment string that documentats the data generator. By default this string is added at the end of theproduces output as ARFF file type.
        Specified by:
        generateFinished in class weka.datagenerators.DataGenerator
        Returns:
        string contains info about the generated rules
        Throws:
        Exception - if the generating of the documentaion fails
      • getRevision

        public String getRevision()
        Returns the revision string.
        Returns:
        the revision
      • main

        public static void main​(String[] args)
        Main method for executing this class.
        Parameters:
        args - should contain arguments for the data producer: