fsi_qw_eval {fsr}R Documentation

Evaluate region inference methods

Description

fsi_qw_eval() implements two methods for evaluating region inference (RI) queries: (i) Linguistic value-based RI query, and (ii) Optimal RI query. The objective of these queries is to capture all points that intersect a search object (e.g., a query window) and whose inferred values fulfill some specific user requirements (e.g., the points with the maximum or minimum inferred values).

Usage

fsi_qw_eval(fsi, qw, approach = "discretization", ...)

Arguments

fsi

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

qw

An sfg object representing the search object (e.g., a query window). It has to be an axis-aligned rectangle represented by a simple polygon object of 5 points (since the last coordinate pair closes the external ring of the rectangle).

approach

Defines which approach is employed to perform the region inference: "discretization" or "pso". Default value is "discretization".

...

<dynamic-dots> Different set of parameters required depending on the chosen approach (see more in details below).

Details

The fsi_qw_eval() function evaluates two types of RI queries:

fsi_qw_eval() offers two different methods to answer these questions: (i) discretization method, and (ii) optimization method. Comparative analyses (see reference below) indicate that the discretization method should be employed to process linguistic value-based RI queries, while the optimization method is more adequate for processing optimal RI queries. The details below describe how to use these methods.

For the discretization method, two additional parameters are needed and must be informed by using the three-dots parameter ...:

The optimization method employs the particle swarm optimization (PSO) algorithm. Thus, the parameter approach = "pso" must be set together with the following parameters:

In addition, the PSO algorithm has its own set of parameters:

Value

A tibble in the format ⁠(points, inferred_values)⁠, where points is an sfc object and inferred_values are inferred values in the domain of the consequent of the FSI model.

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 region inference methods are explained 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)

# Defining the query window
pts_qw1 <- rbind(c(-73.92, 40.68527), c(-73.75, 40.68527), 
                 c(-73.75, 40.75), c(-73.92, 40.75), c(-73.92, 40.68527))
qw1 <- st_polygon(list(pts_qw1))

# Recall that our running example is based on a small set of point datasets
# This means that inferred values will likely be the same

## Not run: 
# Example using the discretization method
fsi_qw_eval(fsi, qw1, approach = "discretization", target_lval = "great", k = 25)

# Example using the optimization method
fsi_qw_eval(fsi, qw1, approach = "pso", max_depth = 2)

## End(Not run)

[Package fsr version 2.0.1 Index]