weka.filters.unsupervised.attribute
Class RandomSubset
- java.lang.Object
-
- weka.filters.Filter
-
- weka.filters.SimpleFilter
-
- weka.filters.SimpleStreamFilter
-
- weka.filters.unsupervised.attribute.RandomSubset
-
- All Implemented Interfaces:
- java.io.Serializable, CapabilitiesHandler, CapabilitiesIgnorer, CommandlineRunnable, OptionHandler, Randomizable, RevisionHandler, WeightedAttributesHandler, WeightedInstancesHandler, StreamableFilter
public class RandomSubset extends SimpleStreamFilter implements Randomizable, WeightedInstancesHandler, WeightedAttributesHandler
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:-N <double> The number of attributes to randomly select. If < 1 then percentage, >= 1 absolute number. (default: 0.5)
-V Invert selection - i.e. randomly remove rather than select.
-S <int> The seed value. (default: 1)
-output-debug-info If set, filter is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, filter capabilities are not checked before filter is built (use with caution).
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description RandomSubset()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description CapabilitiesgetCapabilities()Returns the Capabilities of this filter.booleangetInvertSelection()Get whether to invert the selection - i.e.doublegetNumAttributes()Get the number of attributes (< 1 percentage, >= 1 absolute number).java.lang.String[]getOptions()Gets the current settings of the filter.java.lang.StringgetRevision()Returns the revision string.intgetSeed()Get the seed value for the random number generator.java.lang.StringglobalInfo()Returns a string describing this filter.java.lang.StringinvertSelectionTipText()Returns the tip text for this property.java.util.Enumeration<Option>listOptions()Returns an enumeration describing the available options.static voidmain(java.lang.String[] args)Runs the filter with the given parameters.java.lang.StringnumAttributesTipText()Returns the tip text for this property.java.lang.StringseedTipText()Returns the tip text for this property.voidsetInvertSelection(boolean inv)Set whether to invert the selection - i.e.voidsetNumAttributes(double value)Set the number of attributes.voidsetOptions(java.lang.String[] options)Parses a given list of options.voidsetSeed(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
setInputFormat
-
Methods inherited from class weka.filters.Filter
batchFilterFile, debugTipText, doNotCheckCapabilitiesTipText, filterFile, getCapabilities, getCopyOfInputFormat, getDebug, getDoNotCheckCapabilities, getOutputFormat, isFirstBatchDone, isNewBatch, isOutputFormatDefined, makeCopies, makeCopy, mayRemoveInstanceAfterFirstBatchDone, numPendingOutput, output, outputPeek, postExecution, preExecution, run, runFilter, setDebug, setDoNotCheckCapabilities, toString, useFilter, wekaStaticWrapper
-
-
-
-
Method Detail
-
globalInfo
public java.lang.String globalInfo()
Returns a string describing this filter.- Specified by:
globalInfoin classSimpleFilter- Returns:
- a description of the filter suitable for displaying in the explorer/experimenter gui
-
listOptions
public java.util.Enumeration<Option> listOptions()
Returns an enumeration describing the available options.- Specified by:
listOptionsin interfaceOptionHandler- Overrides:
listOptionsin classFilter- Returns:
- an enumeration of all the available options.
-
getOptions
public java.lang.String[] getOptions()
Gets the current settings of the filter.- Specified by:
getOptionsin interfaceOptionHandler- Overrides:
getOptionsin classFilter- Returns:
- an array of strings suitable for passing to setOptions
-
setOptions
public void setOptions(java.lang.String[] options) throws java.lang.ExceptionParses a given list of options. Valid options are:-N <double> The number of attributes to randomly select. If < 1 then percentage, >= 1 absolute number. (default: 0.5)
-V Invert selection - i.e. randomly remove rather than select.
-S <int> The seed value. (default: 1)
-output-debug-info If set, filter is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, filter capabilities are not checked before filter is built (use with caution).
- Specified by:
setOptionsin interfaceOptionHandler- Overrides:
setOptionsin classFilter- Parameters:
options- the list of options as an array of strings- Throws:
java.lang.Exception- if an option is not supported
-
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.
-
invertSelectionTipText
public java.lang.String invertSelectionTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setInvertSelection
public void setInvertSelection(boolean inv)
Set whether to invert the selection - i.e. randomly remove rather than select attributes.- Parameters:
inv- true if the selection should be inverted
-
getInvertSelection
public boolean getInvertSelection()
Get whether to invert the selection - i.e. randomly remove rather than select attributes.- Returns:
- true if the selection should be inverted
-
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.- Specified by:
getSeedin interfaceRandomizable- Returns:
- the seed value.
-
setSeed
public void setSeed(int value)
Set the seed value for the random number generator.- Specified by:
setSeedin interfaceRandomizable- Parameters:
value- the seed value.
-
getCapabilities
public Capabilities getCapabilities()
Returns the Capabilities of this filter.- Specified by:
getCapabilitiesin interfaceCapabilitiesHandler- Overrides:
getCapabilitiesin classFilter- Returns:
- the capabilities of this object
- See Also:
Capabilities
-
getRevision
public java.lang.String getRevision()
Returns the revision string.- Specified by:
getRevisionin interfaceRevisionHandler- Overrides:
getRevisionin classFilter- 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
-
-
DataMelt 3.0 © DataMelt by jWork.ORG