weka.filters.supervised.instance

## Class ClassBalancer

- java.lang.Object
- - weka.filters.Filter
  - - weka.filters.SimpleFilter
    - - weka.filters.SimpleBatchFilter
      - - weka.filters.supervised.instance.ClassBalancer

- All Implemented Interfaces:
    java.io.Serializable, CapabilitiesHandler, CapabilitiesIgnorer, CommandlineRunnable, OptionHandler, RevisionHandler, WeightedInstancesHandler, SupervisedFilter

      public class ClassBalancer
      extends SimpleBatchFilter
      implements SupervisedFilter, WeightedInstancesHandler

  Reweights the instances in the data so that each class has the same total weight. The total sum of weights accross all instances will be maintained. Only the weights in the first batch of data received by this filter are changed, so it can be used with the FilteredClassifier.

  Valid options are:

       -output-debug-info
        If set, filter is run in debug mode and
        may output additional info to the console

       -do-not-check-capabilities
        If set, filter capabilities are not checked when input format is set
        (use with caution).

  Version:
    $Revision: 10215 $
  Author:
    Eibe Frank
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClassBalancer()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Capabilities` | `getCapabilities()` Returns the Capabilities of this filter.
    `java.lang.String` | `getRevision()` Returns the revision string.
    `java.lang.String` | `globalInfo()` Returns a string describing this filter.
    `static void` | `main(java.lang.String[] args)` runs the filter with the given arguments

    - ### Methods inherited from class weka.filters.SimpleBatchFilter

      `allowAccessToFullInputFormat, batchFinished, input`

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

      `setInputFormat`

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

      `batchFilterFile, debugTipText, doNotCheckCapabilitiesTipText, filterFile, getCapabilities, getDebug, getDoNotCheckCapabilities, getOptions, getOutputFormat, isFirstBatchDone, isNewBatch, isOutputFormatDefined, listOptions, makeCopies, makeCopy, mayRemoveInstanceAfterFirstBatchDone, numPendingOutput, output, outputPeek, postExecution, preExecution, run, runFilter, setDebug, setDoNotCheckCapabilities, setOptions, toString, useFilter, wekaStaticWrapper`

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

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

- - ### Constructor Detail

    - #### ClassBalancer

          public ClassBalancer()

  - ### Method Detail

    - #### globalInfo

          public java.lang.String globalInfo()

      Returns a string describing this filter.
      Specified by:
        `globalInfo` in class `SimpleFilter`
      Returns:
        a description of the filter suitable for displaying in the explorer/experimenter gui

    - #### 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 java.lang.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(java.lang.String[] args)

      runs the filter with the given arguments
      Parameters:
        `args` - the commandline arguments