fsi_add_rules {fsr}R Documentation

Add fuzzy rules to an FSI model

Description

fsi_add_rules() adds the fuzzy rules set to a fuzzy spatial inference (FSI) model. A fuzzy rule must contain only linguistic variables and values included in the antecedent parts and consequent.

Usage

fsi_add_rules(fsi, rules, weights = rep(1, length(rules)))

Arguments

fsi

An FSI model instantiated with the fsi_create() function.

rules

A character vector containing the rules defined by the user. It follows a specific format, as detailed below.

weights

A numeric vector of weight values for each rule. Default values are 1.

Details

The fsi_add_rules() function adds fuzzy rules to an FSI model. The definition of a fuzzy rule is user-friendly since users can write it by using the linguistic variables and linguistic values previously defined and added to the FSI model (via fsi_add_fsa() and fsi_add_cs()).

A fuzzy rule has the format ⁠IF A THEN B⁠, where A is called the antecedent and B the consequent of the rule such that A implies B. Further, A and B are statements that combine fuzzy propositions by using logical connectives like AND or OR. Each fuzzy proposition has the format ⁠LVar is LVal⁠ where LVal is a linguistic value in the scope of the linguistic variable LVar.

To avoid possible contradictions keep in mind the following items when specifying the rules:

Value

An FSI model populated with a fuzzy rules set.

References

Carniel, A. C.; Galdino, F.; Philippsen, J. S.; Schneider, M. Handling Fuzzy Spatial Data in R Using the fsr Package. In Proceedings of the 29th International Conference on Advances in Geographic Information Systems (AM SIGSPATIAL 2021), pp. 526-535, 2021.

Underlying concepts and formal definitions of FSI models are introduced in:

Examples

# Creating the FSI model from an example
fsi <- visitation()

# Creating a vector of fuzzy rules
## note that we make use of the linguistic variables and linguistic values previously defined
rules <- c(
 "IF accommodation review is reasonable AND 
    food safety is low 
  THEN visiting experience is awful",
 "IF accommodation price is expensive AND 
    accommodation review is reasonable 
  THEN visiting experience is awful",
 "IF accommodation price is affordable AND 
    accommodation review is good AND 
    food safety is medium 
  THEN visiting experience is average",
 "IF accommodation price is affordable AND 
    accommodation review is excellent AND 
    food safety is high 
  THEN visiting experience is great",
 "IF accommodation price is cut-rate AND 
    accommodation review is excellent AND 
    food safety is high 
  THEN visiting experience is great")

# Adding these rules to the FSI model previously instantiated
fsi <- fsi_add_rules(fsi, rules)

[Package fsr version 2.0.1 Index]