# assoc

Returns the relationship between item sets, the minimum support, minimum lift, and minimum confidence value.

## Syntax

rules = assoc(predict, minimum_support)

rules = assoc(predict, minimum_support, options)

## Inputs

predict
Contains the frequent itemsets, their support counts, and the size of each large set.
Type: struct
items
The frequent items.
Type: Boolean
Dimension: matrix
size
The size of each large set.
Type: integer
Dimension: vector
support
The support counts.
Type: integer
Dimension: vector
minimum_support
Threshold support value for the itemsets to be allowed.
Type: integer
Dimension: scalar
options (optional)
Type: struct
min_lift
Threshold lift value for the itemsets to be allowed. (default: 0)
Type: integer
Dimension: scalar
min_confidence
Threshold confidence value for the itemsets to be allowed. (default: 0)
Type: integer
Dimension: scalar

## Outputs

rules
Contains the antecedent and consequent, support counts of each, and their union, confidence and lift.
Type: struct
aset
The antecedent itemsets.
Type: integer
Dimension: matrix
aset_support
The support count of the antecedents.
Type: double
Dimension: matrix
cset_support
The support count of the consequents.
Type: double
Dimension: matrix
cset
The consequent itemsets.
Type: integer
Dimension: matrix
confidence
Confidence values for the itemsets.
Type: double
Dimension: matrix
lift
Lift values for the itemsets.
Type: double
Dimension: matrix
support
Support count for the union of antecedent and consequent itemsets.
Type: double
Dimension: matrix

## Example

cdata = [1, 5, 7, 8; 1, 6, 9, 7; 9, 7, 3, 2];
bdata = one_hot_encode(cdata);
predict = apriori(bdata, 0.6);
options = struct;
options.min_lift = 0.5;
options.min_confidence = 0.08;
rules = assoc(predict, 0.05, options)


rules = struct [
aset: [Matrix] 4 x 9
1  0  0  0  0  0  0  0  0
0  0  0  0  0  0  1  0  0
0  0  0  0  0  0  1  0  0
0  0  0  0  0  0  0  0  1
aset_support: [Matrix] 4 x 1
0.66667
1.00000
1.00000
0.66667
confidence: [Matrix] 4 x 1
1.00000
0.66667
0.66667
1.00000
cset: [Matrix] 4 x 9
0  0  0  0  0  0  1  0  0
1  0  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0  1
0  0  0  0  0  0  1  0  0
cset_support: [Matrix] 4 x 1
1.00000
0.66667
0.66667
1.00000
lift: [Matrix] 4 x 1
1
1
1
1
support: [Matrix] 4 x 1
0.66667
0.66667
0.66667
0.66667
]