fpgrowth {rCBA}R Documentation

FP-Growth

Description

FP-Growth algorithm - Jiawei Han, Jian Pei, and Yiwen Yin. Mining frequent patterns without candidate generation. SIGMOD Rec. 29, 2 (2000) <doi:10.1145/335191.335372>

Usage

fpgrowth(train, support = 0.01, confidence = 1, maxLength = 5,
  consequent = NULL, verbose = TRUE, parallel = TRUE)

Arguments

train

data.frame or transactions from arules with input data

support

minimum support

confidence

minimum confidence

maxLength

maximum length

consequent

filter consequent - column name with consequent/target class

verbose

verbose indicator

parallel

parallel indicator

Examples

library("rCBA")
data("iris")

train <- sapply(iris,as.factor)
train <- data.frame(train, check.names=FALSE)
txns <- as(train,"transactions")

rules = rCBA::fpgrowth(txns, support=0.03, confidence=0.03, maxLength=2, consequent="Species",
           parallel=FALSE)

predictions <- rCBA::classification(train,rules)
table(predictions)
sum(as.character(train$Species)==as.character(predictions),na.rm=TRUE)/length(predictions)

prunedRules <- rCBA::pruning(train, rules, method="m2cba", parallel=FALSE)
predictions <- rCBA::classification(train, prunedRules)
table(predictions)
sum(as.character(train$Species)==as.character(predictions),na.rm=TRUE)/length(predictions)

[Package rCBA version 0.4.3 Index]