/
stability_functions_corrected.R
153 lines (143 loc) · 5.61 KB
/
stability_functions_corrected.R
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#' @export
#' @title Stability Measure Lustgarten
#' @inherit stabilityDocumentation
#' @inherit correctedDocumentation
#' @details The stability measure is defined as (see Notation)
#' \deqn{\frac{2}{m (m - 1)} \sum_{i=1}^{m-1} \sum_{j = i+1}^m
#' \frac{|V_i \cap V_j| - \frac{|V_i| \cdot |V_j|}{p}}
#' {\min \{|V_i|, |V_j|\} - \max \{ 0, |V_i| + |V_j| - p \}}.}
#' @references
#' `r format_bib("Lustgarten2009", "Bommert2017", "BommertPHD")`
#' @encoding UTF-8
#' @md
#' @examples
#' feats = list(1:3, 1:4, 1:5)
#' stabilityLustgarten(features = feats, p = 10)
stabilityLustgarten = function(features, p, impute.na = NULL) {
stability(features = features, p = p, measure = "lustgarten",
correction.for.chance = "none",
N = NULL, impute.na = impute.na)
}
#' @export
#' @title Stability Measure Somol
#' @inherit stabilityDocumentation
#' @inherit correctedDocumentation
#' @details The stability measure is defined as (see Notation)
#' \deqn{\frac{\left(\sum\limits_{j=1}^p \frac{h_j}{q} \frac{h_j - 1}{m-1}\right) -
#' c_{\min}}{c_{\max} - c_{\min}}} with
#' \deqn{c_{\min} = \frac{q^2 - p(q - q \ \mathop{mod} \ p) - \left(q \ \mathop{mod} \ p\right)^2}{p q (m-1)},}
#' \deqn{c_{\max} = \frac{\left(q \ \mathop{mod} \ m\right)^2 + q(m-1) - \left(q \ \mathop{mod} \ m\right)m}{q(m-1)}.}
#' @references
#' `r format_bib("Somol2010", "Bommert2017", "BommertPHD")`
#' @encoding UTF-8
#' @md
#' @examples
#' feats = list(1:3, 1:4, 1:5)
#' stabilitySomol(features = feats, p = 10)
stabilitySomol = function(features, p, impute.na = NULL) {
stability(features = features, p = p, measure = "somol",
correction.for.chance = "none", N = NULL, impute.na = impute.na)
}
#' @export
#' @title Stability Measure Phi
#' @inherit stabilityDocumentation
#' @inherit correctedDocumentation
#' @details The stability measure is defined as the average
#' phi coefficient between all pairs of feature sets.
#' It can be rewritten as (see Notation)
#' \deqn{\frac{2}{m (m - 1)} \sum_{i=1}^{m-1} \sum_{j = i+1}^m
#' \frac{|V_i \cap V_j| - \frac{|V_i| \cdot |V_j|}{p}}
#' {\sqrt{|V_i| (1 - \frac{|V_i|}{p}) \cdot |V_j| (1 - \frac{|V_j|}{p})}}.}
#' @references
#' `r format_bib("Nogueira2016", "Bommert2017", "BommertPHD")`
#' @encoding UTF-8
#' @md
#' @examples
#' feats = list(1:3, 1:4, 1:5)
#' stabilityPhi(features = feats, p = 10)
stabilityPhi = function(features, p, impute.na = NULL) {
stability(features = features, p = p, measure = "phi.coefficient",
correction.for.chance = "none", N = NULL, impute.na = impute.na)
}
#' @export
#' @title Stability Measure Kappa
#' @inherit stabilityDocumentation
#' @inherit correctedDocumentation
#' @details The stability measure is defined as the average
#' kappa coefficient between all pairs of feature sets.
#' It can be rewritten as (see Notation)
#' \deqn{\frac{2}{m (m - 1)} \sum_{i=1}^{m-1} \sum_{j = i+1}^m
#' \frac{|V_i \cap V_j| - \frac{|V_i| \cdot |V_j|}{p}}
#' {\frac{|V_i| + |V_j|}{2} - \frac{|V_i| \cdot |V_j|}{p}}.}
#' @references
#' `r format_bib("Carletta1996", "BommertPHD")`
#' @encoding UTF-8
#' @md
#' @examples
#' feats = list(1:3, 1:4, 1:5)
#' stabilityKappa(features = feats, p = 10)
stabilityKappa = function(features, p, impute.na = NULL) {
stability(features = features, p = p, measure = "kappa.coefficient",
correction.for.chance = "none", N = NULL, impute.na = impute.na)
}
#' @export
#' @title Stability Measure Nogueira
#' @inherit stabilityDocumentation
#' @inherit correctedDocumentation
#' @details The stability measure is defined as (see Notation)
#' \deqn{1 - \frac{\frac{1}{p} \sum_{j=1}^p \frac{m}{m-1} \frac{h_j}{m} \left(1 - \frac{h_j}{m}\right)}
#' {\frac{q}{mp} (1 - \frac{q}{mp})}.}
#' @references
#' `r format_bib("Nogueira2018", "BommertPHD")`
#' @encoding UTF-8
#' @md
#' @examples
#' feats = list(1:3, 1:4, 1:5)
#' stabilityNogueira(features = feats, p = 10)
stabilityNogueira = function(features, p, impute.na = NULL) {
stability(features = features, p = p, measure = "nogueira",
correction.for.chance = "none", N = NULL, impute.na = impute.na)
}
#' @export
#' @title Stability Measure Unadjusted
#' @inherit stabilityDocumentation
#' @inherit correctedDocumentation
#' @details The stability measure is defined as (see Notation)
#' \deqn{\frac{2}{m (m - 1)} \sum_{i=1}^{m-1} \sum_{j = i+1}^m
#' \frac{|V_i \cap V_j| - \frac{|V_i| \cdot |V_j|}{p}}
#' {\sqrt{|V_i| \cdot |V_j|} - \frac{|V_i| \cdot |V_j|}{p}}.}
#' This is what \link{stabilityIntersectionMBM}, \link{stabilityIntersectionGreedy},
#' \link{stabilityIntersectionCount} and \link{stabilityIntersectionMean}
#' become, when there are no similar features.
#' @references
#' `r format_bib("Bommert2020", "BommertPHD")`
#' @encoding UTF-8
#' @md
#' @examples
#' feats = list(1:3, 1:4, 1:5)
#' stabilityUnadjusted(features = feats, p = 10)
stabilityUnadjusted = function(features, p, impute.na = NULL) {
stability(features = features, p = p, measure = "intersection.common",
correction.for.chance = "unadjusted",
N = NULL, impute.na = impute.na)
}
#' @export
#' @title Stability Measure Wald
#' @inherit stabilityDocumentation
#' @inherit correctedDocumentation
#' @details The stability measure is defined as (see Notation)
#' \deqn{\frac{2}{m (m - 1)} \sum_{i=1}^{m-1} \sum_{j = i+1}^m
#' \frac{|V_i \cap V_j| - \frac{|V_i| \cdot |V_j|}{p}}
#' {\min \{|V_i|, |V_j|\} - \frac{|V_i| \cdot |V_j|}{p}}.}
#' @references
#' `r format_bib("Wald2013", "BommertPHD")`
#' @encoding UTF-8
#' @md
#' @examples
#' feats = list(1:3, 1:4, 1:5)
#' stabilityWald(features = feats, p = 10)
stabilityWald = function(features, p, impute.na = NULL) {
stability(features = features, p = p, measure = "wald",
correction.for.chance = "none",
N = NULL, impute.na = impute.na)
}