Package weka.filters.unsupervised.attribute

# Class ClassAssigner

java.lang.Object
weka.filters.Filter
weka.filters.SimpleFilter
weka.filters.SimpleStreamFilter
weka.filters.unsupervised.attribute.ClassAssigner

All Implemented Interfaces:
  `Serializable`, `CapabilitiesHandler`, `OptionHandler`, `RevisionHandler`, `StreamableFilter`

public class ClassAssigner extends SimpleStreamFilter
Filter that can set and unset the class index.

Valid options are:

     -D
      Turns on output of debugging information.

     -C <num|first|last|0>
      The index of the class attribute. Index starts with 1, 'first'
      and 'last' are accepted, '0' unsets the class index.
      (default: last)

Version:
  $Revision: 5543 $
Author:
  fracpete (fracpete at waikato dot ac dot nz)
See Also:
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`FIRST`
use the first attribute as class.
`static final int`
`LAST`
use the last attribute as class.
`static final int`
`UNSET`
unset the class attribute.

## Constructor Summary

Constructors
Constructor
Description
`ClassAssigner()`

## Method Summary

Modifier and Type
Method
Description
`String`
`classIndexTipText()`
Returns the tip text for this property.
`Capabilities`
`getCapabilities()`
Returns the Capabilities of this filter.
`String`
`getClassIndex()`
returns the class index.
`String[]`
`getOptions()`
Gets the current settings of the filter.
`String`
`getRevision()`
Returns the revision string.
`String`
`globalInfo()`
Returns a string describing this classifier.
`Enumeration`
`listOptions()`
Returns an enumeration describing the available options.
`static void`
`main(String[] args)`
Main method for executing this class.
`void`
`setClassIndex(String value)`
sets the class index.
`void`
`setOptions(String[] options)`
Parses a list of options for this object.

### Methods inherited from class weka.filters.SimpleStreamFilter

`batchFinished, input`

### Methods inherited from class weka.filters.SimpleFilter

`debugTipText, getDebug, setDebug, setInputFormat`

### Methods inherited from class weka.filters.Filter

`batchFilterFile, filterFile, getCapabilities, getOutputFormat, isFirstBatchDone, isNewBatch, isOutputFormatDefined, makeCopies, makeCopy, numPendingOutput, output, outputPeek, toString, useFilter, wekaStaticWrapper`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Details

### FIRST

public static final int FIRST
use the first attribute as class.

See Also:
  - Constant Field Values

### LAST

public static final int LAST
use the last attribute as class.

See Also:
  - Constant Field Values

### UNSET

public static final int UNSET
unset the class attribute.

See Also:
  - Constant Field Values

## Constructor Details

### ClassAssigner

public ClassAssigner()

## Method Details

### globalInfo

public String globalInfo()
Returns a string describing this classifier.

Specified by:
  `globalInfo` in class `SimpleFilter`
Returns:
  a description of the classifier suitable for displaying in the explorer/experimenter gui

### listOptions

public Enumeration listOptions()
Returns an enumeration describing the available options.

Specified by:
  `listOptions` in interface `OptionHandler`
Overrides:
  `listOptions` in class `SimpleFilter`
Returns:
  an enumeration of all the available options.

### setOptions

public void setOptions(String[] options) throws Exception
Parses a list of options for this object.

Valid options are:

     -D
      Turns on output of debugging information.

     -C <num|first|last|0>
      The index of the class attribute. Index starts with 1, 'first'
      and 'last' are accepted, '0' unsets the class index.
      (default: last)

Specified by:
  `setOptions` in interface `OptionHandler`
Overrides:
  `setOptions` in class `SimpleFilter`
Parameters:
  `options` - the list of options as an array of strings
Throws:
  `Exception` - if an option is not supported
See Also:
  - `SimpleFilter.reset()`

### getOptions

public String[] getOptions()
Gets the current settings of the filter.

Specified by:
  `getOptions` in interface `OptionHandler`
Overrides:
  `getOptions` in class `SimpleFilter`
Returns:
  an array of strings suitable for passing to setOptions

### classIndexTipText

public String classIndexTipText()
Returns the tip text for this property.

Returns:
  tip text for this property suitable for displaying in the explorer/experimenter gui

### setClassIndex

public void setClassIndex(String value)
sets the class index.

Parameters:
  `value` - the class index

### getClassIndex

public String getClassIndex()
returns the class index.

Returns:
  the class index

### getCapabilities

public Capabilities getCapabilities()
Returns the Capabilities of this filter.

Specified by:
  `getCapabilities` in interface `CapabilitiesHandler`
Overrides:
  `getCapabilities` in class `Filter`
Returns:
  the capabilities of this object
See Also:
  - `Capabilities`

### getRevision

public String getRevision()
Returns the revision string.

Specified by:
  `getRevision` in interface `RevisionHandler`
Overrides:
  `getRevision` in class `Filter`
Returns:
  the revision

### main

public static void main(String[] args)
Main method for executing this class.

Parameters:
  `args` - should contain arguments for the filter: use -h for help