fsi_add_fsa()
adds a fuzzy spatial antecedent to a fuzzy spatial inference (FSI) model.
A fuzzy spatial antecedent corresponds to a layer of fuzzy spatial objects (i.e., spatial plateau objects) that describe the different characteristics of the problem.
The antecedent has a linguistic variable and its fuzzy spatial objects have linguistic values so that they are used in the IF part of fuzzy rules.
Arguments
- fsi
The FSI model instantiated with the
fsi_create()
function.- lvar
A character value that represents a linguistic variable of the antecedent.
- tbl
A tibble with spatial plateau objects annotated with linguistic values of the linguistic variable specified by the above
lvar
parameter.
Details
The fsi_add_fsa()
function adds a fuzzy spatial antecedent composed of a linguistic variable and its corresponding pgeometry
objects annotated by linguistic values.
The format of tbl
is the same as the output of the function spa_creator()
, allowing users to directly provide plateau region objects as input when designing FSI models.
Examples
library(tibble)
trap_mf <- function(a, b, c, d) {
function(x) {
pmax(pmin((x - a)/(b - a), 1, (d - x)/(d - c), na.rm = TRUE), 0)
}
}
trim_mf <- function(a, b, c) {
function(x) {
pmax(pmin((x - a)/(b - a), (c - x)/(c - b), na.rm = TRUE), 0)
}
}
# Creating spatial plateau objects for the linguistic variable "accommodation price"
lvals_accom_price <- c("cut-rate", "affordable", "expensive")
cut_rate_mf <- trap_mf(0, 0, 10, 48)
affordable_mf <- trap_mf(10, 48, 80, 115)
expensive_mf <- trap_mf(80, 115, 10000, 10000)
# Example of point dataset
accom_price <- tibble(longitude = c(-74.0, -74.0, -74.0),
latitude = c(40.8, 40.75, 40.7),
price = c(150, 76, 60))
accom_price_layer <- spa_creator(accom_price, classes = lvals_accom_price,
mfs = c(cut_rate_mf, affordable_mf, expensive_mf))
# Creating the FSI model
fsi <- fsi_create("To visit or not to visit, that is the question",
default_conseq = trim_mf(10, 30, 60))
# Adding the fuzzy spatial antecedent to the FSI model
fsi <- fsi_add_fsa(fsi, "accommodation price", accom_price_layer)