smile.association
Class ARM
- java.lang.Object
-
- smile.association.ARM
-
public class ARM extends java.lang.ObjectAssociation Rule Mining. Let I = {i1, i2,..., in} be a set of n binary attributes called items. Let D = {t1, t2,..., tm} be a set of transactions called the database. Each transaction in D has a unique transaction ID and contains a subset of the items in I. An association rule is defined as an implication of the form X ⇒ Y where X, Y ⊆ I and X ∩ Y = Ø. The item sets X and Y are called antecedent (left-hand-side or LHS) and consequent (right-hand-side or RHS) of the rule, respectively. The support supp(X) of an item set X is defined as the proportion of transactions in the database which contain the item set. Note that the support of an association rule X ⇒ Y is supp(X ∪ Y). The confidence of a rule is defined conf(X ⇒ Y) = supp(X ∪ Y) / supp(X). Confidence can be interpreted as an estimate of the probability P(Y | X), the probability of finding the RHS of the rule in transactions under the condition that these transactions also contain the LHS. Association rules are usually required to satisfy a user-specified minimum support and a user-specified minimum confidence at the same time.
-
-
Constructor Summary
Constructors Constructor and Description ARM(int[][] itemsets, double minSupport)Constructor.ARM(int[][] itemsets, int minSupport)Constructor.ARM(int[] frequency, int minSupport)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(int[] itemset)Add an item set to the database.java.util.List<AssociationRule>learn(double confidence)Mines the association rules.longlearn(double confidence, java.io.PrintStream out)Mines the association rules.
-
-
-
Constructor Detail
-
ARM
public ARM(int[] frequency, int minSupport)Constructor. This is for mining frequent item sets by scanning database twice. The user first scans the database to obtains the frequency of single items and calls this constructor. Then the user add item sets to the object byadd(int[])during the second scan of the database. In this way, we don't need load the whole database into the main memory.- Parameters:
frequency- the frequency of single items.minSupport- the required minimum support of item sets in terms of frequency.
-
ARM
public ARM(int[][] itemsets, double minSupport)Constructor. This is a one-step construction if the database is available in main memory.- Parameters:
itemsets- the item set dataset. Each row is a item set, which may have different length. The item identifiers have to be in [0, n), where n is the number of items. Item set should NOT contain duplicated items.minSupport- the required minimum support of item sets in terms of percentage.
-
ARM
public ARM(int[][] itemsets, int minSupport)Constructor. This is a one-step construction if the database is available in main memory.- Parameters:
itemsets- the item set database. Each row is a item set, which may have different length. The item identifiers have to be in [0, n), where n is the number of items. Item set should NOT contain duplicated items. Note that it is reordered after the call.minSupport- the required minimum support of item sets in terms of frequency.
-
-
Method Detail
-
add
public void add(int[] itemset)
Add an item set to the database.- Parameters:
itemset- an item set, which should NOT contain duplicated items. Note that it is reordered after the call.
-
learn
public long learn(double confidence, java.io.PrintStream out)Mines the association rules. The discovered rules will be printed out to the provided stream.- Parameters:
confidence- the confidence threshold for association rules.- Returns:
- the number of discovered association rules.
-
learn
public java.util.List<AssociationRule> learn(double confidence)
Mines the association rules. The discovered frequent rules will be returned in a list.- Parameters:
confidence- the confidence threshold for association rules.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG