| fire {lfl} | R Documentation |
Evaluate rules and obtain truth-degrees
Description
Given truth degrees of predicates, compute the truth value of given list of rules.
Usage
fire(
x,
rules,
tnorm = c("goedel", "goguen", "lukasiewicz"),
onlyAnte = TRUE,
parallel = FALSE
)
Arguments
x |
Truth degrees of predicates. |
rules |
Either an object of S3 class |
tnorm |
A character string representing a triangular norm to be used
(either |
onlyAnte |
If |
parallel |
Deprecated parameter. Computation is done sequentially. |
Details
The aim of this function is to compute the truth value of each rule in a
rules list by assigning truth values to rule's predicates given by data x.
x is a numeric vector or numeric matrix of truth values of predicates. If
x is vector then names(x) must correspond to the predicate names
in rules. If x is a matrix then each column should represent a predicate
and thus colnames(x) must correspond to predicate names in rules.
Values of x are interpreted as truth values, i.e., they must be from the
interval [0, 1]. If matrix is given, the resulting truth values are
computed row-wisely.
rules may be a list of character vectors or an instance of the S3 class
farules(). The character vectors in the rules list represent formulae
in conjunctive form. If onlyAnte=FALSE, fire() treats the rule as
a conjunction of all predicates, i.e., a conjunction of all predicates is
computed. If onlyAnte=TRUE, the first element of each rule is removed
prior evaluation, i.e., a conjunction of all predicates except the first
are computed: this is useful if rules is a farules() object, since
farules() objects save a rule's consequent as the first element (see also
antecedents() and consequents() functions).
The type of conjunction to be computed can be specified with the tnorm parameter.
Value
If x is a matrix then the result of this function is a list
of numeric vectors with truth values of each rule, i.e., each element of the
resulting list corresponds to a rule and each value of the vector in the resulting
list corresponds to a row of the original data matrix x.
x as a vector is treated as a single-row matrix.
Author(s)
Michal Burda
See Also
aggregateConsequents(), defuzz(), perceive(), pbld(), fcut(), lcut(), farules()
Examples
# fire whole rules on a vector
x <- 1:10 / 10
names(x) <- letters[1:10]
rules <- list(c('a', 'c', 'e'),
c('b'),
c('d', 'a'),
c('c', 'a', 'b'))
fire(x, rules, tnorm='goguen', onlyAnte=FALSE)
# fire antecedents of the rules on a matrix
x <- matrix(1:20 / 20, nrow=2)
colnames(x) <- letters[1:10]
rules <- list(c('a', 'c', 'e'),
c('b'),
c('d', 'a'),
c('c', 'a', 'b'))
fire(x, rules, tnorm='goedel', onlyAnte=TRUE)
# the former command should be equal to
fire(x, antecedents(rules), tnorm='goedel', onlyAnte=FALSE)