idaArule {ibmdbR}R Documentation

Association Rule Mining

Description

This function calculates association rules on a database table.

Usage

idaArule(
		data,
		tid,
		item,
		maxlen=5,
		maxheadlen=1,
		minsupport=NULL,
		minconf=0.5,
		nametable=NULL,
		namecol=NULL,
		modelname=NULL
)

idaApplyRules(modelname, newdata, tid, item, nametable=NULL, namecol=NULL, ...)

Arguments

data

An ida.data.frame object pointing to the data to be mined.

tid

Input table column that identifies the transactions by an id.

item

Input table column that identifies items in transactions.

maxlen

The maximum length of a rule. Must be two or larger.

maxheadlen

The maximum length of the rule head.

minsupport

The minimal support of a rule to be considered.

minconf

The minimal confidence of a rule to be considered.

nametable

A database table containing a mapping between the items in the input table and their name. The table must contain at least two columns, the first column is named as the column indicated in the item parameter and the second column is named as indicated in parameter namecol.

namecol

The name of the column containing the item name in case nametable was specified.

modelname

The name of the model in-database. If NULL, it is automatically generated.

newdata

A table to which to apply the rules.

...

Additional stored procedure parameters.

Details

idaArule finds association rules in transactional data. The input data must be in transactional format, thus each row of the table contains exactly one item and an identifier of which transaction this item is assigned to. These two columns need to be specified using the tid and item parameters. If the items are referred to with numeric IDs in the transaction table, it is often useful to add a name mapping to produce rules that contain names instead of item IDs. This can be achieved by setting the parameters nametable and namecol.

Models are stored persistently in database under the name modelname. Model names cannot have more than 64 characters and cannot contain white spaces. They need to be quoted like table names, otherwise they will be treated upper case by default. Only one model with a given name is allowed in the database at a time. If a model with modelname already exists, you need to drop it with idaDropModel first before you can create another one with the same name. The model name can be used to retrieve the model later (idaRetrieveModel).

idaApplyRules applies a rule model stored in the database to a table with transactions.

Value

idaArule returns an object of class rules compatible with the packages arules and arulesViz idaApplyRules returns an object of class ida.data.frame, pointing to a table that contains a mapping between transaction IDs and matched rules.

Examples

## Not run: 

idf <- ida.data.frame("GOSALES.ORDER_DETAILS")

r <- idaArule(idf,tid="ORDER_NUMBER",item="PRODUCT_NUMBER",minsupport=0.01)

inspect(r)

applyResult <- idaApplyRules(idaGetModelname(r),idf,"ORDER_NUMBER","PRODUCT_NUMBER")
	

## End(Not run)

[Package ibmdbR version 1.51.0 Index]