public class ClassOrder extends Filter implements SupervisedFilter, OptionHandler, WeightedAttributesHandler, WeightedInstancesHandler
-R <seed> Specify the seed of randomization used to randomize the class order (default: 1)
-C <order> Specify the class order to be sorted, could be 0: ascending 1: descending and 2: random.(default: 0)
Modifier and Type | Field and Description |
---|---|
static int |
FREQ_ASCEND
The class values are sorted in ascending order based on their frequencies
|
static int |
FREQ_DESCEND
The class values are sorted in descending order based on their frequencies
|
static int |
RANDOM
The class values are sorted in random order
|
Constructor and Description |
---|
ClassOrder() |
Modifier and Type | Method and Description |
---|---|
boolean |
batchFinished()
Signify that this batch of input to the filter is finished.
|
java.lang.String |
classOrderTipText()
Returns the tip text for this property
|
double[] |
distributionsByOriginalIndex(double[] before)
Convert the given class distribution back to the distributions with the
original internal class index
|
Capabilities |
getCapabilities()
Returns the Capabilities of this filter.
|
double[] |
getClassCounts()
Get the class distribution of the sorted class values.
|
int |
getClassOrder()
Get the wanted class order
|
java.lang.String[] |
getOptions()
Gets the current settings of the filter.
|
java.lang.String |
getRevision()
Returns the revision string.
|
long |
getSeed()
Get the current randomization seed
|
java.lang.String |
globalInfo()
Returns a string describing this filter
|
boolean |
input(Instance instance)
Input an instance for filtering.
|
java.util.Enumeration<Option> |
listOptions()
Returns an enumeration describing the available options.
|
static void |
main(java.lang.String[] argv)
Main method for testing this class.
|
double |
originalValue(double value)
Return the original internal class value given the randomized class value,
i.e.
|
java.lang.String |
seedTipText()
Returns the tip text for this property
|
void |
setClassOrder(int order)
Set the wanted class order
|
boolean |
setInputFormat(Instances instanceInfo)
Sets the format of the input instances.
|
void |
setOptions(java.lang.String[] options)
Parses a given list of options.
|
void |
setSeed(long seed)
Set randomization seed
|
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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
makeCopy
public static final int FREQ_ASCEND
public static final int FREQ_DESCEND
public static final int RANDOM
public java.lang.String globalInfo()
public java.util.Enumeration<Option> listOptions()
listOptions
in interface OptionHandler
listOptions
in class Filter
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-R <seed> Specify the seed of randomization used to randomize the class order (default: 1)
-C <order> Specify the class order to be sorted, could be 0: ascending 1: descending and 2: random.(default: 0)
setOptions
in interface OptionHandler
setOptions
in class Filter
options
- the list of options as an array of stringsjava.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class Filter
public java.lang.String seedTipText()
public long getSeed()
public void setSeed(long seed)
seed
- the set seedpublic java.lang.String classOrderTipText()
public int getClassOrder()
public void setClassOrder(int order)
order
- the class orderpublic Capabilities getCapabilities()
getCapabilities
in interface CapabilitiesHandler
getCapabilities
in class Filter
Capabilities
public boolean setInputFormat(Instances instanceInfo) throws java.lang.Exception
setInputFormat
in class Filter
instanceInfo
- an Instances object containing the input instance
structure (any instances contained in the object are ignored -
only the structure is required).java.lang.Exception
- if no class index set or class not nominalpublic boolean input(Instance instance)
public boolean batchFinished() throws java.lang.Exception
batchFinished
in class Filter
java.lang.IllegalStateException
- if no input structure has been defined,java.lang.Exception
- if there was a problem finishing the batch.public double[] getClassCounts()
public double[] distributionsByOriginalIndex(double[] before)
before
- the given class distributionpublic double originalValue(double value) throws java.lang.Exception
value
- the given valuejava.lang.Exception
- if the coverter table is not set yetpublic java.lang.String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class Filter
public static void main(java.lang.String[] argv)
argv
- should contain arguments to the filter: use -h for help