This class implements an implication set (LHS -> RHS) in the framework of
Formal Concept Analysis (FCA). It inherits from RuleSet and adds
FCA-specific methods such as closure computation, simplification, and
basis transformation.
fcaR::RuleSet -> ImplicationSet
Inherited methods
fcaR::RuleSet$[()fcaR::RuleSet$cardinality()fcaR::RuleSet$confidence()fcaR::RuleSet$filter()fcaR::RuleSet$get_LHS_matrix()fcaR::RuleSet$get_RHS_matrix()fcaR::RuleSet$get_attributes()fcaR::RuleSet$get_implications()fcaR::RuleSet$get_quality()fcaR::RuleSet$is_empty()fcaR::RuleSet$size()fcaR::RuleSet$to_latex()
new()Initialize an ImplicationSet
ImplicationSet$new(...)...A rules object (from arules) or named arguments:
name (string), attributes (character vector),
lhs and rhs (sparse matrices), I (incidence matrix).
A new ImplicationSet object.
add()Add a precomputed implication set
ImplicationSet$add(...)...An ImplicationSet object, a rules object, or a pair lhs, rhs of Set objects or dgCMatrix. The implications to add to this formal context.
Nothing, just updates the internal implications field.
to_arules()Convert to arules format
ImplicationSet$to_arules(quality = TRUE)quality(logical) Compute the interest measures for each rule?
A rules object as used by package arules.
A string with all the implications in the set.
support()Compute support of each implication
ImplicationSet$support()A vector with the support of each implication
closure()Compute the semantic closure of a fuzzy set with respect to the implication set
ImplicationSet$closure(S, reduce = FALSE, verbose = FALSE)S(a Set object) Fuzzy set to compute its closure. Use class Set to build it.
reduce(logical) Reduce the implications using simplification logic?
verbose(logical) Show verbose output?
If reduce == FALSE, the output is a fuzzy set corresponding to the closure of S. If reduce == TRUE, a list with two components: closure, with the closure as above, and implications, the reduced set of implications.
recommend()Generate a recommendation for a subset of the attributes
ImplicationSet$recommend(S, attribute_filter)S(a vector) Vector with the grades of each attribute (a fuzzy set).
attribute_filter(character vector) Names of the attributes to get recommendation for.
A fuzzy set describing the values of the attributes in attribute_filter within the closure of S.
apply_rules()Apply rules to remove redundancies
ImplicationSet$apply_rules(
rules = c("composition", "generalization"),
batch_size = 25000L,
parallelize = FALSE,
reorder = FALSE
)rules(character vector) Names of the rules to use. See details.
batch_size(integer) If the number of rules is large, apply the rules by batches of this size.
parallelize(logical) If possible, should we parallelize the computation among different batches?
reorder(logical) Should the rules be randomly reordered previous to the computation?
Currently, the implemented rules are "generalization", "simplification", "reduction" and "composition".
Nothing, just updates the internal matrices for LHS and RHS.
to_basis()Convert Implications to Canonical Basis
ImplicationSet$to_basis()The canonical basis of implications obtained from the current ImplicationSet
to_direct_optimal()Compute the Direct Optimal Basis using optimized C++ algorithms.
ImplicationSet$to_direct_optimal(
method = c("do_sp", "direct_optimal", "final_ts", "monotonic", "priority"),
verbose = FALSE
)method(character) The specific algorithm to run:
"direct_optimal": (Default) The Direct Optimal Saturation-Pruning algorithm.
"final_ts": Computes Transitive Closure then Prunes (Standard approach).
"monotonic": Incremental algorithm maintaining monotonicity.
"priority": Priority-based refinement algorithm.
verbose(logical) Print verbose output from the C++ backend.
Nothing, updates the ImplicationSet in place with the new basis.
use_logic()Sets the logic to use
ImplicationSet$use_logic(name = available_logics())nameThe name of the logic to use. To see the available names, run available_logics().
get_logic()Gets the logic used
ImplicationSet$get_logic()A string with the name of the logic.
use_hedge()Sets the hedge to use when computing closures
ImplicationSet$use_hedge(name = c("globalization", "identity"))nameThe name of the hedge to use. Only "globalization" and "identity" are allowed.
get_hedge()Gets the hedge used to compute closures
ImplicationSet$get_hedge()A string with the name of the hedge
to_json()Export the implication set to JSON
ImplicationSet$to_json(file = NULL, return_list = FALSE)file(character) The path of the file to save the JSON to.
return_list(logical) If TRUE, returns the list representation instead of the JSON string.
A JSON string representing the implication set, or a list if return_list is TRUE.
clone()The objects of this class are cloneable with this method.
ImplicationSet$clone(deep = FALSE)deepWhether to make a deep clone.