Package weka.associations
Class DefaultAssociationRule
java.lang.Object
weka.associations.AssociationRule
weka.associations.DefaultAssociationRule
- All Implemented Interfaces:
Serializable,Comparable<AssociationRule>
Class for storing and manipulating an association rule.
- Author:
- Mark Hall (mhall{[at]}pentaho{[dot]}com).
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnum for holding different metric types -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultAssociationRule(Collection<Item> premise, Collection<Item> consequence, DefaultAssociationRule.METRIC_TYPE metric, int premiseSupport, int consequenceSupport, int totalSupport, int totalTransactions) Construct a new default association rule. -
Method Summary
Modifier and TypeMethodDescriptionGet the consequence of this rule.intGet the support for the consequence.String[]Return the names of the metrics available for this rule.double[]Get all the available metric values for this rule.doublegetNamedMetricValue(String metricName) Get the value of the named metric for this ruleintGets the number of metrics available for this rule.Get the premise of this rule.intGet the support for the premise.Get the name of the primary metric of this rule (e.g.doubleGet the value of the metric for this rule.intGet the total support for this rule (premise + consequence).intGet the total number of transactions in the data.toString()Get a textual description of this rule.Methods inherited from class weka.associations.AssociationRule
compareTo, containsItems, equals
-
Field Details
-
TAGS_SELECTION
Tags for display in the GUI
-
-
Constructor Details
-
DefaultAssociationRule
public DefaultAssociationRule(Collection<Item> premise, 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 ruleconsequence- the consequence of the rulemetric- the metric for the rulepremiseSupport- the support of the premiseconsequenceSupport- the support of the consequencetotalSupport- the total support of the ruletotalTransactions- the number of transactions in the data
-
-
Method Details
-
getPremise
Description copied from class:AssociationRuleGet the premise of this rule.- Specified by:
getPremisein classAssociationRule- Returns:
- the premise of this rule.
-
getConsequence
Description copied from class:AssociationRuleGet the consequence of this rule.- Specified by:
getConsequencein classAssociationRule- Returns:
- the consequence of this rule.
-
getPrimaryMetricName
Description copied from class:AssociationRuleGet the name of the primary metric of this rule (e.g. confidence).- Specified by:
getPrimaryMetricNamein classAssociationRule- Returns:
- the name of the primary metric of this rule.
-
getPrimaryMetricValue
public double getPrimaryMetricValue()Description copied from class:AssociationRuleGet the value of the metric for this rule.- Specified by:
getPrimaryMetricValuein classAssociationRule- Returns:
- the value of the metric for this rule.
-
getNamedMetricValue
Description copied from class:AssociationRuleGet the value of the named metric for this rule- Specified by:
getNamedMetricValuein classAssociationRule- Parameters:
metricName- the metric to get the value for- Returns:
- the value of the named metric
- Throws:
Exception- if the requested metric is unknown for this rule
-
getNumberOfMetricsForRule
public int getNumberOfMetricsForRule()Description copied from class:AssociationRuleGets the number of metrics available for this rule.- Specified by:
getNumberOfMetricsForRulein classAssociationRule- Returns:
- the number of metrics available for this rule
-
getMetricNamesForRule
Description copied from class:AssociationRuleReturn the names of the metrics available for this rule.- Specified by:
getMetricNamesForRulein classAssociationRule- Returns:
- the names of the metrics that are available for this rule.
-
getMetricValuesForRule
Description copied from class:AssociationRuleGet 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:
getMetricValuesForRulein classAssociationRule- Returns:
- all the available metrics for this rule.
- Throws:
Exception- if a metric can't be computed for some reason.
-
getPremiseSupport
public int getPremiseSupport()Description copied from class:AssociationRuleGet the support for the premise.- Specified by:
getPremiseSupportin classAssociationRule- Returns:
- the support for the premise.
-
getConsequenceSupport
public int getConsequenceSupport()Description copied from class:AssociationRuleGet the support for the consequence.- Specified by:
getConsequenceSupportin classAssociationRule- Returns:
- the support for the consequence.
-
getTotalSupport
public int getTotalSupport()Description copied from class:AssociationRuleGet the total support for this rule (premise + consequence).- Specified by:
getTotalSupportin classAssociationRule- Returns:
- the total support for this rule.
-
getTotalTransactions
public int getTotalTransactions()Description copied from class:AssociationRuleGet the total number of transactions in the data.- Specified by:
getTotalTransactionsin classAssociationRule- Returns:
- the total number of transactions in the data.
-
toString
Get a textual description of this rule.
-