Class Sequence


  • public class Sequence
    extends java.lang.Object
    Implementation of a sequence as a list of itemsets, where an itemset is a list of integers.
    Author:
    Philipe-Fournier-Viger
    See Also:
    SequenceDatabase
    • Constructor Summary

      Constructors 
      Constructor Description
      Sequence​(int id)
      Constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addItemset​(java.util.List<java.lang.Integer> itemset)
      Add an itemset to this sequence.
      java.util.List<java.lang.Integer> cloneItemsetMinusItems​(double relativeMinsup, java.util.List<java.lang.Integer> itemset, java.util.Map<java.lang.Integer,​java.util.Set<Sequence>> mapSequenceID)
      Make a copy of an itemset while removing some items that are infrequent with respect to a threshold minsup.
      java.util.List<java.lang.Integer> cloneItemsetMinusItems​(java.util.List<java.lang.Integer> itemset, java.util.Map<java.lang.Integer,​java.util.Set<java.lang.Integer>> mapSequenceID, double minSupportAbsolute)
      Make a copy of an itemset while removing some items that are infrequent with respect to a threshold minsup.
      Sequence cloneSequenceMinusItems​(double relativeMinSup, java.util.Map<java.lang.Integer,​java.util.Set<Sequence>> mapSequenceID)
      Make a copy of this sequence while removing some items that are infrequent with respect to a threshold minsup.
      Sequence cloneSequenceMinusItems​(java.util.Map<java.lang.Integer,​java.util.Set<java.lang.Integer>> mapSequenceID, double relativeMinSup)
      Make a copy of this sequence while removing some items that are infrequent with respect to a threshold minsup.
      java.util.List<java.lang.Integer> get​(int index)
      Get the itemset at a given position in this sequence.
      int getId()
      Get the sequence ID of this sequence.
      java.util.List<java.util.List<java.lang.Integer>> getItemsets()
      Get the list of itemsets in this sequence.
      void print()
      Print this sequence to System.out.
      int size()
      Get the size of this sequence (number of itemsets).
      java.lang.String toString()
      Return a string representation of this sequence.
      • Methods inherited from class java.lang.Object

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

      • Sequence

        public Sequence​(int id)
        Constructor
        Parameters:
        id - the id of this sequence.
    • Method Detail

      • addItemset

        public void addItemset​(java.util.List<java.lang.Integer> itemset)
        Add an itemset to this sequence.
        Parameters:
        itemset - An itemset (list of integers)
      • print

        public void print()
        Print this sequence to System.out.
      • toString

        public java.lang.String toString()
        Return a string representation of this sequence.
        Overrides:
        toString in class java.lang.Object
      • getId

        public int getId()
        Get the sequence ID of this sequence.
      • getItemsets

        public java.util.List<java.util.List<java.lang.Integer>> getItemsets()
        Get the list of itemsets in this sequence.
        Returns:
        the list of itemsets.
      • get

        public java.util.List<java.lang.Integer> get​(int index)
        Get the itemset at a given position in this sequence.
        Parameters:
        index - the position
        Returns:
        the itemset as a list of integers.
      • size

        public int size()
        Get the size of this sequence (number of itemsets).
        Returns:
        the size (an integer).
      • cloneSequenceMinusItems

        public Sequence cloneSequenceMinusItems​(java.util.Map<java.lang.Integer,​java.util.Set<java.lang.Integer>> mapSequenceID,
                                                double relativeMinSup)
        Make a copy of this sequence while removing some items that are infrequent with respect to a threshold minsup.
        Parameters:
        mapSequenceID - a map with key = item value = a set of sequence ids containing this item
        relativeMinSup - the minimum support threshold chosen by the user.
        Returns:
        a copy of this sequence except that item(s) with a support lower than minsup have been excluded.
      • cloneSequenceMinusItems

        public Sequence cloneSequenceMinusItems​(double relativeMinSup,
                                                java.util.Map<java.lang.Integer,​java.util.Set<Sequence>> mapSequenceID)
        Make a copy of this sequence while removing some items that are infrequent with respect to a threshold minsup.
        Parameters:
        mapSequenceID - a map with key = item value = a set of sequence containing this item
        relativeMinSup - the minimum support threshold chosen by the user.
        Returns:
        a copy of this sequence except that item(s) with a support lower than minsup have been excluded.
      • cloneItemsetMinusItems

        public java.util.List<java.lang.Integer> cloneItemsetMinusItems​(double relativeMinsup,
                                                                        java.util.List<java.lang.Integer> itemset,
                                                                        java.util.Map<java.lang.Integer,​java.util.Set<Sequence>> mapSequenceID)
        Make a copy of an itemset while removing some items that are infrequent with respect to a threshold minsup.
        Parameters:
        mapSequenceID - a map with key = item value = a set of sequence containing this item
        relativeMinsup - the minimum support threshold chosen by the user.
        itemset - the itemset
        Returns:
        a copy of this itemset except that item(s) with a support lower than minsup have been excluded.
      • cloneItemsetMinusItems

        public java.util.List<java.lang.Integer> cloneItemsetMinusItems​(java.util.List<java.lang.Integer> itemset,
                                                                        java.util.Map<java.lang.Integer,​java.util.Set<java.lang.Integer>> mapSequenceID,
                                                                        double minSupportAbsolute)
        Make a copy of an itemset while removing some items that are infrequent with respect to a threshold minsup.
        Parameters:
        mapSequenceID - a map with key = item value = a set of sequence ids containing this item
        minSupportAbsolute - the minimum support threshold chosen by the user.
        itemset - the itemset
        Returns:
        a copy of this itemset except that item(s) with a support lower than minsup have been excluded.