nagdmc assoc

NAG DMC

Association Rules: nagdmc assoc
Purposenagdmc assoc computes association rules for items sorted in ascending order.

Declaration#include <nagdmc.h>void nagdmc assoc(long rec1, long nrec, long dblk, long ni, long nit[],long data[], int supptype, double minsupp, double minconf,long maxnir, long maxnr, long *nr, long rule[],double stat[], int *info);

Parameters1:

rec1 – longInput

On entry: the index in the data of the first data record used in the analysis.
Constraint: rec1 ≥ 0.
2:

nrec – long

Input

On entry: the number of consecutive records, beginning at rec1, used in the analysis.
Constraint: nrec > 1.
3:

dblk – long

Input

On entry: the total number of data records (transactions) in the data block.
Constraint: dblk ≥ rec1 + nrec.
4:

ni – long

Input

On entry: the highest integer number used to describe an item.
Constraint: ni > 1.
5:

nit[dblk] – long

Input

On entry: the number of items in each data record.
Constraint: nit[i] ≥ 1, for i = 0, 1, . . . , dblk − 1.
6:data[n] – long

Input

On entry: the n items, where n is equal to the sum of elements in nit.
7:

supptype – long

Input

On entry: if supptype = 0, the support of the antecendent is used to compute support for association
rules; otherwise the support of the itemset is used.
Constraint: supptype ∈ {0, 1}.
8:

minsupp – double

Input

On entry: the minimum level of support, as a percentage, that each itemset must have to beconsidered for generating rules.
Constraint: 0.0 ≤ minsupp ≤ 100.0.
9:minconf – double

Input

On entry: the minimum level of confidence, as a percentage, in each rule.
Constraint: 0.0 ≤ minconf ≤ 100.0.
10:

maxnir – long

Input

On entry: the maximum number of items in a rule.
Constraint: 1 < maxnir ≤ ni.

nagdmc assoc.1

nagdmc assoc

NAG DMC11:

maxnr – long
On entry: maxnr is the maximum number of rules to generate.
Constraint: maxnr ≥ 1.

Input

12:

nr – long *On exit: nr the number of generated rules; nr ≤ maxnr.

Output13:

rule[(1 + maxnir) ∗ maxnr] – long
OutputOn exit: the array rule contains the nr generated rules. The ith rule contains rule[(1 + maxnir) ∗ i]items, the last of which is the consequent of the rule, for i = 0, 1, . . . , nr − 1.

14:stat[2 ∗ nr] – double
OutputOn exit: stat contains information on the support and confidence for the nr generated rules. For
the ith generated rule, stat[i ∗ 2] contains the support value and stat[i ∗ 2 + 1] the confidence value,
for i = 0, 1, . . . , nr − 1.

15:

info – int *On exit: info gives information on the success of the function call:

Output0: the function successfully completed its task.
i; i = 1, 2, . . . , 5, 7, 8, . . . , 11: the specification of the ith formal parameter was incorrect.
99: the function failed to allocate enough memory.

Notation
nrec
nit[i]
data
minsuppminconf
maxnirthe number of data records, n.
the number of items in the ith data record, mi .
the item data, X.
the minimum support s for a rule.
the minimum confidence c for a rule.
the maximim number r of items in a rule.

Description
The association rules generator nagdmc assoc finds rules in a set X containing n data records xi ,for i = 1, 2, . . . , n. Each data record may contain a different number of integer data values or items.
Let the ith record contain a list of mi items:
xij ∈ Z + ,j = 1, 2, . . . , mi ,where xi1 > 0, and the values are sorted in ascending order:
xij < xi(j+1) ,j = 1, 2, . . . , mi − 1.

In general, let Lk denote a set of k distinct items, known as an itemset, and p be the number ofrecords in X that satisfy:
Lk ⊂ Xi ,for i = 1, 2, . . . , n.

Hence the support of Lk by X is defined as:
S(Lk ) =p.100%.
n

For a given value s, an itemset with support greater than or equal to s per cent. is known as afrequent itemset.
The algorithm computes the frequent itemsets for itemsets containing from one up to r items, anduses these frequent itemsets:Ik ,k = 1, 2, . . . , r,nagdmc assoc.2

nagdmc assoc

NAG DMCto compute a set of rules of the kind:
Antecendent → Consequent,by forming,Antecedent:
Consequent:Ak = Ik \{b};Ck = {b};where b is the lth item in Ik , for l = 1, 2, . . . , k.
Each rule satisfies conditions for minimum support, s, and confidence, c. Support of a rule can bedefined in one of two ways: support of the itemset, S(Ik ), as in Agrawal et al. (1993); or support ofthe items in the antecedent, S(Ak ), as in Borgelt and Kruse (2001). Confidence in a rule is definedas:S(Ak ).100%.
S(Ik )

References and Further Reading
Agrawal R, Imielienski T and Swami A (1993) Mining association rules between sets of items inlarge databases Proc. Conf. on Management of Data 207–216 New York: ACM Press.
Borgelt C and Kruse R (2001) Induction of association rules: a priori implementation TechnicalReport School of Computer Science, University of Madgeburg, Germany.

See Also
nagdmc assoc data
nagdmc assoc print
assoc ex.creads in items from a numeric ASCII file.
prints the rules generated by an association rule analysis.
the example calling program.

nagdmc assoc.3