fim4r: Interface to Mining Algorithms from fim4r

View source: R/fim4r.R

fim4rR 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,
  support = 0.1,
  confidence = 0.8,
  target = "frequent",
  originalSupport = TRUE,
  appear = NULL,
  report = NULL,
  verbose = TRUE,
  ...
)

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.

support

a numeric value for the minimal support in the range [0,1].

confidence

a numeric value for the minimal confidence of rules in the range [0,1].

target

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

originalSupport

logical; Use the support threshold on the support of the whole rule (LHS and RHS). If FALSE, then LHS support (i.e., coverage) is used by the support threshold.

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).

report

cannot be used via the interface.

verbose

logical; print used parameters?

...

further arguments are passed on to the function fim4r.x() in package fim4r (x is the specified method).

Details

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

Additional Notes:

  • Support and confidence are specified here in the range [0,1]. This is different from the use in fim4r package where supp and conf have the range [0, 100]. arules::fim4r() automatically converts confidence internally.

  • fim4r methods also return the empty itemset while arules methods do not.

  • Type ? fim4r::fim4r for help on additional available arguments. This is only available after package fim4r is installed.

  • Algorithm descriptions and references can be found on the web page in the References Section.

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
r <- fim4r(Adult, method = "fpgrowth", target = "rules", supp = .7, conf = .8)
r
inspect(head(r, by = "lift"))

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

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

# mine maximal frequent itemsets
mfis <- fim4r(Adult, method = "sam", target = "maximal", supp = .7)
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 = .9, conf = .9, zmin = 2)
inspect(rules_all)

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

## End(Not run)

arules documentation built on April 1, 2023, 12:05 a.m.