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) intsupportSupport 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.StringBuilderappendItemsTo(java.lang.StringBuilder buf, VectorFieldTypeInformation<BitVector> meta)Only append the items to a string buffer.java.lang.StringBuilderappendTo(java.lang.StringBuilder buf, VectorFieldTypeInformation<BitVector> meta)Append items and support to a string buffer.protected static intcompareLexicographical(Itemset a, Itemset o)Robust compare using the iterators, lexicographical only!intcompareTo(Itemset o)booleancontainedIn(SparseNumberVector bv)Test whether the itemset is contained in a bit vector.booleanequals(java.lang.Object obj)intgetSupport()Get item support.inthashCode()Deprecated.Itemsets MUST NOT BE USED IN HASH MAPS.intincreaseSupport()Increase the support of the itemset.abstract intiter()Get an iterator over items, usually the position within an array.abstract intiterAdvance(int iter)Advance the iterator to the next position.abstract intiterDim(int iter)Item at the iterator position.abstract booleaniterValid(int iter)Check if the iterator position is valid.abstract intlength()Itemset length.static long[]toBitset(Itemset i, long[] bits)Get the items.java.lang.StringtoString()
-
-
-
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:
truewhen 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:
trueif 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:
compareToin interfacejava.lang.Comparable<Itemset>
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
@Deprecated public int hashCode()
Deprecated.Itemsets MUST NOT BE USED IN HASH MAPS.- Overrides:
hashCodein 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:
toStringin 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.
-
-