ropensci / BaseSet

Provides classes for working with sets
https://docs.ropensci.org/BaseSet
Other
10 stars 3 forks source link

rOpenSci review 1: Explain and justify fuzzy set theory #41

Closed llrs closed 4 years ago

llrs commented 4 years ago
  1. The theory behind the package (fuzzy set theory) needs much more explanation and justification. As it stands, I think most bioinformaticians and statisticians will misinterpret what the package is actually doing.
llrs commented 4 years ago

I'm not sure this package is the right place to justify the use of fuzzy set theory on one area (bioinformatics). I agree that if I only show the capabilities of the package it won't be compelling enough, that's one of the reason why I created a long vignette. I will explain better my reasoning of the fuzzy logic implemented on the package in a new section of the README or of a vignette to explain what is the fuzzy set logic, how it is implemented and differences with the typical sets.

llrs commented 4 years ago

especially where the fuzzy operators deviate from the more familiar probabilistic operators. Specifically, in probability theory, P(A or B) = P(A) + P(B) - P(A and B). In contrast, the fuzzy operator F(A or B) = max(F(A), F(B)). P(A or B) is the probability that A or B is true. In this context, it is the probability that an element is in set A or set B.

Let's work with this example.

set.seed(79321)
shape <- sample(c("square", "triangle", "circle", "hexagon"), 25, replace = TRUE)
col <- sample(c("blue", "red", "green", "white", "black"), 25, replace = TRUE)
sets <- sample(c("A", "B", "C"), 25, replace = TRUE)
rel <- data.frame(elements = letters[1:25], sets = sets, shape = shape, color = col)
TS <- tidySet(rel) %>%
    move_to("relations", "elements", "shape") %>%
    move_to("relations", "elements", "color") %>% 
    group(color == "blue", name = "blue") %>% 
    group(color == "red", name = "red") %>% 
    group(color == "white", name = "white") %>% 
    group(color == "black", name = "black") %>% 
    group(shape == "square", name = "square") %>% 
    group(shape == "triangle", name = "triangle") %>% 
    group(shape == "circle", name = "circle") %>% 
    group(shape == "hexagon", name = "hexagon")
TS %>% 
    set_size(set = c("A", "B"))
TS %>% 
    union(c("A", "B")) %>% 
    set_size()
TS %>% 
    set_size(set = c("circle", "white"))
TS %>% 
    union(c("circle", "white")) %>% 
    set_size()
TS %>% 
    filter_element(shape == "circle" & color == "white") #Error no element

How it would calculate P(A or B), what if instead of A and B we want to calculate circle-white or black-hexagon ?

llrs commented 4 years ago

Some references About cardinality: 1 2 membership Fuzzy sets: 1 2