fim4r {arules}R Documentation

Interface to Mining Algorithms from fim4r

Description

Interfaces the algorithms implemented in fim4r. The algorithms include: Apriori, Eclat, FPgrowth, Carpenter, IsTa, RElim and SaM.

Usage

fim4r(
  transactions,
  method = NULL,
  target = "frequent",
  report = NULL,
  appear = NULL,
  ...
)

Arguments

transactions

a transactions object

method

the algorithm to be used. One of:

  • "apriori", "eclat", "fpgrowth" can mine itemsets and rules.

  • "relim", "sam" can mine itemsets.

  • "carpenter", "ista" can only mine closed itemset.

target

the target type. One of: "frequent", "closed", "maximal", "generators" or "rules".

report

cannot be used via the interface.

appear

Specify item appearance in rules (only for apriori, eclat, fpgrowth and the target "rules") Specify a list with two vectors (item labels and appearance modifiers) of the same length. Appearance modifiers are:

  • "-" (may not appear),

  • "a" (only in rule antecedent/LHS),

  • "c" (only in rule consequent/RHS) and

  • "x" (may appear anywhere).

...

further arguments are passed on to the fim4r.x() in package fim4r (x is the specified method). Minimum support and minimum confidence can be set as parameters supp and conf (note the range is [0, 100] percent).

Details

Installation: The package fim4r is not available via CRAN. If needed, the fim4r() function downloads and installs the package automatically.

Additional Notes:

Value

An object of class itemsets or rules.

References

Christian Borgelt, fimi4r: Frequent Item Set Mining and Association Rule Induction for R. https://borgelt.net/fim4r.html

See Also

Other mining algorithms: APappearance-class, AScontrol-classes, ASparameter-classes, apriori(), eclat(), ruleInduction(), weclat()

Examples

## Not run: 
data(Adult)

# list available algorithms
fim4r()

# mine association rules with FPgrowth
# note that fim4r specifies support and confidence out of 100%
r <- fim4r(Adult, method = "fpgrowth", target = "rules", supp = 70, conf = 80)
r
inspect(head(r, by = "lift"))

# mine closed itemsets with Carpenter or IsTa
closed <- fim4r(Adult, method = "carpenter", target = "closed", supp = 70)
closed
fim4r(Adult, method = "ista", target = "closed", supp = 70)

# mine frequent itemset of length 2 (zmin and zmax = 2)
freq_2 <- fim4r(Adult, method = "relim", target = "frequent", supp = 70,
  zmin = 2, zmax = 2)
inspect(freq_2)

# mine maximal frequent itemsets
mfis <- fim4r(Adult, method = "sam", target = "maximal", supp = 70)
inspect(mfis)

# use item appearance. We first mine all rules and then restrict
#   the appearance of the item capital-gain=None
rules_all <- fim4r(Adult, method = "fpgrowth", target = "rules",
  supp = 90, conf = 90, zmin = 2)
inspect(rules_all)

rules_no_gain <- fim4r(Adult, method = "fpgrowth", target = "rules",
  supp = 90, conf = 90, zmin = 2,
  appear = list(c("capital-gain=None"), c("-"))
  )
inspect(rules_no_gain)

## End(Not run)

[Package arules version 1.7-4 Index]