hanaml.Apriori.Rdhanaml.Apriori is a R wrapper for SAP HANA PAL APRIORI and PAL APRIORI_RELATIONAL.
hanaml.Apriori( data, used.cols = NULL, min.support, min.confidence, min.lift = NULL, relational = FALSE, max.item.length = NULL, max.consequent = NULL, use.prefix.tree = NULL, ubiquitous = NULL, lhs.restrict = NULL, rhs.complement.lhs = NULL, rhs.restrict = NULL, lhs.complement.rhs = NULL, timeout = NULL, thread.ratio = NULL, pmml.export = NULL )
| data |
|
|---|---|
| used.cols |
Transaction ID column defaults to the 1st column of data while item ID column defaults to the 2nd column of data. |
| min.support |
|
| min.confidence |
|
| min.lift |
|
| relational |
|
| max.item.length |
|
| max.consequent |
|
| use.prefix.tree |
|
| ubiquitous |
|
| lhs.restrict |
|
| rhs.complement.lhs |
|
| rhs.restrict |
|
| lhs.complement.rhs |
|
| timeout |
|
| thread.ratio |
|
| pmml.export |
Default to "no". |
An "Apriori" object with the following attributes:
result: DataFrame
Mined association rules as a whole.
Each rule has its antecedent/consequent items and support/confidence/lift values.
Available only when relatiional is FALSE.
antecedent: DataFrame
Antecedent item information of mined association rules.
Available only when relational is TRUE.
consequent: DataFrame
Consequent item information of mined association rules.
Available only when relational is TRUE.
statistics: DataFrame
Support/confidence/lift values of mined association rules.
Available only when relational is TRUE.
model: DataFrame
Mined association rules in PMML format.
Available only when pmml.export is 'single-row' or 'multi-row'.
Input DataFrame data:
> data$Collect() CUSTOMER ITEM 1 2 item2 2 2 item3 3 3 item1 4 3 item2 5 3 item4 6 4 item1 7 4 item3 8 5 item2 9 5 item3 10 6 item1 11 6 item3 12 0 item1 13 0 item2 14 0 item5 15 1 item2 16 1 item4 17 7 item1 18 7 item2 19 7 item3 20 7 item5 21 8 item1 22 8 item2 23 8 item3
Call the function:
> apr <- hanaml.Apriori(data = data, min.support = 0.1, min.confidence = 0.3,
min.lift = 1.10, max.consequent = 1, pmml.export = "single-row")
Output:
> apr$result
ANTECEDENT CONSEQUENT SUPPORT CONFIDENCE LIFT
1 item5 item2 0.2222222 1.0000000 1.285714
2 item1 item5 0.2222222 0.3333333 1.500000
3 item5 item1 0.2222222 1.0000000 1.500000
4 item4 item2 0.2222222 1.0000000 1.285714
5 item2&item1 item5 0.2222222 0.5000000 2.250000
6 item5&item1 item2 0.2222222 1.0000000 1.285714
7 item5&item2 item1 0.2222222 1.0000000 1.500000
8 item5&item3 item2 0.1111111 1.0000000 1.285714
9 item5&item3 item1 0.1111111 1.0000000 1.500000
10 item1&item4 item2 0.1111111 1.0000000 1.285714
11 item2&item1&item3 item5 0.1111111 0.5000000 2.250000
12 item5&item1&item3 item2 0.1111111 1.0000000 1.285714
13 item5&item2&item3 item1 0.1111111 1.0000000 1.500000