public class RandomSubset extends SimpleStreamFilter implements Randomizable, WeightedInstancesHandler, WeightedAttributesHandler
-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).
| Modifier and Type | Field and Description |
|---|---|
protected int[] |
m_Indices
The indices of the attributes that got selected.
|
protected boolean |
m_invertSelection
Whether to randomly remove rather than select
|
protected double |
m_NumAttributes
The number of attributes to randomly choose (>= 1 absolute number of
attributes, < 1 percentage).
|
protected int |
m_Seed
The seed value.
|
m_Debug, m_DoNotCheckCapabilities, m_FirstBatchDone, m_InputRelAtts, m_InputStringAtts, m_NewBatch, m_OutputRelAtts, m_OutputStringAtts| Constructor and Description |
|---|
RandomSubset() |
| Modifier and Type | Method and Description |
|---|---|
protected Instances |
determineOutputFormat(Instances inputFormat)
Determines the output format based on the input format and returns this.
|
Capabilities |
getCapabilities()
Returns the Capabilities of this filter.
|
boolean |
getInvertSelection()
Get whether to invert the selection - i.e. randomly remove rather than
select attributes.
|
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.lang.String |
invertSelectionTipText()
Returns the tip text for this property.
|
java.util.Enumeration<Option> |
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.
|
protected Instance |
process(Instance instance)
processes the given instance (may change the provided instance) and returns
the modified version.
|
java.lang.String |
seedTipText()
Returns the tip text for this property.
|
void |
setInvertSelection(boolean inv)
Set whether to invert the selection - i.e. randomly remove rather than
select attributes.
|
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.
|
batchFinished, hasImmediateOutputFormat, input, preprocess, processreset, setInputFormatbatchFilterFile, bufferInput, copyValues, copyValues, debugTipText, doNotCheckCapabilitiesTipText, filterFile, flushInput, getCapabilities, getCopyOfInputFormat, getDebug, getDoNotCheckCapabilities, getInputFormat, getOutputFormat, initInputLocators, initOutputLocators, inputFormatPeek, isFirstBatchDone, isNewBatch, isOutputFormatDefined, makeCopies, makeCopy, mayRemoveInstanceAfterFirstBatchDone, numPendingOutput, output, outputFormatPeek, outputPeek, postExecution, preExecution, push, push, resetQueue, run, runFilter, setDebug, setDoNotCheckCapabilities, setOutputFormat, testInputFormat, toString, useFilter, wekaStaticWrapperprotected double m_NumAttributes
protected int m_Seed
protected int[] m_Indices
protected boolean m_invertSelection
public java.lang.String globalInfo()
globalInfo in class SimpleFilterpublic java.util.Enumeration<Option> listOptions()
listOptions in interface OptionHandlerlistOptions in class Filterpublic java.lang.String[] getOptions()
getOptions in interface OptionHandlergetOptions in class Filterpublic void setOptions(java.lang.String[] options)
throws java.lang.Exception
-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).
setOptions in interface OptionHandlersetOptions in class Filteroptions - the list of options as an array of stringsjava.lang.Exception - if an option is not supportedpublic java.lang.String numAttributesTipText()
public double getNumAttributes()
public void setNumAttributes(double value)
value - the number of attributes to use.public java.lang.String invertSelectionTipText()
public void setInvertSelection(boolean inv)
inv - true if the selection should be invertedpublic boolean getInvertSelection()
public java.lang.String seedTipText()
public int getSeed()
getSeed in interface Randomizablepublic void setSeed(int value)
setSeed in interface Randomizablevalue - the seed value.public Capabilities getCapabilities()
getCapabilities in interface CapabilitiesHandlergetCapabilities in class FilterCapabilitiesprotected Instances determineOutputFormat(Instances inputFormat) throws java.lang.Exception
determineOutputFormat in class SimpleStreamFilterinputFormat - the input format to base the output format onjava.lang.Exception - in case the determination goes wrongSimpleStreamFilter.hasImmediateOutputFormat(),
SimpleStreamFilter.batchFinished(),
SimpleStreamFilter.preprocess(Instances)protected Instance process(Instance instance) throws java.lang.Exception
process in class SimpleStreamFilterinstance - the instance to processjava.lang.Exception - in case the processing goes wrongpublic java.lang.String getRevision()
getRevision in interface RevisionHandlergetRevision in class Filterpublic static void main(java.lang.String[] args)
args - the commandline options