Package weka.associations

# Class FilteredAssociator

java.lang.Object
weka.associations.AbstractAssociator
weka.associations.SingleAssociatorEnhancer
weka.associations.FilteredAssociator

All Implemented Interfaces:
  `Serializable`, `Cloneable`, `AssociationRulesProducer`, `Associator`, `CapabilitiesHandler`, `CapabilitiesIgnorer`, `CommandlineRunnable`, `OptionHandler`, `RevisionHandler`

public class FilteredAssociator extends SingleAssociatorEnhancer implements AssociationRulesProducer
Class for running an arbitrary associator on data that has been passed through an arbitrary filter. Like the associator, the structure of the filter is based exclusively on the training data and test instances will be processed by the filter without changing their structure.

Valid options are:

     -F <filter specification>
      Full class name of filter to use, followed
      by filter options.
      eg: "weka.filters.unsupervised.attribute.Remove -V -R 1,2"
      (default: weka.filters.MultiFilter with
      weka.filters.unsupervised.attribute.ReplaceMissingValues)

     -c <the class index>
      The class index.
      (default: -1, i.e. unset)

     -W
      Full name of base associator.
      (default: weka.associations.Apriori)

     Options specific to associator weka.associations.Apriori:

     -N <required number of rules output>
      The required number of rules. (default = 10)

     -T <0=confidence | 1=lift | 2=leverage | 3=Conviction>
      The metric type by which to rank rules. (default = confidence)

     -C <minimum metric score of a rule>
      The minimum confidence of a rule. (default = 0.9)

     -D <delta for minimum support>
      The delta by which the minimum support is decreased in
      each iteration. (default = 0.05)

     -U <upper bound for minimum support>
      Upper bound for minimum support. (default = 1.0)

     -M <lower bound for minimum support>
      The lower bound for the minimum support. (default = 0.1)

     -S <significance level>
      If used, rules are tested for significance at
      the given level. Slower. (default = no significance testing)

     -I
      If set the itemsets found are also output. (default = no)

     -R
      Remove columns that contain all missing values (default = no)

     -V
      Report progress iteratively. (default = no)

     -A
      If set class association rules are mined. (default = no)

     -c <the class index>
      The class index. (default = last)

Version:
  $Revision: 10172 $
Author:
  Len Trigg (trigg@cs.waikato.ac.nz), FracPete (fracpete at waikato dot ac dot nz)
