Package weka.associations
Class AssociationRule
- java.lang.Object
-
- weka.associations.AssociationRule
-
- All Implemented Interfaces:
java.lang.Comparable<AssociationRule>
- Direct Known Subclasses:
DefaultAssociationRule
public abstract class AssociationRule extends java.lang.Object implements java.lang.Comparable<AssociationRule>
Abstract class for storing and manipulating an association rule.- Version:
- $Revision: 8034 $
- Author:
- Mark Hall (mhall{[at]}pentaho{[dot]}com).
-
-
Constructor Summary
Constructors Constructor Description AssociationRule()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description intcompareTo(AssociationRule other)Compare this rule to the supplied rule.booleancontainsItems(java.util.ArrayList<Item> items, boolean useOr)booleanequals(java.lang.Object other)Return true if this rule is equal to the supplied one.abstract java.util.Collection<Item>getConsequence()Get the consequence of this rule.abstract intgetConsequenceSupport()Get the support for the consequence.abstract java.lang.String[]getMetricNamesForRule()Return the names of the metrics available for this rule.abstract double[]getMetricValuesForRule()Get all the available metric values for this rule.abstract doublegetNamedMetricValue(java.lang.String metricName)Get the value of the named metric for this ruleabstract intgetNumberOfMetricsForRule()Gets the number of metrics available for this rule.abstract java.util.Collection<Item>getPremise()Get the premise of this rule.abstract intgetPremiseSupport()Get the support for the premise.abstract java.lang.StringgetPrimaryMetricName()Get the name of the primary metric of this rule (e.g.abstract doublegetPrimaryMetricValue()Get the value of the metric for this rule.abstract intgetTotalSupport()Get the total support for this rule (premise + consequence).abstract intgetTotalTransactions()Get the total number of transactions in the data.
-
-
-
Method Detail
-
getPremise
public abstract java.util.Collection<Item> getPremise()
Get the premise of this rule.- Returns:
- the premise of this rule.
-
getConsequence
public abstract java.util.Collection<Item> getConsequence()
Get the consequence of this rule.- Returns:
- the consequence of this rule.
-
getPrimaryMetricName
public abstract java.lang.String getPrimaryMetricName()
Get the name of the primary metric of this rule (e.g. confidence).- Returns:
- the name of the primary metric of this rule.
-
getPrimaryMetricValue
public abstract double getPrimaryMetricValue()
Get the value of the metric for this rule.- Returns:
- the value of the metric for this rule.
-
getNamedMetricValue
public abstract double getNamedMetricValue(java.lang.String metricName) throws java.lang.ExceptionGet the value of the named metric for this rule- 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 abstract int getNumberOfMetricsForRule()
Gets the number of metrics available for this rule.- Returns:
- the number of metrics available for this rule
-
getMetricNamesForRule
public abstract java.lang.String[] getMetricNamesForRule()
Return the names of the metrics available for this rule.- Returns:
- the names of the metrics that are available for this rule.
-
getMetricValuesForRule
public abstract double[] getMetricValuesForRule() throws java.lang.ExceptionGet 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().- Returns:
- all the available metrics for this rule.
- Throws:
java.lang.Exception- if a metric can't be computed for some reason.
-
getPremiseSupport
public abstract int getPremiseSupport()
Get the support for the premise.- Returns:
- the support for the premise.
-
getConsequenceSupport
public abstract int getConsequenceSupport()
Get the support for the consequence.- Returns:
- the support for the consequence.
-
getTotalSupport
public abstract int getTotalSupport()
Get the total support for this rule (premise + consequence).- Returns:
- the total support for this rule.
-
getTotalTransactions
public abstract int getTotalTransactions()
Get the total number of transactions in the data.- Returns:
- the total number of transactions in the data.
-
compareTo
public int compareTo(AssociationRule other)
Compare this rule to the supplied rule.- Specified by:
compareToin interfacejava.lang.Comparable<AssociationRule>- Parameters:
other- the rule to compare to.- Returns:
- the result of the comparison.
-
equals
public boolean equals(java.lang.Object other)
Return true if this rule is equal to the supplied one.- Overrides:
equalsin classjava.lang.Object- Returns:
- true if this rule is the same as the supplied rule.
-
containsItems
public boolean containsItems(java.util.ArrayList<Item> items, boolean useOr)
-
-