Package elki.itemsetmining
Class Itemset
- java.lang.Object
-
- elki.itemsetmining.Itemset
-
- All Implemented Interfaces:
java.lang.Comparable<Itemset>
- Direct Known Subclasses:
AssociationRuleGeneration.PartialItemset
,DenseItemset
,OneItemset
,SmallDenseItemset
,SparseItemset
public abstract class Itemset extends java.lang.Object implements java.lang.Comparable<Itemset>
Frequent itemset.- Since:
- 0.7.0
- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description (package private) int
support
Support for this itemset.
-
Constructor Summary
Constructors Constructor Description Itemset()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.StringBuilder
appendItemsTo(java.lang.StringBuilder buf, VectorFieldTypeInformation<BitVector> meta)
Only append the items to a string buffer.java.lang.StringBuilder
appendTo(java.lang.StringBuilder buf, VectorFieldTypeInformation<BitVector> meta)
Append items and support to a string buffer.protected static int
compareLexicographical(Itemset a, Itemset o)
Robust compare using the iterators, lexicographical only!int
compareTo(Itemset o)
boolean
containedIn(SparseNumberVector bv)
Test whether the itemset is contained in a bit vector.boolean
equals(java.lang.Object obj)
int
getSupport()
Get item support.int
hashCode()
Deprecated.Itemsets MUST NOT BE USED IN HASH MAPS.int
increaseSupport()
Increase the support of the itemset.abstract int
iter()
Get an iterator over items, usually the position within an array.abstract int
iterAdvance(int iter)
Advance the iterator to the next position.abstract int
iterDim(int iter)
Item at the iterator position.abstract boolean
iterValid(int iter)
Check if the iterator position is valid.abstract int
length()
Itemset length.static long[]
toBitset(Itemset i, long[] bits)
Get the items.java.lang.String
toString()
-
-
-
Method Detail
-
increaseSupport
public int increaseSupport()
Increase the support of the itemset.- Returns:
- New support.
-
getSupport
public int getSupport()
Get item support.- Returns:
- Support
-
containedIn
public boolean containedIn(SparseNumberVector bv)
Test whether the itemset is contained in a bit vector.- Parameters:
bv
- Bit vector- Returns:
true
when the itemset is contained in this vector.
-
length
public abstract int length()
Itemset length.- Returns:
- Itemset length
-
toBitset
public static long[] toBitset(Itemset i, long[] bits)
Get the items.- Parameters:
i
- Itemsetbits
- Output bitset (must be zeros)- Returns:
- Output bitset
-
iter
public abstract int iter()
Get an iterator over items, usually the position within an array. Intended usage:for (int iter = v.iter(); v.iterValid(iter); iter = v.iterAdvance(iter)) { final int item = v.iterItem(iter); // Do something. }
- Returns:
- Iterator
-
iterAdvance
public abstract int iterAdvance(int iter)
Advance the iterator to the next position.- Parameters:
iter
- Iterator- Returns:
- New iterator position
-
iterValid
public abstract boolean iterValid(int iter)
Check if the iterator position is valid.- Parameters:
iter
- Iterator- Returns:
true
if the position is valid.
-
iterDim
public abstract int iterDim(int iter)
Item at the iterator position.- Parameters:
iter
- Iterator- Returns:
- Current item
-
compareTo
public int compareTo(Itemset o)
- Specified by:
compareTo
in interfacejava.lang.Comparable<Itemset>
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
@Deprecated public int hashCode()
Deprecated.Itemsets MUST NOT BE USED IN HASH MAPS.- Overrides:
hashCode
in classjava.lang.Object
-
compareLexicographical
protected static int compareLexicographical(Itemset a, Itemset o)
Robust compare using the iterators, lexicographical only! Note: This does NOT take length into account.- Parameters:
o
- Other itemset.- Returns:
- Comparison result.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
appendTo
public final java.lang.StringBuilder appendTo(java.lang.StringBuilder buf, VectorFieldTypeInformation<BitVector> meta)
Append items and support to a string buffer.- Parameters:
buf
- Buffermeta
- Relation metadata (for labels)- Returns:
- String buffer for chaining.
-
appendItemsTo
public java.lang.StringBuilder appendItemsTo(java.lang.StringBuilder buf, VectorFieldTypeInformation<BitVector> meta)
Only append the items to a string buffer.- Parameters:
buf
- Buffermeta
- Relation metadata (for labels)- Returns:
- String buffer for chaining.
-
-