Learn R Programming

fsr (version 1.0.2)

spa_creator: Building pgeometry objects from a point dataset

Description

This function builds a set of spatial plateau objects from a given point dataset assigned with domain-specific numerical values.

Usage

spa_creator(tbl, fuzz_policy = "fsp", const_policy = "voronoi", ...)

Value

A tibble in the format (class, pgeometry), where class is a character column and pgeometry is a list of pgeometry objects. This means that a spatial plateau object is created for representing a specific class of the point dataset.

Arguments

tbl

A data.frame or tibble with the following format: (x, y, z).

fuzz_policy

The fuzzification policy to be employed by the algorithm. See details below.

const_policy

The construction policy to be used by the algorithm. See details below.

...

<dynamic-dots> Parameters for the chosen policies. See details below.

Details

It follows the two-stage construction method described in the research paper of reference.

The input tbl is a point dataset where each point represents the location of a phenomenon treated by the application. Further, each point is annotated with numerical data that describe its meaning in the application. Therefore, tbl must have three columns: (x, y, z). The columns x, y are the pair of coordinates, and z is the column containing domain-specific numeric values.

fuzz_policy refers to the method used by the fuzzification stage. This stage aims to assign membership degrees to each point of the dataset. It accepts three possible values only: "fsp" (default), or "fcp".

"fsp" stands for fuzzy set policy and requires two parameters that should be informed in ...:

  • classes: A character vector containing the name of classes

  • mfs: A vector of membership functions generated by the function genmf of FuzzyR package. Each membership function i represents the class i, where i in length(classes)

"fcp" stands for fuzzy clustering policy and requires the e1071 package. Its possible parameters, informed in ..., are:

  • k: A numeric value that refers to the number of groups to be created

  • method: A fuzzy clustering method of the package e1071, which can be either "cmeans" (default) or "cshell"

  • use_coords: A Boolean value to indicate whether the columns (x, y) should be used in the clustering algorithm (default is FALSE)

  • iter: A numeric indicating the number of maximum iterations of the clustering algorithm (default is 100)

An optional and common parameter for both fuzzification stages is the "digits". This is an integer value that indicates the number of decimal digits of the membership degrees calculated by the fuzzification stage. That is, it is used to round membership degrees to the specified number of decimal places. Be careful with this optional parameter! If you specify a low value for "digits" some membership degrees could be rounded to 0 and thus, some components would not be created.

const_policy refers to the method used by the construction stage. This stage aims to create polygons from the labeled point dataset and use them to build spatial plateau objects. It accepts two possible values only: either "voronoi" (default) or "delaunay".

"voronoi" stands for Voronoi diagram policy and has one optional parameter that can be provided in ...:

  • base_poly: An sfg object that will be used to clip the generated polygons (optional argument). If this parameter is not provided, the Voronoi is created by using a bounding box (standard behavior of sf).

  • d_tolerance: It refers to the parameter dTolerance employed by the function st_voronoi of the package sf.

"delaunay" stands for Delaunay triangulation policy, which accepts the following parameters in ...:

  • base_poly: An sfg object that will be used to clip the generated triangles (optional argument).

  • tnorm: A t-norm used to calculate the membership degree of the triangle. It should be the name of a vector function. Possible values are "min" (default), and "prod". Note that it is possible to use your own t-norms. A t-norm should has the following signature: FUN(x) where x is a numeric vector. Such a function should return a single numeric value.

  • d_tolerance: It refers to the parameter dTolerance employed by the function st_triangulate of the package sf.

"convex_hull" stands for Convex hull policy, which accepts the following parameters in ...:

  • M: A numeric vector containing the membership degrees that will be used to create the components. The default is defined by seq(0.05, 1, by = 0.05).

  • d: A numeric value representing the tolerance distance to compute the membership degree between the elements of M and the membership degrees of the points. The default is 0.05.

  • base_poly: An sfg object that will be used to clip the generated polygons (optional argument).

References

Carniel, A. C.; Schneider, M. A Systematic Approach to Creating Fuzzy Region Objects from Real Spatial Data Sets. In Proceedings of the 2019 IEEE International Conference on Fuzzy Systems (FUZZ-IEEE 2019), pp. 1-6, 2019.

Examples

Run this code

library(tibble)
library(FuzzyR)

set.seed(7)
tbl = tibble(x = runif(10, min= 0, max = 30), 
             y = runif(10, min = 0, max = 50), 
             z = runif(10, min = 0, max = 100))
classes <- c("cold", "hot")
cold_mf <- genmf("trapmf", c(0, 10, 20, 35))
hot_mf <- genmf("trimf", c(35, 50, 100))

spa_creator(tbl, classes = classes, mfs = c(cold_mf, hot_mf))

spa_creator(tbl, fuzz_policy = "fcp", k = 4)

spa_creator(tbl, fuzz_policy = "fcp", k = 4, digits = 2)

spa_creator(tbl, fuzz_policy = "fcp", k = 3, const_policy = "delaunay")

spa_creator(tbl, fuzz_policy = "fcp", const_policy = "delaunay", k = 3, tnorm = "prod")

spa_creator(tbl, fuzz_policy = "fcp", k = 2, digits = 2, 
            M = seq(0.1, 1, by = 0.1), d = 0.05, const_policy = "convex_hull")
            
spa_creator(tbl, classes = classes, mfs = c(cold_mf, hot_mf), 
            digits = 2, const_policy = "convex_hull")

Run the code above in your browser using DataLab