weka.associations

## Class DefaultAssociationRule

- java.lang.Object
- - weka.associations.AssociationRule
  - - weka.associations.DefaultAssociationRule

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<AssociationRule>

      public class DefaultAssociationRule
      extends AssociationRule
      implements java.io.Serializable

  Class for storing and manipulating an association rule.
  Author:
    Mark Hall (mhall{[at]}pentaho{[dot]}com).
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `DefaultAssociationRule.METRIC_TYPE` Enum for holding different metric types

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Tag[]` | `TAGS_SELECTION` Tags for display in the GUI

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultAssociationRule(java.util.Collection<Item> premise, java.util.Collection<Item> consequence, DefaultAssociationRule.METRIC_TYPE metric, int premiseSupport, int consequenceSupport, int totalSupport, int totalTransactions)` Construct a new default association rule.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.Collection<Item>` | `getConsequence()` Get the consequence of this rule.
    `int` | `getConsequenceSupport()` Get the support for the consequence.
    `java.lang.String[]` | `getMetricNamesForRule()` Return the names of the metrics available for this rule.
    `double[]` | `getMetricValuesForRule()` Get all the available metric values for this rule.
    `double` | `getNamedMetricValue(java.lang.String metricName)` Get the value of the named metric for this rule
    `int` | `getNumberOfMetricsForRule()` Gets the number of metrics available for this rule.
    `java.util.Collection<Item>` | `getPremise()` Get the premise of this rule.
    `int` | `getPremiseSupport()` Get the support for the premise.
    `java.lang.String` | `getPrimaryMetricName()` Get the name of the primary metric of this rule (e.g.
    `double` | `getPrimaryMetricValue()` Get the value of the metric for this rule.
    `int` | `getTotalSupport()` Get the total support for this rule (premise + consequence).
    `int` | `getTotalTransactions()` Get the total number of transactions in the data.
    `java.lang.String` | `toString()` Get a textual description of this rule.

    - ### Methods inherited from class weka.associations.AssociationRule

      `compareTo, containsItems, equals`

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

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

- - ### Field Detail

    - #### TAGS_SELECTION

          public static final Tag[] TAGS_SELECTION

      Tags for display in the GUI

  - ### Constructor Detail

    - #### DefaultAssociationRule

          public DefaultAssociationRule(java.util.Collection<Item> premise,
                                        java.util.Collection<Item> consequence,
                                        DefaultAssociationRule.METRIC_TYPE metric,
                                        int premiseSupport,
                                        int consequenceSupport,
                                        int totalSupport,
                                        int totalTransactions)

      Construct a new default association rule.
      Parameters:
        `premise` - the premise of the rule
        `consequence` - the consequence of the rule
        `metric` - the metric for the rule
        `premiseSupport` - the support of the premise
        `consequenceSupport` - the support of the consequence
        `totalSupport` - the total support of the rule
        `totalTransactions` - the number of transactions in the data

  - ### Method Detail

    - #### getPremise

          public java.util.Collection<Item> getPremise()

      Description copied from class: `AssociationRule`
      Get the premise of this rule.
      Specified by:
        `getPremise` in class `AssociationRule`
      Returns:
        the premise of this rule.

    - #### getConsequence

          public java.util.Collection<Item> getConsequence()

      Description copied from class: `AssociationRule`
      Get the consequence of this rule.
      Specified by:
        `getConsequence` in class `AssociationRule`
      Returns:
        the consequence of this rule.

    - #### getPrimaryMetricName

          public java.lang.String getPrimaryMetricName()

      Description copied from class: `AssociationRule`
      Get the name of the primary metric of this rule (e.g. confidence).
      Specified by:
        `getPrimaryMetricName` in class `AssociationRule`
      Returns:
        the name of the primary metric of this rule.

    - #### getPrimaryMetricValue

          public double getPrimaryMetricValue()

      Description copied from class: `AssociationRule`
      Get the value of the metric for this rule.
      Specified by:
        `getPrimaryMetricValue` in class `AssociationRule`
      Returns:
        the value of the metric for this rule.

    - #### getNamedMetricValue

          public double getNamedMetricValue(java.lang.String metricName)
                                     throws java.lang.Exception

      Description copied from class: `AssociationRule`
      Get the value of the named metric for this rule
      Specified by:
        `getNamedMetricValue` in class `AssociationRule`
      Parameters:
        `metricName` - the metric to get the value for
      Returns:
        the value of the named metric
      Throws:
        `java.lang.Exception` - if the requested metric is unknown for this rule

    - #### getNumberOfMetricsForRule

          public int getNumberOfMetricsForRule()

      Description copied from class: `AssociationRule`
      Gets the number of metrics available for this rule.
      Specified by:
        `getNumberOfMetricsForRule` in class `AssociationRule`
      Returns:
        the number of metrics available for this rule

    - #### getMetricNamesForRule

          public java.lang.String[] getMetricNamesForRule()

      Description copied from class: `AssociationRule`
      Return the names of the metrics available for this rule.
      Specified by:
        `getMetricNamesForRule` in class `AssociationRule`
      Returns:
        the names of the metrics that are available for this rule.

    - #### getMetricValuesForRule

          public double[] getMetricValuesForRule()
                                          throws java.lang.Exception

      Description copied from class: `AssociationRule`
      Get all the available metric values for this rule. Values are returned in an array with entries that correspond to the metric names returned by getMetricNamesForRule().
      Specified by:
        `getMetricValuesForRule` in class `AssociationRule`
      Returns:
        all the available metrics for this rule.
      Throws:
        `java.lang.Exception` - if a metric can't be computed for some reason.

    - #### getPremiseSupport

          public int getPremiseSupport()

      Description copied from class: `AssociationRule`
      Get the support for the premise.
      Specified by:
        `getPremiseSupport` in class `AssociationRule`
      Returns:
        the support for the premise.

    - #### getConsequenceSupport

          public int getConsequenceSupport()

      Description copied from class: `AssociationRule`
      Get the support for the consequence.
      Specified by:
        `getConsequenceSupport` in class `AssociationRule`
      Returns:
        the support for the consequence.

    - #### getTotalSupport

          public int getTotalSupport()

      Description copied from class: `AssociationRule`
      Get the total support for this rule (premise + consequence).
      Specified by:
        `getTotalSupport` in class `AssociationRule`
      Returns:
        the total support for this rule.

    - #### getTotalTransactions

          public int getTotalTransactions()

      Description copied from class: `AssociationRule`
      Get the total number of transactions in the data.
      Specified by:
        `getTotalTransactions` in class `AssociationRule`
      Returns:
        the total number of transactions in the data.

    - #### toString

          public java.lang.String toString()

      Get a textual description of this rule.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        a textual description of this rule.