类 ClassOrder
java.lang.Object
weka.filters.Filter
weka.filters.supervised.attribute.ClassOrder
Changes the order of the classes so that the class values are no longer of in the order specified in the header. The values will be in the order specified by the user -- it could be either in ascending/descending order by the class frequency or in random order. Note that this filter currently does not change the header, only the class values of the instances, so there is not much point in using it in conjunction with the FilteredClassifier. The value can also be converted back using 'originalValue(double value)' procedure.
Valid options are:
-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)
- 版本:
- $Revision: 5541 $
- 作者:
- Xin Xu (xx5@cs.waikato.ac.nz), Eibe Frank (eibe@cs.waikato.ac.nz)
- 另请参阅:
-
字段概要
字段修饰符和类型字段说明static final int
The class values are sorted in ascending order based on their frequenciesstatic final int
The class values are sorted in descending order based on their frequenciesstatic final int
The class values are sorted in random order -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明boolean
Signify that this batch of input to the filter is finished.Returns the tip text for this propertydouble[]
distributionsByOriginalIndex
(double[] before) Convert the given class distribution back to the distributions with the original internal class indexReturns the Capabilities of this filter.double[]
Get the class distribution of the sorted class values.int
Get the wanted class orderString[]
Gets the current settings of the filter.Returns the revision string.long
getSeed()
Get the current randomization seedReturns a string describing this filterboolean
Input an instance for filtering.Returns an enumeration describing the available options.static void
Main method for testing this class.double
originalValue
(double value) Return the original internal class value given the randomized class value, i.e.Returns the tip text for this propertyvoid
setClassOrder
(int order) Set the wanted class orderboolean
setInputFormat
(Instances instanceInfo) Sets the format of the input instances.void
setOptions
(String[] options) Parses a given list of options.void
setSeed
(long seed) Set randomization seed从类继承的方法 weka.filters.Filter
batchFilterFile, filterFile, getCapabilities, getOutputFormat, isFirstBatchDone, isNewBatch, isOutputFormatDefined, makeCopies, makeCopy, numPendingOutput, output, outputPeek, toString, useFilter, wekaStaticWrapper
-
字段详细资料
-
FREQ_ASCEND
public static final int FREQ_ASCENDThe class values are sorted in ascending order based on their frequencies- 另请参阅:
-
FREQ_DESCEND
public static final int FREQ_DESCENDThe class values are sorted in descending order based on their frequencies- 另请参阅:
-
RANDOM
public static final int RANDOMThe class values are sorted in random order- 另请参阅:
-
-
构造器详细资料
-
ClassOrder
public ClassOrder()
-
-
方法详细资料
-
globalInfo
Returns a string describing this filter- 返回:
- a description of the filter suitable for displaying in the explorer/experimenter gui
-
listOptions
Returns an enumeration describing the available options.- 指定者:
listOptions
在接口中OptionHandler
- 返回:
- an enumeration of all the available options.
-
setOptions
Parses a given list of options. Valid options are:-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
在接口中OptionHandler
- 参数:
options
- the list of options as an array of strings- 抛出:
Exception
- if an option is not supported
-
getOptions
Gets the current settings of the filter.- 指定者:
getOptions
在接口中OptionHandler
- 返回:
- an array of strings suitable for passing to setOptions
-
seedTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getSeed
public long getSeed()Get the current randomization seed- 返回:
- a seed
-
setSeed
public void setSeed(long seed) Set randomization seed- 参数:
seed
- the set seed
-
classOrderTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getClassOrder
public int getClassOrder()Get the wanted class order- 返回:
- class order
-
setClassOrder
public void setClassOrder(int order) Set the wanted class order- 参数:
order
- the class order
-
getCapabilities
Returns the Capabilities of this filter.- 指定者:
getCapabilities
在接口中CapabilitiesHandler
- 覆盖:
getCapabilities
在类中Filter
- 返回:
- the capabilities of this object
- 另请参阅:
-
setInputFormat
Sets the format of the input instances.- 覆盖:
setInputFormat
在类中Filter
- 参数:
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
- 抛出:
Exception
- if no class index set or class not nominal
-
input
Input an instance for filtering. Ordinarily the instance is processed and made available for output immediately. Some filters require all instances be read before producing output.- 覆盖:
input
在类中Filter
- 参数:
instance
- the input instance- 返回:
- true if the filtered instance may now be collected with output().
- 抛出:
IllegalStateException
- if no input format has been defined.
-
batchFinished
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. Any subsequent instances filtered should be filtered based on setting obtained from the first batch (unless the inputFormat has been re-assigned or new options have been set). This implementation sorts the class values and provide class counts in the output format- 覆盖:
batchFinished
在类中Filter
- 返回:
- true if there are instances pending output
- 抛出:
IllegalStateException
- if no input structure has been defined,Exception
- if there was a problem finishing the batch.
-
getClassCounts
public double[] getClassCounts()Get the class distribution of the sorted class values. If class is numeric it returns null- 返回:
- the class counts
-
distributionsByOriginalIndex
public double[] distributionsByOriginalIndex(double[] before) Convert the given class distribution back to the distributions with the original internal class index- 参数:
before
- the given class distribution- 返回:
- the distribution converted back
-
originalValue
Return the original internal class value given the randomized class value, i.e. the string presentations of the two indices are the same. It's useful when the filter is used within a classifier so that the filtering procedure should be transparent to the evaluation- 参数:
value
- the given value- 返回:
- the original internal value, -1 if not found
- 抛出:
Exception
- if the coverter table is not set yet
-
getRevision
Returns the revision string.- 指定者:
getRevision
在接口中RevisionHandler
- 覆盖:
getRevision
在类中Filter
- 返回:
- the revision
-
main
Main method for testing this class.- 参数:
argv
- should contain arguments to the filter: use -h for help
-