| java.lang.Object weka.filters.Filter weka.filters.unsupervised.attribute.Reorder
Reorder | public class Reorder extends Filter implements UnsupervisedFilter,StreamableFilter,OptionHandler(Code) | |
An instance filter that generates output with a new order of the attributes. Useful if one wants to move an attribute to the end to use it as class attribute (e.g. with using "-R 2-last,1").
But it's not only possible to change the order of all the attributes, but also to leave out attributes. E.g. if you have 10 attributes, you can generate the following output order: 1,3,5,7,9,10 or 10,1-5.
You can also duplicate attributes, e.g. for further processing later on: e.g. 1,1,1,4,4,4,2,2,2 where the second and the third column of each attribute are processed differently and the first one, i.e. the original one is kept.
One can simply inverse the order of the attributes via 'last-first'.
After appyling the filter, the index of the class attribute is the last attribute.
Valid options are:
-R <index1,index2-index4,...>
Specify list of columns to copy. First and last are valid
indexes. (default first-last)
author: FracPete (fracpete at waikato dot ac dot nz) version: $Revision: 1.4 $ |
m_InputStringIndex | protected int[] m_InputStringIndex(Code) | | Contains an index of string attributes in the input format
that survive the filtering process -- some entries may be duplicated
|
m_NewOrderCols | protected String m_NewOrderCols(Code) | | Stores which columns to reorder
|
m_SelectedAttributes | protected int[] m_SelectedAttributes(Code) | | Stores the indexes of the selected attributes in order, once the
dataset is seen
|
serialVersionUID | final static long serialVersionUID(Code) | | for serialization
|
attributeIndicesTipText | public String attributeIndicesTipText()(Code) | | Returns the tip text for this property
tip text for this property suitable fordisplaying in the explorer/experimenter gui |
determineIndex | protected int determineIndex(String s, int numAttributes) throws Exception(Code) | | parses the index string and returns the corresponding int index
Parameters: s - the index string to parse Parameters: numAttributes - necessary for "last" and OutOfBounds checks the int index determined form the index string throws: Exception - if index is not valid |
determineIndices | protected int[] determineIndices(int numAttributes) throws Exception(Code) | | parses the range string and returns an array with the indices
Parameters: numAttributes - necessary for "last" and OutOfBounds checks the indices determined form the range string See Also: Reorder.m_NewOrderCols throws: Exception - if range is not valid |
getAttributeIndices | public String getAttributeIndices()(Code) | | Get the current range selection
a string containing a comma separated list of ranges |
getCapabilities | public Capabilities getCapabilities()(Code) | | Returns the Capabilities of this filter.
the capabilities of this object See Also: Capabilities |
getOptions | public String[] getOptions()(Code) | | Gets the current settings of the filter.
an array of strings suitable for passing to setOptions |
globalInfo | public String globalInfo()(Code) | | Returns a string describing this filter
a description of the filter suitable fordisplaying in the explorer/experimenter gui |
input | public boolean input(Instance instance)(Code) | | 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.
Parameters: instance - the input instance true if the filtered instance may now becollected with output(). throws: IllegalStateException - if no input format has been defined. |
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 |
setAttributeIndices | public void setAttributeIndices(String rangeList) throws Exception(Code) | | Set which attributes are to be copied (or kept if invert is true)
Parameters: rangeList - a string representing the list of attributes. Sincethe string will typically come from a user, attributes are indexed from1. eg: first-3,5,6-last Note: use this method before you call setInputFormat(Instances) , since the output format isdetermined in that method. throws: Exception - if an invalid range list is supplied |
setAttributeIndicesArray | public void setAttributeIndicesArray(int[] attributes) throws Exception(Code) | | Set which attributes are to be copied (or kept if invert is true)
Parameters: attributes - an array containing indexes of attributes to select.Since the array will typically come from a program, attributes are indexedfrom 0. Note: use this method before you call setInputFormat(Instances) , since the output format isdetermined in that method. throws: Exception - if an invalid set of ranges is supplied |
setInputFormat | public boolean setInputFormat(Instances instanceInfo) throws Exception(Code) | | Sets the format of the input instances.
Parameters: instanceInfo - an Instances object containing the input instancestructure (any instances contained in the object are ignored - only thestructure is required). true if the outputFormat may be collected immediately throws: Exception - if a problem occurs setting the input format |
setOptions | public void setOptions(String[] options) throws Exception(Code) | | Parses a given list of options.
Valid options are:
-R <index1,index2-index4,...>
Specify list of columns to copy. First and last are valid
indexes. (default first-last)
Parameters: options - the list of options as an array of strings throws: Exception - if an option is not supported |
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)
|
|
|