hanaml.Kord {hana.ml.r}R Documentation

KORD algorithm for association rule mining

Description

K-optimal rule discovery (KORD) algorithm for association rule minining, based on PAL_KORD.

Usage

hanaml.Kord(conn.context,
           data,
           used.cols = NULL,
           k = NULL,
           max.antecedent = NULL,
           min.support = NULL,
           min.confidence = NULL,
           min.coverage = NULL,
           measure = NULL,
           epsilon = NULL)

Arguments

conn.context

ConnectionContext
Database connection object.

data

DataFrame Dataset used for association rule mininig.

used.cols

list of characters, optional
Specified the columns in data that specify transaction IDs and item IDs. For example, consider that the transaction ID column for data is "CUSTOMER", while the item ID colum for data is "ITEM", then the correct way to set up this parameter is

used.cols = list("transaction" = "CUSTOMER", "item" = "ITEM"). Transaction ID column defaults to the 1st column of data and item ID column defauts to the 2nd column of data.

k

integer, optional
Specifies the number (k) of top rules.
Defaults to 10.

max.antecedent

integer, optional
Maximum length of antecedent items for association rule generation.
Defaults to 4.

min.support

double, optional
User-specified minimum support value for rule generation.

min.confidence

double, optional
User-specified minimum confidence value for rule generation.

min.coverage

double, optional
User-specified minimum lift value for rule generation. Defaults to 0.

measure

c("leverage", "lift", "support", "confidence"), optional
User-specified measure that defines the priority of generated association rules.
Defaults to "leverage".

epsilon

double, optional
User-specified maximum support value during the frequent items mining phase, i.e. if an item has support value above ubiquitous, it shall be ignored. Defaults to 1.0.

Format

R6Class object.

Value

A "Kord" object with the following attributes.

Examples

## Not run: 
Input transaction data:

> df
   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

Creating an Kord object for mining association rules from the input data:

> kd <- hanaml.Kord(conn.context = conn, data = df,
                    used.cols = c("transaction" = "CUSTOMER",
                                  "item" = "ITEM"),
                    min.support = 0.1, min.confidence = 0.2,
                    measure = "Lift", k = 5)

Check the mined association rules from the attributes of above Kord object:

> kd$antecedent
  RULE_ID ANTECEDENT
1       0      item2
2       1      item1
3       2      item2
4       2      item1
5       3      item5
6       4      item2
> kd$consequent
  RULE_ID CONSEQUENT
1       0      item5
2       1      item5
3       2      item5
4       3      item1
5       4      item4
> kd$statistics
  RULE_ID   SUPPORT CONFIDENCE     LIFT   LEVERAGE  MEASURE
1       0 0.2222222  0.2857143 1.285714 0.04938272 1.285714
2       1 0.2222222  0.3333333 1.500000 0.07407407 1.500000
3       2 0.2222222  0.5000000 2.250000 0.12345679 2.250000
4       3 0.2222222  1.0000000 1.500000 0.07407407 1.500000
5       4 0.2222222  0.2857143 1.285714 0.04938272 1.285714

## End(Not run)

[Package hana.ml.r version 1.0.8 Index]