| |
|
| java.lang.Object weka.filters.Filter weka.filters.unsupervised.instance.Resample
Resample | public class Resample extends Filter implements UnsupervisedFilter,OptionHandler(Code) | |
Produces a random subsample of a dataset using either sampling with replacement or without replacement. The original dataset must fit entirely in memory. The number of instances in the generated dataset may be specified. When used in batch mode, subsequent batches are NOT resampled.
Valid options are:
-S <num>
Specify the random number seed (default 1)
-Z <num>
The size of the output dataset, as a percentage of
the input dataset (default 100)
-no-replacement
Disables replacement of instances
(default: with replacement)
-V
Inverts the selection - only available with '-no-replacement'.
author: Len Trigg (len@reeltwo.com) author: FracPete (fracpete at waikato dot ac dot nz) version: $Revision: 1.9 $ |
m_InvertSelection | protected boolean m_InvertSelection(Code) | | Whether to invert the selection (only if instances are drawn WITHOUT
replacement)
See Also: Resample.m_NoReplacement See Also: |
m_NoReplacement | protected boolean m_NoReplacement(Code) | | Whether to perform sampling with replacement or without
|
m_RandomSeed | protected int m_RandomSeed(Code) | | The random number generator seed
|
m_SampleSizePercent | protected double m_SampleSizePercent(Code) | | The subsample size, percent of original set, default 100%
|
serialVersionUID | final static long serialVersionUID(Code) | | for serialization
|
batchFinished | public boolean batchFinished()(Code) | | Signify that this batch of input to the filter is finished.
If the filter requires all instances prior to filtering,
output() may now be called to retrieve the filtered instances.
true if there are instances pending output throws: IllegalStateException - if no input structure has been defined |
createSubsample | protected void createSubsample()(Code) | | Creates a subsample of the current set of input instances. The output
instances are pushed onto the output queue for collection.
|
createSubsampleWithReplacement | public void createSubsampleWithReplacement(Random random, int origSize, int sampleSize)(Code) | | creates the subsample with replacement
Parameters: random - the random number generator to use Parameters: origSize - the original size of the dataset Parameters: sampleSize - the size to generate |
createSubsampleWithoutReplacement | public void createSubsampleWithoutReplacement(Random random, int origSize, int sampleSize)(Code) | | creates the subsample without replacement
Parameters: random - the random number generator to use Parameters: origSize - the original size of the dataset Parameters: sampleSize - the size to generate |
getCapabilities | public Capabilities getCapabilities()(Code) | | Returns the Capabilities of this filter.
the capabilities of this object See Also: Capabilities |
getInvertSelection | public boolean getInvertSelection()(Code) | | Gets whether selection is inverted (only if instances are drawn WIHTOUT
replacement).
true if the replacement is disabled See Also: Resample.m_NoReplacement |
getNoReplacement | public boolean getNoReplacement()(Code) | | Gets whether instances are drawn with or without replacement.
true if the replacement is disabled |
getOptions | public String[] getOptions()(Code) | | Gets the current settings of the filter.
an array of strings suitable for passing to setOptions |
getRandomSeed | public int getRandomSeed()(Code) | | Gets the random number seed.
the random number seed. |
getSampleSizePercent | public double getSampleSizePercent()(Code) | | Gets the subsample size as a percentage of the original set.
the subsample size |
globalInfo | public String globalInfo()(Code) | | Returns a string describing this classifier
a description of the classifier suitable fordisplaying in the explorer/experimenter gui |
input | public boolean input(Instance instance)(Code) | | Input an instance for filtering. Filter requires all
training instances be read before producing output.
Parameters: instance - the input instance true if the filtered instance may now becollected with output(). throws: IllegalStateException - if no input structure has been defined |
invertSelectionTipText | public String invertSelectionTipText()(Code) | | Returns the tip text for this property
tip text for this property suitable fordisplaying in the explorer/experimenter gui |
listOptions | public Enumeration listOptions()(Code) | | Returns an enumeration describing the available options.
an enumeration of all the available options. |
main | public static void main(String[] argv)(Code) | | Main method for testing this class.
Parameters: argv - should contain arguments to the filter: use -h for help |
noReplacementTipText | public String noReplacementTipText()(Code) | | Returns the tip text for this property
tip text for this property suitable fordisplaying in the explorer/experimenter gui |
randomSeedTipText | public String randomSeedTipText()(Code) | | Returns the tip text for this property
tip text for this property suitable fordisplaying in the explorer/experimenter gui |
sampleSizePercentTipText | public String sampleSizePercentTipText()(Code) | | Returns the tip text for this property
tip text for this property suitable fordisplaying in the explorer/experimenter gui |
setInputFormat | public boolean setInputFormat(Instances instanceInfo) throws Exception(Code) | | Sets the format of the input instances.
Parameters: instanceInfo - an Instances object containing the input instance structure (any instances contained in the object are ignored - only the structure is required). true if the outputFormat may be collected immediately throws: Exception - if the input format can't be set successfully |
setInvertSelection | public void setInvertSelection(boolean value)(Code) | | Sets whether the selection is inverted (only if instances are drawn WIHTOUT
replacement).
Parameters: value - if true then selection is inverted |
setNoReplacement | public void setNoReplacement(boolean value)(Code) | | Sets whether instances are drawn with or with out replacement.
Parameters: value - if true then the replacement of instances is disabled |
setOptions | public void setOptions(String[] options) throws Exception(Code) | | Parses a given list of options.
Valid options are:
-S <num>
Specify the random number seed (default 1)
-Z <num>
The size of the output dataset, as a percentage of
the input dataset (default 100)
-no-replacement
Disables replacement of instances
(default: with replacement)
-V
Inverts the selection - only available with '-no-replacement'.
Parameters: options - the list of options as an array of strings throws: Exception - if an option is not supported |
setRandomSeed | public void setRandomSeed(int newSeed)(Code) | | Sets the random number seed.
Parameters: newSeed - the new random number seed. |
setSampleSizePercent | public void setSampleSizePercent(double newSampleSizePercent)(Code) | | Sets the size of the subsample, as a percentage of the original set.
Parameters: newSampleSizePercent - the subsample set size, between 0 and 100. |
Methods inherited from weka.filters.Filter | public static void batchFilterFile(Filter filter, String[] options) throws Exception(Code)(Java Doc) public boolean batchFinished() throws Exception(Code)(Java Doc) protected void bufferInput(Instance instance)(Code)(Java Doc) protected void copyValues(Instance instance, boolean isInput)(Code)(Java Doc) protected void copyValues(Instance instance, boolean instSrcCompat, Instances srcDataset, Instances destDataset)(Code)(Java Doc) public static void filterFile(Filter filter, String[] options) throws Exception(Code)(Java Doc) protected void flushInput()(Code)(Java Doc) public Capabilities getCapabilities()(Code)(Java Doc) public Capabilities getCapabilities(Instances data)(Code)(Java Doc) protected Instances getInputFormat()(Code)(Java Doc) public Instances getOutputFormat()(Code)(Java Doc) protected void initInputLocators(Instances data, int[] indices)(Code)(Java Doc) protected void initOutputLocators(Instances data, int[] indices)(Code)(Java Doc) public boolean input(Instance instance) throws Exception(Code)(Java Doc) protected Instances inputFormatPeek()(Code)(Java Doc) public boolean isFirstBatchDone()(Code)(Java Doc) public boolean isNewBatch()(Code)(Java Doc) public boolean isOutputFormatDefined()(Code)(Java Doc) public static void main(String[] args)(Code)(Java Doc) public static Filter[] makeCopies(Filter model, int num) throws Exception(Code)(Java Doc) public static Filter makeCopy(Filter model) throws Exception(Code)(Java Doc) public int numPendingOutput()(Code)(Java Doc) public Instance output()(Code)(Java Doc) protected Instances outputFormatPeek()(Code)(Java Doc) public Instance outputPeek()(Code)(Java Doc) protected void push(Instance instance)(Code)(Java Doc) protected void resetQueue()(Code)(Java Doc) protected static void runFilter(Filter filter, String[] options)(Code)(Java Doc) public boolean setInputFormat(Instances instanceInfo) throws Exception(Code)(Java Doc) protected void setOutputFormat(Instances outputFormat)(Code)(Java Doc) protected void testInputFormat(Instances instanceInfo) throws Exception(Code)(Java Doc) public static Instances useFilter(Instances data, Filter filter) throws Exception(Code)(Java Doc)
|
|
|
|