FuzzySets-class: FuzzySets Class

Description Usage Arguments Details Value Author(s) See Also Examples

Description

The FuzzySets class extends the Sets class to implement a container that also describe different grades of membership in the interval [0,1].

Usage

1
2
FuzzySets(relations = DataFrame(element = character(0), set =
  character(0), membership = numeric(0)), ...)

Arguments

relations

DataFrame. At least 3 columns that provide mapping relationships between "element" and "set" identifiers, with "membership" function in the range [0,1]. Additional columns are taken as relation metadata.

...

Arguments passed to the Sets() constructor and other functions.

Details

This class does not define any additional slot to the Sets class. However, this class defines additional validity checks to ensure that every relation stored in a FuzzySets are associated with a numeric membership funtion in the interval [0,1].

Value

A FuzzySets object.

Author(s)

Kevin Rue-Albrecht

See Also

Sets, FuzzyHits, FuzzySets-methods.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Constructor ----

# Visually intuitive definition of sets, elements, and membership
sets <- list(
  set1=c("A"=0.1, "B"=0.2),
  set2=c("B"=0.3, "C"=0.4, "D"=0.5),
  set3=c("E"=0.8))

# unlist the set names
unlistSets <- rep(names(sets), lengths(sets))
# unlist the element names
unlistElements <- unlist(sapply(sets, names))
# unlist the membership values
unlistMembership <- unlist(sets)

# Reformat as a table
relations <- DataFrame(
  element=unlistElements,
  set=unlistSets,
  membership=unlistMembership
)

fs <- FuzzySets(relations=relations)

# Subsetting ----

fs1 <- subset(fs, set == "set1" | membership > 0.5)

# Coercing ----

# to list (gene sets)
ls1 <- as(fs, "list")
# to matrix (continuous membership)
m1 <- as(fs, "matrix")
# to matrix (multiple observations)
mm1 <- as.matrix(fs, fun.aggregate=min)

# Getters/Setters ----

membership(fs)

fs1 <- fs
membership(fs1) <- runif(length(fs1))

kevinrue/unisets documentation built on May 15, 2020, 10:48 p.m.