Class AssociationRule<T>

java.lang.Object
org.tweetyproject.machinelearning.assoc.AssociationRule<T>
Type Parameters:
T - The type of items.

public class AssociationRule<T> extends Object
An association rule in item set mining.
Author:
Matthias Thimm
  • Constructor Details

    • AssociationRule

      public AssociationRule()
      Creates a new empty association rule.
    • AssociationRule

      public AssociationRule(Collection<T> premise, Collection<T> conclusion)
      Creates a new association rule with the given premise and conclusion
      Parameters:
      premise - some set of objects for the premise.
      conclusion - some set of objects for the conclusion.
  • Method Details

    • addToPremise

      public boolean addToPremise(T t)
      Adds the given object to the premise.
      Parameters:
      t - some object
      Returns:
      "true" iff this has been changed.
    • addToConclusion

      public boolean addToConclusion(T t)
      Adds the given object to the conclusion.
      Parameters:
      t - some object
      Returns:
      "true" iff this has been changed.
    • getPremise

      public Collection<T> getPremise()
      Returns the premise of this rule.
      Returns:
      the premise of this rule.
    • getConclusion

      public Collection<T> getConclusion()
      Returns the conclusion of this rule.
      Returns:
      the conclusion of this rule.
    • support

      public static <S> double support(S item, Collection<Collection<S>> database)
      Returns the support of the given item wrt. the given database, i.e., the number of transactions of the database, which contain the given item, divided by the number of all transactions.
      Type Parameters:
      S - the type of objects
      Parameters:
      item - some object
      database - a database (set of sets of objects)
      Returns:
      the support of the item.
    • support

      public static <S> double support(Collection<S> itemset, Collection<Collection<S>> database)
      Returns the support of the given itemset wrt. the given database, i.e., the number of transactions of the database, which contain the given itemset, divided by the number of all transactions.
      Type Parameters:
      S - the type of objects
      Parameters:
      itemset - some set of objects
      database - a database (set of sets of objects)
      Returns:
      the support of the itemset.
    • support

      public double support(Collection<Collection<T>> database)
      Returns the support of this rule wrt. the given database (a set of transactions), i.e. the support (frequency of occurrences) of the union of premise and conclusion in the database.
      Parameters:
      database - some set of transactions.
      Returns:
      the support of this rule.
    • confidence

      public double confidence(Collection<Collection<T>> database)
      Returns the confidence of this rule wrt. the given database (a set of transactions). More precisely, the support of this rule divided by the support of the premise alone.
      Parameters:
      database - some set of transactions.
      Returns:
      the confidence of the rule
    • toString

      public String toString()
      Overrides:
      toString in class Object