Class AssociationRule<T>

  • Type Parameters:
    T - The type of items.

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

      Constructors 
      Constructor Description
      AssociationRule()
      Creates a new empty association rule.
      AssociationRule​(java.util.Collection<T> premise, java.util.Collection<T> conclusion)
      Creates a new association rule with the given premise and conclusion
    • Method Summary

      Modifier and Type Method Description
      boolean addToConclusion​(T t)
      Adds the given object to the conclusion.
      boolean addToPremise​(T t)
      Adds the given object to the premise.
      double confidence​(java.util.Collection<java.util.Collection<T>> database)
      Returns the confidence of this rule wrt.
      java.util.Collection<T> getConclusion()
      Returns the conclusion of this rule.
      java.util.Collection<T> getPremise()
      Returns the premise of this rule.
      double support​(java.util.Collection<java.util.Collection<T>> database)
      Returns the support of this rule wrt.
      static <S> double support​(java.util.Collection<S> itemset, java.util.Collection<java.util.Collection<S>> database)
      Returns the support of the given itemset wrt.
      static <S> double support​(S item, java.util.Collection<java.util.Collection<S>> database)
      Returns the support of the given item wrt.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • AssociationRule

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

        public AssociationRule​(java.util.Collection<T> premise,
                               java.util.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 Detail

      • 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 java.util.Collection<T> getPremise()
        Returns the premise of this rule.
        Returns:
        the premise of this rule.
      • getConclusion

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

        public static <S> double support​(S item,
                                         java.util.Collection<java.util.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​(java.util.Collection<S> itemset,
                                         java.util.Collection<java.util.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​(java.util.Collection<java.util.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​(java.util.Collection<java.util.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 java.lang.String toString()
        Overrides:
        toString in class java.lang.Object