fsi_eval {fsr}R Documentation

Evaluate a point inference query

Description

fsi_eval() evaluates a point inference query. Considering an FSI model, it answers the following question: what is the inferred value for a given single point location?

Usage

fsi_eval(fsi, point, ...)

Arguments

fsi

An FSI model built with the fsi_create() and populated by fsi_add_fsa(), fsi_add_cs(), and fsi_add_rules().

point

An sfg object of the type POINT.

...

<dynamic-dots> Informs the fsi_eval how the elements of the resulting fuzzy set should be discretized if the user does not want the default configuration (see below). Default values: discret_by is 0.5 and discret_length is NULL.

Details

The fsi_eval() function evaluates a point inference query by using an FSI model populated with its fuzzy spatial antecedent, consequent, and fuzzy rules set. This evaluation is based on the algorithm specified by the references below.

The default behavior of fsi_eval() in the parameter ... is to consider a discrete interval of values with an increment of 0.5 between lower and upper values for the consequent domain (i.e., defined by fsi_add_cs() with the parameter bounds).

The user can modify the default behavior by using one of the following two ways:

Value

A numeric value that belongs to the domain of the consequent of the FSI model and represents the result of a point inference query

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 definitions on the evaluation of point inference queries are introduced in:

Examples

library(sf)

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

# Evaluating a point inference query
fsi_eval(fsi, st_point(c(-74.0, 40.7)))
## Not run: 
# Changing the default discretization
fsi_eval(fsi, st_point(c(-74.0, 40.7)), discret_by = 0.8)
fsi_eval(fsi, st_point(c(-74.0, 40.7)), discret_length = 200)

## End(Not run)

[Package fsr version 2.0.1 Index]