ca.pfv.spmf.algorithms.sequentialpatterns.fournier2008_seqdim
Class Sequence
- java.lang.Object
-
- ca.pfv.spmf.algorithms.sequentialpatterns.fournier2008_seqdim.Sequence
-
public class Sequence extends java.lang.ObjectImplementation of a sequence (a list of itemsets), which represents a sequential pattern or a sequence of a sequence database, as used by SeqDim and Fournier-Viger (2008) algorithms.- See Also:
AlgoSeqDim,AlgoFournierViger08
-
-
Constructor Summary
Constructors Constructor and Description Sequence(int id)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddItemset(Itemset itemset)Add an itemset to this sequence.SequencecloneSequence()Make a copy of this sequenceSequencecloneSequenceMinusItems(java.util.Map<ItemSimple,java.util.Set<java.lang.Integer>> mapSequenceID, double relativeMinSup)Make a copy of a sequence minus a given itemItemsetget(int index)Get the itemset at a given position in this sequence.intgetAbsoluteSupport()Get the support of this sequential pattern as an integer value.intgetId()Get the ID of this sequence.intgetItemOccurencesTotalCount()Return the sum of the size of all itemsets of this sequence.java.util.List<Itemset>getItemsets()Get the list of itemsets in this sequence.ItemSimplegetIthItem(int i)Get the ith item in this sequence.java.lang.StringgetRelativeSupportFormated(int databaseSize)Get the support of this itemset as a percentage (double value).java.util.Set<java.lang.Integer>getSequencesID()Get the sequence IDs containing this seq.longgetTimeLength()Get the time length in terms of time units of this sequential pattern (is useful if timestamps are used, otherwise it is 0)java.lang.StringitemsetsToString()Get a String representation of the itemsets in this Sequence.voidprint()Print this sequence to System.out.voidsetID(int id2)Set the ID of this squence.voidsetSequencesID(java.util.Set<java.lang.Integer> sequencesID)Set the sequence IDs containing this seq.intsize()Get the size of this sequence (number of itemsets).intstrictlyContains(Sequence sequence2)Check if this sequence contains another given sequence.java.lang.StringtoString()Return a string representation of this sequence.java.lang.StringtoStringShort()Return an abbreviated string representation of this sequence.
-
-
-
Method Detail
-
getRelativeSupportFormated
public java.lang.String getRelativeSupportFormated(int databaseSize)
Get the support of this itemset as a percentage (double value).- Parameters:
databaseSize- the number of sequences in the database.- Returns:
- the support as a string with five decimals
-
getAbsoluteSupport
public int getAbsoluteSupport()
Get the support of this sequential pattern as an integer value.- Returns:
- an integer.
-
addItemset
public void addItemset(Itemset itemset)
Add an itemset to this sequence.- Parameters:
itemset- An Itemset
-
cloneSequence
public Sequence cloneSequence()
Make a copy of this sequence- Returns:
- a new Sequence
-
print
public void print()
Print this sequence to System.out.
-
toString
public java.lang.String toString()
Return a string representation of this sequence.- Overrides:
toStringin classjava.lang.Object
-
toStringShort
public java.lang.String toStringShort()
Return an abbreviated string representation of this sequence.
-
itemsetsToString
public java.lang.String itemsetsToString()
Get a String representation of the itemsets in this Sequence.- Returns:
- a string
-
getId
public int getId()
Get the ID of this sequence.- Returns:
- an integer.
-
getItemsets
public java.util.List<Itemset> getItemsets()
Get the list of itemsets in this sequence.- Returns:
- the list of Itemset objects.
-
get
public Itemset get(int index)
Get the itemset at a given position in this sequence.- Parameters:
index- the position- Returns:
- the Itemset
-
getIthItem
public ItemSimple getIthItem(int i)
Get the ith item in this sequence.- Parameters:
i- the position i- Returns:
- an Item.
-
size
public int size()
Get the size of this sequence (number of itemsets).- Returns:
- the size (an integer).
-
getSequencesID
public java.util.Set<java.lang.Integer> getSequencesID()
Get the sequence IDs containing this seq. pattern- Returns:
- a Set of Integer
-
setSequencesID
public void setSequencesID(java.util.Set<java.lang.Integer> sequencesID)
Set the sequence IDs containing this seq. pattern.- Parameters:
sequencesID- a Set of Integer.
-
getItemOccurencesTotalCount
public int getItemOccurencesTotalCount()
Return the sum of the size of all itemsets of this sequence.
-
getTimeLength
public long getTimeLength()
Get the time length in terms of time units of this sequential pattern (is useful if timestamps are used, otherwise it is 0)- Returns:
- the time length as a long.
-
strictlyContains
public int strictlyContains(Sequence sequence2)
Check if this sequence contains another given sequence.- Parameters:
sequence2- a given sequence- Returns:
- Return 1 if this sequence STRICTLY contains sequence Return 2 if this sequence is exactly the same as sequence2 Return 0 if this sequence does not contains sequence2.
-
cloneSequenceMinusItems
public Sequence cloneSequenceMinusItems(java.util.Map<ItemSimple,java.util.Set<java.lang.Integer>> mapSequenceID, double relativeMinSup)
Make a copy of a sequence minus a given item- Parameters:
mapSequenceID- a map indicating for each item (key) the IDs of sequences containing the item (value).relativeMinSup- a minimum support value (double)- Returns:
- a new Sequence
-
setID
public void setID(int id2)
Set the ID of this squence.- Parameters:
id2- a new ID.
-
-
DMelt 3.0 © DataMelt by jWork.ORG