See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FilteredAssociator()`
  Default constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `buildAssociations(Instances data)`
  Build the associator on the filtered data.
  `boolean`
  `canProduceRules()`
  Returns true if this AssociationRulesProducer can actually produce rules.
  `String`
  `classIndexTipText()`
  Returns the tip text for this property
  `String`
  `filterTipText()`
  Returns the tip text for this property
  `AssociationRules`
  `getAssociationRules()`
  Gets the list of mined association rules.
  `Capabilities`
  `getCapabilities()`
  Returns default capabilities of the associator.
  `int`
  `getClassIndex()`
  Gets the class index
  `Filter`
  `getFilter()`
  Gets the filter used.
  `String[]`
  `getOptions()`
  Gets the current settings of the Associator.
  `String`
  `getRevision()`
  Returns the revision string.
  `String[]`
  `getRuleMetricNames()`
  Gets a list of the names of the metrics output for each rule.
  `String`
  `globalInfo()`
  Returns a string describing this Associator
  `Enumeration<Option>`
  `listOptions()`
  Returns an enumeration describing the available options.
  `static void`
  `main(String[] args)`
  Main method for running this class.
  `void`
  `setClassIndex(int value)`
  Sets the class index
  `void`
  `setFilter(Filter value)`
  Sets the filter
  `void`
  `setOptions(String[] options)`
  Parses a given list of options.
  `String`
  `toString()`
  Output a representation of this associator

  ### Methods inherited from class weka.associations.SingleAssociatorEnhancer

  `associatorTipText, getAssociator, setAssociator`

  ### Methods inherited from class weka.associations.AbstractAssociator

  `doNotCheckCapabilitiesTipText, forName, getDoNotCheckCapabilities, makeCopies, makeCopy, postExecution, preExecution, run, runAssociator, setDoNotCheckCapabilities`

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

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

- ## Constructor Details

  - ### FilteredAssociator

    public FilteredAssociator()
    Default constructor.

- ## Method Details

  - ### globalInfo

    public String globalInfo()
    Returns a string describing this Associator
    Returns:
      a description of the Associator suitable for displaying in the explorer/experimenter gui

  - ### listOptions

    public Enumeration<Option> listOptions()
    Returns an enumeration describing the available options.
    Specified by:
      `listOptions` in interface `OptionHandler`
    Overrides:
      `listOptions` in class `SingleAssociatorEnhancer`
    Returns:
      an enumeration of all the available options.

  - ### setOptions

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

    Valid options are:

         -F <filter specification>
          Full class name of filter to use, followed
          by filter options.
          eg: "weka.filters.unsupervised.attribute.Remove -V -R 1,2"
          (default: weka.filters.MultiFilter with
          weka.filters.unsupervised.attribute.ReplaceMissingValues)

         -c <the class index>
          The class index.
          (default: -1, i.e. unset)

         -W
          Full name of base associator.
          (default: weka.associations.Apriori)

         Options specific to associator weka.associations.Apriori:

         -N <required number of rules output>
          The required number of rules. (default = 10)

         -T <0=confidence | 1=lift | 2=leverage | 3=Conviction>
          The metric type by which to rank rules. (default = confidence)

         -C <minimum metric score of a rule>
          The minimum confidence of a rule. (default = 0.9)

         -D <delta for minimum support>
          The delta by which the minimum support is decreased in
          each iteration. (default = 0.05)

         -U <upper bound for minimum support>
          Upper bound for minimum support. (default = 1.0)

         -M <lower bound for minimum support>
          The lower bound for the minimum support. (default = 0.1)

         -S <significance level>
          If used, rules are tested for significance at
          the given level. Slower. (default = no significance testing)

         -I
          If set the itemsets found are also output. (default = no)

         -R
          Remove columns that contain all missing values (default = no)

         -V
          Report progress iteratively. (default = no)

         -A
          If set class association rules are mined. (default = no)

         -c <the class index>
          The class index. (default = last)

    Specified by:
      `setOptions` in interface `OptionHandler`
    Overrides:
      `setOptions` in class `SingleAssociatorEnhancer`
    Parameters:
      `options` - the list of options as an array of strings
    Throws:
      `Exception` - if an option is not supported

  - ### getOptions

    public String[] getOptions()
    Gets the current settings of the Associator.
    Specified by:
      `getOptions` in interface `OptionHandler`
    Overrides:
      `getOptions` in class `SingleAssociatorEnhancer`
    Returns:
      an array of strings suitable for passing to setOptions

  - ### filterTipText

    public String filterTipText()
    Returns the tip text for this property
    Returns:
      tip text for this property suitable for displaying in the explorer/experimenter gui

  - ### setFilter

    public void setFilter(Filter value)
    Sets the filter
    Parameters:
      `value` - the filter with all options set.

  - ### getFilter

    public Filter getFilter()
    Gets the filter used.
    Returns:
      the current filter

  - ### 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(int value)
    Sets the class index
    Parameters:
      `value` - the class index

  - ### getClassIndex

    public int getClassIndex()
    Gets the class index
    Returns:
      the index of the class attribute

  - ### getCapabilities

    public Capabilities getCapabilities()
    Returns default capabilities of the associator.
    Specified by:
      `getCapabilities` in interface `Associator`
    Specified by:
      `getCapabilities` in interface `CapabilitiesHandler`
    Overrides:
      `getCapabilities` in class `SingleAssociatorEnhancer`
    Returns:
      the capabilities of this associator
    See Also:
      - `Capabilities`

  - ### buildAssociations

    public void buildAssociations(Instances data) throws Exception
    Build the associator on the filtered data.
    Specified by:
      `buildAssociations` in interface `Associator`
    Parameters:
      `data` - the training data
    Throws:
      `Exception` - if the Associator could not be built successfully

  - ### getAssociationRules

    public AssociationRules getAssociationRules()
    Gets the list of mined association rules.
    Specified by:
      `getAssociationRules` in interface `AssociationRulesProducer`
    Returns:
      the list of association rules discovered during mining. Returns null if mining hasn't been performed yet.

  - ### getRuleMetricNames

    public String[] getRuleMetricNames()
    Gets a list of the names of the metrics output for each rule. This list should be the same (in terms of the names and order thereof) as that produced by AssociationRule.getMetricNamesForRule().
    Specified by:
      `getRuleMetricNames` in interface `AssociationRulesProducer`
    Returns:
      an array of the names of the metrics available for each rule learned by this producer.

  - ### canProduceRules

    public boolean canProduceRules()
    Returns true if this AssociationRulesProducer can actually produce rules. Most implementing classes will always return true from this method (obviously :-)). However, an implementing class that actually acts as a wrapper around things that may or may not implement AssociationRulesProducer will want to return false if the thing they wrap can't produce rules.
    Specified by:
      `canProduceRules` in interface `AssociationRulesProducer`
    Returns:
      true if this producer can produce rules in its current configuration

  - ### toString

    public String toString()
    Output a representation of this associator
    Overrides:
      `toString` in class `Object`
    Returns:
      a representation of this associator

  - ### getRevision

    public String getRevision()
    Returns the revision string.
    Specified by:
      `getRevision` in interface `RevisionHandler`
    Overrides:
      `getRevision` in class `AbstractAssociator`
    Returns:
      the revision

  - ### main

    public static void main(String[] args)
    Main method for running this class.
    Parameters:
      `args` - commandline arguments, use "-h" for full list