apriori
Returns the frequent itemsets and the minimum support value. You can also retrieve certain L sets.
Syntax
predict = apriori(data, minimum_support)
predict = apriori(data, minimum_support, options)
Inputs
- data
- The transactional data, pre-processed using one_hot_encode.
- minimum_support
- Threshold value for the itemsets to be allowed.
- options (optional)
- Type: struct
- extract
- The L set to be extracted. (default: 0, for all)
Outputs
- predict
- Contains the frequent itemsets, the size of each large set and the support counts.
Example
cdata = [1, 5, 7, 8 ; 1, 6, 9, 7; 9, 7, 3, 2; 2, 5, 7, 4; 5, 3, 7, 6];
bdata = one_hot_encode(cdata);
options = struct;
options.extract = 2;
predict = apriori(bdata, 0.1, options)
predict = struct [
items: [Matrix] 23 x 9
1 0 0 0 1 0 0 0 0
1 0 0 0 0 1 0 0 0
1 0 0 0 0 0 1 0 0
1 0 0 0 0 0 0 1 0
1 0 0 0 0 0 0 0 1
0 1 1 0 0 0 0 0 0
0 1 0 1 0 0 0 0 0
0 1 0 0 1 0 0 0 0
0 1 0 0 0 0 1 0 0
0 1 0 0 0 0 0 0 1
0 0 1 0 1 0 0 0 0
0 0 1 0 0 1 0 0 0
0 0 1 0 0 0 1 0 0
0 0 1 0 0 0 0 0 1
0 0 0 1 1 0 0 0 0
0 0 0 1 0 0 1 0 0
0 0 0 0 1 1 0 0 0
0 0 0 0 1 0 1 0 0
0 0 0 0 1 0 0 1 0
0 0 0 0 0 1 1 0 0
0 0 0 0 0 1 0 0 1
0 0 0 0 0 0 1 1 0
0 0 0 0 0 0 1 0 1
size: 23
support: [Matrix] 23 x 1
0.20000
0.20000
0.40000
0.20000
0.20000
0.20000
0.20000
0.20000
0.40000
0.20000
0.20000
0.20000
0.40000
0.20000
0.20000
0.20000
0.20000
0.60000
0.20000
0.40000
0.20000
0.20000
0.40000
]