weka.filters.unsupervised.attribute
Class RandomSubset

java.lang.Object
  extended by weka.filters.Filter
      extended by weka.filters.SimpleFilter
          extended by weka.filters.SimpleStreamFilter
              extended by weka.filters.unsupervised.attribute.RandomSubset
All Implemented Interfaces:
java.io.Serializable, CapabilitiesHandler, OptionHandler, RevisionHandler, StreamableFilter

public class RandomSubset
extends SimpleStreamFilter

Chooses a random subset of attributes, either an absolute number or a percentage. The class is always included in the output (as the last attribute).

Valid options are:

 -D
  Turns on output of debugging information.
 -N <double>
  The number of attributes to randomly select.
  If < 1 then percentage, >= 1 absolute number.
  (default: 0.5)
 -S <int>
  The seed value.
  (default: 1)

Version:
$Revision: 5547 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
Serialized Form

Constructor Summary
RandomSubset()
           
 
Method Summary
 Capabilities getCapabilities()
          Returns the Capabilities of this filter.
 double getNumAttributes()
          Get the number of attributes (< 1 percentage, >= 1 absolute number).
 java.lang.String[] getOptions()
          Gets the current settings of the filter.
 java.lang.String getRevision()
          Returns the revision string.
 int getSeed()
          Get the seed value for the random number generator.
 java.lang.String globalInfo()
          Returns a string describing this filter.
 java.util.Enumeration listOptions()
          Returns an enumeration describing the available options.
static void main(java.lang.String[] args)
          Runs the filter with the given parameters.
 java.lang.String numAttributesTipText()
          Returns the tip text for this property.
 java.lang.String seedTipText()
          Returns the tip text for this property.
 void setNumAttributes(double value)
          Set the number of attributes.
 void setOptions(java.lang.String[] options)
          Parses a given list of options.
 void setSeed(int value)
          Set the seed value for the random number generator.
 
Methods inherited from class weka.filters.SimpleStreamFilter
batchFinished, input
 
Methods inherited from class weka.filters.SimpleFilter
debugTipText, getDebug, setDebug, setInputFormat
 
Methods inherited from class weka.filters.Filter
batchFilterFile, filterFile, getCapabilities, getOutputFormat, isFirstBatchDone, isNewBatch, isOutputFormatDefined, makeCopies, makeCopy, numPendingOutput, output, outputPeek, toString, useFilter, wekaStaticWrapper
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RandomSubset

public RandomSubset()
Method Detail

globalInfo

public java.lang.String globalInfo()
Returns a string describing this filter.

Specified by:
globalInfo in class SimpleFilter
Returns:
a description of the filter suitable for displaying in the explorer/experimenter gui

listOptions

public java.util.Enumeration listOptions()
Returns an enumeration describing the available options.

Specified by:
listOptions in interface OptionHandler
Overrides:
listOptions in class SimpleFilter
Returns:
an enumeration of all the available options.

getOptions

public java.lang.String[] getOptions()
Gets the current settings of the filter.

Specified by:
getOptions in interface OptionHandler
Overrides:
getOptions in class SimpleFilter
Returns:
an array of strings suitable for passing to setOptions

setOptions

public void setOptions(java.lang.String[] options)
                throws java.lang.Exception
Parses a given list of options.

Valid options are:

 -D
  Turns on output of debugging information.
 -N <double>
  The number of attributes to randomly select.
  If < 1 then percentage, >= 1 absolute number.
  (default: 0.5)
 -S <int>
  The seed value.
  (default: 1)

Specified by:
setOptions in interface OptionHandler
Overrides:
setOptions in class SimpleFilter
Parameters:
options - the list of options as an array of strings
Throws:
java.lang.Exception - if an option is not supported
See Also:
SimpleFilter.reset()

numAttributesTipText

public java.lang.String numAttributesTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

getNumAttributes

public double getNumAttributes()
Get the number of attributes (< 1 percentage, >= 1 absolute number).

Returns:
the number of attributes.

setNumAttributes

public void setNumAttributes(double value)
Set the number of attributes.

Parameters:
value - the number of attributes to use.

seedTipText

public java.lang.String seedTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

getSeed

public int getSeed()
Get the seed value for the random number generator.

Returns:
the seed value.

setSeed

public void setSeed(int value)
Set the seed value for the random number generator.

Parameters:
value - the seed value.

getCapabilities

public Capabilities getCapabilities()
Returns the Capabilities of this filter.

Specified by:
getCapabilities in interface CapabilitiesHandler
Overrides:
getCapabilities in class Filter
Returns:
the capabilities of this object
See Also:
Capabilities

getRevision

public java.lang.String getRevision()
Returns the revision string.

Specified by:
getRevision in interface RevisionHandler
Overrides:
getRevision in class Filter
Returns:
the revision

main

public static void main(java.lang.String[] args)
Runs the filter with the given parameters. Use -h to list options.

Parameters:
args - the commandline options