aggregationslib 0.1.7__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/.gitignore +3 -0
- {aggregationslib-0.1.7/aggregationslib.egg-info → aggregationslib-0.2.0}/PKG-INFO +119 -22
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/README.md +86 -17
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/README.pl.md +25 -3
- aggregationslib-0.2.0/README.rst +297 -0
- aggregationslib-0.2.0/aggregationslib/__init__.py +47 -0
- aggregationslib-0.2.0/aggregationslib/aggregation.py +399 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/aggregationslib/aggregations.py +51 -0
- aggregationslib-0.2.0/aggregationslib/decimalaggregations.py +502 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0/aggregationslib.egg-info}/PKG-INFO +119 -22
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/aggregationslib.egg-info/SOURCES.txt +8 -2
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/aggregationslib.egg-info/scm_file_list.json +8 -2
- aggregationslib-0.2.0/aggregationslib.egg-info/scm_version.json +8 -0
- aggregationslib-0.2.0/assets/icons/icon.ico +0 -0
- aggregationslib-0.2.0/assets/icons/icon.png +0 -0
- aggregationslib-0.2.0/assets/icons/icon.svg +12 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/docs/en/index.html +1 -1
- aggregationslib-0.2.0/docs/fuzzy-integrals.md +179 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/docs/pl/index.html +1 -1
- aggregationslib-0.2.0/tests/data/wolfram_integral_reference.json +2648 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/tests/test_aggregations.py +16 -1
- aggregationslib-0.2.0/tests/test_decimal_fuzzy_integrals.py +186 -0
- aggregationslib-0.2.0/tests/test_fuzzy_integrals.py +175 -0
- aggregationslib-0.1.7/.github/workflows/python-publish.yml +0 -39
- aggregationslib-0.1.7/README.rst +0 -200
- aggregationslib-0.1.7/aggregationslib/aggregation.py +0 -203
- aggregationslib-0.1.7/aggregationslib/decimalaggregations.py +0 -256
- aggregationslib-0.1.7/aggregationslib.egg-info/scm_version.json +0 -8
- aggregationslib-0.1.7/tests/__init__.py +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/LICENSE +0 -0
- {aggregationslib-0.1.7/aggregationslib → aggregationslib-0.2.0/aggregationslib/conjuctive}/__init__.py +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/aggregationslib/conjuctive/purepython.py +0 -0
- {aggregationslib-0.1.7/aggregationslib/conjuctive → aggregationslib-0.2.0/aggregationslib/disjunctive}/__init__.py +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/aggregationslib/example.py +0 -0
- {aggregationslib-0.1.7/aggregationslib/disjunctive → aggregationslib-0.2.0/aggregationslib/feature_selection}/__init__.py +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/aggregationslib/feature_selection/binary_fuzzy_entropy.py +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/aggregationslib/feature_selection/fuzzy_com_entropy.py +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/aggregationslib/models/__init__.py +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/aggregationslib/models/ensemble/__init__.py +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/aggregationslib/models/ensemble/aggregation_regressor.py +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/aggregationslib/models/single/__init__.py +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/aggregationslib/purepython.py +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/aggregationslib.egg-info/dependency_links.txt +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/aggregationslib.egg-info/requires.txt +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/aggregationslib.egg-info/top_level.txt +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/build_docs.ps1 +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/commands.md +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/docs/.nojekyll +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/docs/aggregation-classes.md +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/docs/aggregation-plots.md +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/docs/assets/aggregation-surfaces-all.png +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/docs/assets/aggregation-surfaces.png +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/docs/assets/aggregations/A_amn_p=0.5.png +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/docs/assets/aggregations/A_amx_p=0.5.png +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/docs/assets/aggregations/A_ar.png +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/docs/assets/aggregations/A_ex2_p=2,q=2.png +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/docs/assets/aggregations/A_ex3_p=2,q=1.5.png +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/docs/assets/aggregations/A_ex_r=1.png +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/docs/assets/aggregations/A_gm.png +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/docs/assets/aggregations/A_hm.png +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/docs/assets/aggregations/A_lm_r=2.png +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/docs/assets/aggregations/A_lo.png +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/docs/assets/aggregations/A_md.png +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/docs/assets/aggregations/A_mn.png +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/docs/assets/aggregations/A_mx.png +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/docs/assets/aggregations/A_ol.png +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/docs/assets/aggregations/A_oln_p=1.png +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/docs/assets/aggregations/A_pr.png +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/docs/assets/aggregations/A_pw_r=2.png +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/docs/assets/aggregations/A_qd.png +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/docs/assets/site.css +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/docs/index.html +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/generate_aggregation_plots.py +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/pyproject.toml +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/setup.cfg +0 -0
- {aggregationslib-0.1.7/aggregationslib/feature_selection → aggregationslib-0.2.0/tests}/__init__.py +0 -0
- {aggregationslib-0.1.7 → aggregationslib-0.2.0}/tests/test_decimal_exponential_mean.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aggregationslib
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Python implementation of Arithmetic, quasi arithmetic and other aggregating functions
|
|
5
5
|
Author: wgalka
|
|
6
6
|
Project-URL: Homepage, https://github.com/wgalka/Means
|
|
@@ -23,17 +23,19 @@ Dynamic: license-file
|
|
|
23
23
|
Means
|
|
24
24
|
=====
|
|
25
25
|
|
|
26
|
-
Means, Aggregation functions
|
|
26
|
+
Means, Aggregation functions...
|
|
27
27
|
|
|
28
28
|
Documentation:
|
|
29
29
|
|
|
30
30
|
- English: https://wgalka.github.io/Means/en/
|
|
31
31
|
- Polski: https://wgalka.github.io/Means/pl/
|
|
32
32
|
|
|
33
|
-
Aggregations functions are:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
Aggregations functions are:
|
|
34
|
+
|
|
35
|
+
- Conjuctive - the final aggregated value will always be influenced by
|
|
36
|
+
the smallest value among the inputs.
|
|
37
|
+
- Disjnuctive - the aggregated value will always be influenced by the
|
|
38
|
+
largest value among the inputs.
|
|
37
39
|
|
|
38
40
|
Example 1:
|
|
39
41
|
^^^^^^^^^^
|
|
@@ -56,7 +58,7 @@ Example2:
|
|
|
56
58
|
^^^^^^^^^
|
|
57
59
|
|
|
58
60
|
To get information about aggregation function you can use ``__str__()``
|
|
59
|
-
or
|
|
61
|
+
or '**repr**\ ()' methods.
|
|
60
62
|
|
|
61
63
|
.. code:: pycon
|
|
62
64
|
|
|
@@ -75,19 +77,67 @@ or ‘**repr**\ ()’ methods.
|
|
|
75
77
|
Aggregation functions
|
|
76
78
|
---------------------
|
|
77
79
|
|
|
78
|
-
|
|
79
|
-
:math:`n \in \mathbb{N}`,
|
|
80
|
-
|
|
81
|
-
:math:`A(1,\dots,1) = 1`.
|
|
80
|
+
An aggregation function on the unit interval [1] is an increasing
|
|
81
|
+
mapping :math:`A:[0,1]^n\to[0,1]`, :math:`n \in \mathbb{N}`,
|
|
82
|
+
:math:`n\ge 2`, satisfying :math:`A(0,\dots,0) = 0` and
|
|
83
|
+
:math:`A(1,\dots,1) = 1`. For inputs on another interval
|
|
84
|
+
:math:`[a,b]\subset\mathbb{R}`, an :math:`[a,b]`-aggregation is an
|
|
85
|
+
increasing mapping :math:`A:[a,b]^n\to[a,b]` satisfying
|
|
86
|
+
:math:`A(a,\dots,a)=a` and :math:`A(b,\dots,b)=b`.
|
|
87
|
+
|
|
88
|
+
The following aggregation functions are implemented in this library.
|
|
89
|
+
Tags describe properties of each formula. ``averaging`` means the result
|
|
90
|
+
lies between the minimum and maximum inputs; ``conjunctive`` means it
|
|
91
|
+
does not exceed the minimum; ``symmetric`` means permuting the inputs
|
|
92
|
+
does not change the result. ``aggregation interval`` states the
|
|
93
|
+
intervals on which the formula is an aggregation function: an increasing
|
|
94
|
+
map :math:`A:[a,b]^n\to[a,b]` satisfying :math:`A(a,\dots,a)=a` and
|
|
95
|
+
:math:`A(b,\dots,b)=b`. ``any [a,b] ⊂ ℝ`` includes intervals with
|
|
96
|
+
negative values; ``any [a,b] ⊆ [0,∞)`` is restricted to nonnegative
|
|
97
|
+
intervals. ``[0,1]`` means only the unit interval. These are
|
|
98
|
+
mathematical properties; most callable objects do not validate input
|
|
99
|
+
bounds at runtime. Some tags depend on parameters or the fuzzy measure.
|
|
100
|
+
|
|
101
|
+
:math:`\mathbf{A_{ch}^{(\mu)}}` **- Choquet integral [1]**
|
|
102
|
+
|
|
103
|
+
Tags: ``averaging`` ``aggregation interval: [0,1]``
|
|
104
|
+
``symmetric if μ is symmetric``
|
|
105
|
+
|
|
106
|
+
For an input vector :math:`(x_1,\dots,x_n)\in[0,1]^n`, let
|
|
107
|
+
:math:`\sigma` sort its indices so that
|
|
108
|
+
:math:`x_{\sigma(1)} \leq \dots \leq x_{\sigma(n)}`. Define
|
|
109
|
+
:math:`A_i=\{\sigma(i),\dots,\sigma(n)\}` and :math:`x_{\sigma(0)}=0`:
|
|
110
|
+
|
|
111
|
+
.. math:: A_{ch}^{(\mu)}(x_1,\dots,x_n)=\sum_{i=1}^{n}(x_{\sigma(i)}-x_{\sigma(i-1)})\,\mu(A_i)
|
|
112
|
+
|
|
113
|
+
With the default cardinality measure :math:`\mu(A)=|A|/n`, this is the
|
|
114
|
+
arithmetic mean,
|
|
115
|
+
:math:`A_{ch}^{(\mu)}(x_1,\dots,x_n)=\frac{1}{n}\sum_{i=1}^{n}x_i`.
|
|
116
|
+
|
|
117
|
+
:math:`\mathbf{A_{sg}^{(\mu)}}` **- Sugeno integral [1]**
|
|
82
118
|
|
|
83
|
-
|
|
119
|
+
Tags: ``averaging`` ``aggregation interval: [0,1]``
|
|
120
|
+
``symmetric if μ is symmetric``
|
|
121
|
+
|
|
122
|
+
For an input vector :math:`(x_1,\dots,x_n)\in[0,1]^n`, let
|
|
123
|
+
:math:`\sigma` sort its indices so that
|
|
124
|
+
:math:`x_{\sigma(1)} \leq \dots \leq x_{\sigma(n)}`, and define
|
|
125
|
+
:math:`A_i=\{\sigma(i),\dots,\sigma(n)\}`:
|
|
126
|
+
|
|
127
|
+
.. math:: A_{sg}^{(\mu)}(x_1,\dots,x_n)=\max_{1\leq i\leq n}\min(x_{\sigma(i)},\mu(A_i))
|
|
84
128
|
|
|
85
129
|
:math:`\mathbf{A_{ar}}` **- Arithmetic mean**
|
|
86
130
|
|
|
131
|
+
Tags: ``averaging`` ``symmetric``
|
|
132
|
+
``aggregation interval: any [a,b] ⊂ ℝ``
|
|
133
|
+
|
|
87
134
|
.. math:: A_{ar}(x_1,...,x_n)=\frac{1}{n}\sum \limits_{k=1}^{n} x_k
|
|
88
135
|
|
|
89
136
|
:math:`\mathbf{A_{qd}}` **- Quadratic mean**
|
|
90
137
|
|
|
138
|
+
Tags: ``averaging`` ``symmetric``
|
|
139
|
+
``aggregation interval: any [a,b] ⊆ [0,∞)``
|
|
140
|
+
|
|
91
141
|
.. math::
|
|
92
142
|
|
|
93
143
|
A_{qd}(x_1,...,x_n)=\sqrt{\frac{1}{n}\sum
|
|
@@ -95,10 +145,15 @@ The floowoing aggregation functions are implemented in this library:
|
|
|
95
145
|
|
|
96
146
|
:math:`\mathbf{A_{pr}}` **- Product aggregation**
|
|
97
147
|
|
|
148
|
+
Tags: ``conjunctive`` ``symmetric`` ``aggregation interval: [0,1]``
|
|
149
|
+
|
|
98
150
|
.. math:: A_{pr}(x_1, x_2, \dots, x_n) = \prod_{k=1}^n x_k
|
|
99
151
|
|
|
100
152
|
:math:`\mathbf{A_{gm}}` **- Geometric mean**
|
|
101
153
|
|
|
154
|
+
Tags: ``averaging`` ``symmetric``
|
|
155
|
+
``aggregation interval: any [a,b] ⊆ [0,∞)``
|
|
156
|
+
|
|
102
157
|
.. math::
|
|
103
158
|
|
|
104
159
|
A_{gm}(x_1,...,x_n)=\sqrt[n]{\prod
|
|
@@ -106,6 +161,9 @@ The floowoing aggregation functions are implemented in this library:
|
|
|
106
161
|
|
|
107
162
|
:math:`\mathbf{A_{hm}}` **- Harmonic mean**
|
|
108
163
|
|
|
164
|
+
Tags: ``averaging`` ``symmetric``
|
|
165
|
+
``aggregation interval: any [a,b] ⊆ [0,∞)``
|
|
166
|
+
|
|
109
167
|
.. math::
|
|
110
168
|
|
|
111
169
|
|
|
@@ -117,6 +175,9 @@ The floowoing aggregation functions are implemented in this library:
|
|
|
117
175
|
|
|
118
176
|
:math:`\mathbf{A_{pw}^{(r)}}` **- Power mean**
|
|
119
177
|
|
|
178
|
+
Tags: ``averaging`` ``symmetric``
|
|
179
|
+
``aggregation interval: any [a,b] ⊆ [0,∞)`` ``r ≠ 0``
|
|
180
|
+
|
|
120
181
|
.. math::
|
|
121
182
|
|
|
122
183
|
|
|
@@ -126,29 +187,40 @@ The floowoing aggregation functions are implemented in this library:
|
|
|
126
187
|
\Big(\frac{1}{n} \sum\limits_{k=1}^{n} x_k^r \Big)^{\frac{1}{r}}, & \text{otherwise}
|
|
127
188
|
\end{cases}
|
|
128
189
|
|
|
129
|
-
special cases of power means :math:`A_{\text{pw}}^r` [1] are:
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
190
|
+
special cases of power means :math:`A_{\text{pw}}^r` [1] are:
|
|
191
|
+
|
|
192
|
+
- Arithmetic Mean where r=1;
|
|
193
|
+
- Quadratic Mean where r=2;
|
|
194
|
+
- Harmonic Mean where r=-1;
|
|
195
|
+
- Geometric Mean obtained as the limit
|
|
196
|
+
:math:`\lim_{r \to 0} A_{\text{pw}}^r`.
|
|
133
197
|
|
|
134
198
|
--------------
|
|
135
199
|
|
|
136
200
|
:math:`\mathbf{A_{ex}^{(r)}}` **- Exponential mean**
|
|
137
201
|
|
|
202
|
+
Tags: ``averaging`` ``symmetric``
|
|
203
|
+
``aggregation interval: any [a,b] ⊂ ℝ`` ``r ≠ 0``
|
|
204
|
+
|
|
138
205
|
.. math::
|
|
139
206
|
|
|
140
207
|
A_{ex}^{(r)}(x_1,...,x_n)= \frac{1}{r}\ln
|
|
141
208
|
\Big(\frac{1}{n} \sum \limits_{k=1}^{n} e^{rx_k}\Big), \text{where
|
|
142
209
|
} r \in \mathbb{R}, r \neq 0
|
|
143
210
|
|
|
144
|
-
For computer implementations, to avoid numerical instability (overflow
|
|
211
|
+
For computer implementations, to avoid numerical instability (overflow
|
|
212
|
+
when :math:`r x_k > 709.78` or underflow when all
|
|
213
|
+
:math:`r x_k < -709.78`), we use a numerically stable Log-Sum-Exp
|
|
214
|
+
formulation by shifting the exponents by
|
|
215
|
+
:math:`a_{max} = \max_{j} (r x_j)`:
|
|
145
216
|
|
|
146
|
-
.. math::
|
|
147
|
-
|
|
148
|
-
A_{ex}^{(r)}(x_1,...,x_n) = \frac{1}{r} \left[ a_{max} + \ln \left( \sum_{i=1}^n e^{r x_i - a_{max}} \right) - \ln(n) \right]
|
|
217
|
+
.. math:: A_{ex}^{(r)}(x_1,...,x_n) = \frac{1}{r} \left[ a_{max} + \ln \left( \sum_{i=1}^n e^{r x_i - a_{max}} \right) - \ln(n) \right]
|
|
149
218
|
|
|
150
219
|
:math:`\mathbf{A_{lm}}` **- Lehmer mean**
|
|
151
220
|
|
|
221
|
+
Tags: ``averaging`` ``symmetric``
|
|
222
|
+
``aggregation interval: any [a,b] ⊆ [0,∞) if 0 ≤ r ≤ 1``
|
|
223
|
+
|
|
152
224
|
.. math::
|
|
153
225
|
|
|
154
226
|
A_{lm}(x_1,...,x_n)= \begin{cases}
|
|
@@ -158,6 +230,9 @@ For computer implementations, to avoid numerical instability (overflow when :mat
|
|
|
158
230
|
|
|
159
231
|
:math:`\mathbf{A_{amn}^{(p)}}` **- Arithmetic minimum mean**
|
|
160
232
|
|
|
233
|
+
Tags: ``averaging`` ``symmetric`` ``conjunctive if p = 0``
|
|
234
|
+
``aggregation interval: any [a,b] ⊂ ℝ`` ``p ∈ [0,1]``
|
|
235
|
+
|
|
161
236
|
.. math::
|
|
162
237
|
|
|
163
238
|
A_{amn}^{(p)}(x_1,...,x_n)=\frac{p}{n}\sum \limits_{k=1}^{n} x_k+
|
|
@@ -165,6 +240,9 @@ For computer implementations, to avoid numerical instability (overflow when :mat
|
|
|
165
240
|
|
|
166
241
|
:math:`\mathbf{A_{amx}^{(p)}}` **- Arithmetic maximum mean**
|
|
167
242
|
|
|
243
|
+
Tags: ``averaging`` ``symmetric`` ``disjunctive if p = 0``
|
|
244
|
+
``aggregation interval: any [a,b] ⊂ ℝ`` ``p ∈ [0,1]``
|
|
245
|
+
|
|
168
246
|
.. math::
|
|
169
247
|
|
|
170
248
|
A_{amx}^{(p)}(x_1,...,x_n)=\frac{p}{n}\sum \limits_{k=1}^{n} x_k+
|
|
@@ -179,6 +257,9 @@ case of calculating the arithmetic mean of the given values.
|
|
|
179
257
|
|
|
180
258
|
:math:`\mathbf{A_{md}}` **- Median - ordered weighted aggregation**
|
|
181
259
|
|
|
260
|
+
Tags: ``averaging`` ``symmetric``
|
|
261
|
+
``aggregation interval: any [a,b] ⊂ ℝ``
|
|
262
|
+
|
|
182
263
|
.. math::
|
|
183
264
|
|
|
184
265
|
A_{md}(x_1,\dots,x_n) =
|
|
@@ -189,10 +270,16 @@ case of calculating the arithmetic mean of the given values.
|
|
|
189
270
|
|
|
190
271
|
:math:`\mathbf{A_{ol}}` **- Olimpic aggregation**
|
|
191
272
|
|
|
273
|
+
Tags: ``averaging`` ``symmetric``
|
|
274
|
+
``aggregation interval: any [a,b] ⊂ ℝ``
|
|
275
|
+
|
|
192
276
|
.. math:: A_{ol}(x_1,\dots,x_n) = \frac{1}{n-2} \sum \limits_{k=2}^{n-1} y_k, \quad \text{where } \{y_1, \dots, y_n\} = \{x_1, \dots, x_n\},\ y_1 \leq y_2 \leq \dots \leq y_n.
|
|
193
277
|
|
|
194
278
|
:math:`\mathbf{A_{oln}^{(p)}}` **- Olimpic aggregation**
|
|
195
279
|
|
|
280
|
+
Tags: ``averaging`` ``symmetric``
|
|
281
|
+
``aggregation interval: any [a,b] ⊂ ℝ`` ``p ∈ ℕ, p ≥ 1``
|
|
282
|
+
|
|
196
283
|
We can specify how many greatest and smallest records remove
|
|
197
284
|
|
|
198
285
|
.. math:: A_{oln}^{(p)}(x_1,\dots,x_n) = \frac{1}{n-2p} \sum \limits_{k=p+1}^{n-p} y_k, \quad \text{where } \{y_1, \dots, y_n\} = \{x_1, \dots, x_n\},\ y_1 \leq y_2 \leq \dots \leq y_n, p \in \mathbb{N}, p\geq 1
|
|
@@ -201,14 +288,24 @@ We can specify how many greatest and smallest records remove
|
|
|
201
288
|
|
|
202
289
|
:math:`\mathbf{A_{ln}}` **- Logaritmic aggregation [2]**
|
|
203
290
|
|
|
291
|
+
Tags: ``averaging (continuous formula)`` ``symmetric``
|
|
292
|
+
``aggregation interval (after continuous extension): any [a,b] ⊂ (0,∞)``
|
|
293
|
+
|
|
204
294
|
.. math::
|
|
205
295
|
|
|
206
296
|
|
|
207
297
|
A_{ln}\left(x_1, x_2, \ldots, x_n\right)=(n-1) ! \sum_{i=1}^n \frac{x_i}{\prod_{\substack{j=1 \\ j \neq i}}^n \log \left(x_i / x_j\right)}
|
|
208
298
|
|
|
299
|
+
The formula has a continuous averaging extension when input values
|
|
300
|
+
coincide, but the current implementation does not handle ties: a zero
|
|
301
|
+
denominator makes it return ``0``.
|
|
302
|
+
|
|
209
303
|
:math:`\mathbf{A^{(p)}_{A_1,A_2}}` - Convex combinations of aggregation functions
|
|
210
304
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
211
305
|
|
|
306
|
+
Tags: ``aggregation interval: common interval of A₁ and A₂``
|
|
307
|
+
``averaging if both inputs are averaging`` ``p ∈ [0,1]``
|
|
308
|
+
|
|
212
309
|
We can construct covex combination of aggregation functions as
|
|
213
310
|
:math:`A^{(p)}_{A_1,A_2}=pA_1+(1-p)A_2`, where :math:`A_1, A_2` are
|
|
214
311
|
aggregation functions and :math:`p \in [0,1]`.
|
|
@@ -216,7 +313,7 @@ aggregation functions and :math:`p \in [0,1]`.
|
|
|
216
313
|
References
|
|
217
314
|
----------
|
|
218
315
|
|
|
219
|
-
1. Beliakov, G., Bustince, H., and Calvo, T.: A
|
|
220
|
-
Averaging Functions
|
|
316
|
+
1. Beliakov, G., Bustince, H., and Calvo, T.: *A Practical Guide to
|
|
317
|
+
Averaging Functions*. Berlin: Springer, vol. 329, 2016.
|
|
221
318
|
2. `Mustonen, Seppo. (2010). Logarithmic mean for several
|
|
222
319
|
arguments. <https://www.researchgate.net/publication/228886844_Logarithmic_mean_for_several_arguments>`__
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
# Means
|
|
2
|
-
Means, Aggregation functions...
|
|
3
|
-
|
|
4
|
-
Documentation:
|
|
5
|
-
|
|
6
|
-
- English: https://wgalka.github.io/Means/en/
|
|
7
|
-
- Polski: https://wgalka.github.io/Means/pl/
|
|
8
|
-
|
|
9
|
-
Aggregations functions are:
|
|
10
|
-
- Conjuctive - the final aggregated value will always be influenced by the smallest value among the inputs.
|
|
11
|
-
- Disjnuctive - the aggregated value will always be influenced by the largest value among the inputs.
|
|
1
|
+
# Means
|
|
2
|
+
Means, Aggregation functions...
|
|
3
|
+
|
|
4
|
+
Documentation:
|
|
5
|
+
|
|
6
|
+
- English: https://wgalka.github.io/Means/en/
|
|
7
|
+
- Polski: https://wgalka.github.io/Means/pl/
|
|
8
|
+
|
|
9
|
+
Aggregations functions are:
|
|
10
|
+
- Conjuctive - the final aggregated value will always be influenced by the smallest value among the inputs.
|
|
11
|
+
- Disjnuctive - the aggregated value will always be influenced by the largest value among the inputs.
|
|
12
12
|
|
|
13
13
|
#### Example 1:
|
|
14
14
|
|
|
@@ -47,32 +47,77 @@ print(func3.__repr__()) # function parameters are printed in order: func1, func2
|
|
|
47
47
|
|
|
48
48
|
## Aggregation functions
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
$A:[0,1]^n\to[0,1]$, $n \in \mathbb{N}$, $n\ge 2
|
|
52
|
-
|
|
50
|
+
An aggregation function on the unit interval [1] is an increasing mapping
|
|
51
|
+
$A:[0,1]^n\to[0,1]$, $n \in \mathbb{N}$, $n\ge 2$, satisfying
|
|
52
|
+
$A(0,\dots,0) = 0$ and $A(1,\dots,1) = 1$. For inputs on another interval
|
|
53
|
+
$[a,b]\subset\mathbb{R}$, an $[a,b]$-aggregation is an increasing mapping
|
|
54
|
+
$A:[a,b]^n\to[a,b]$ satisfying $A(a,\dots,a)=a$ and $A(b,\dots,b)=b$.
|
|
55
|
+
|
|
56
|
+
The following aggregation functions are implemented in this library. Tags
|
|
57
|
+
describe properties of each formula. `averaging` means the result lies between
|
|
58
|
+
the minimum and maximum inputs; `conjunctive` means it does not exceed the
|
|
59
|
+
minimum; `symmetric` means permuting the inputs does not change the result.
|
|
60
|
+
`aggregation interval` states the intervals on which the formula is an
|
|
61
|
+
aggregation function: an increasing map $A:[a,b]^n\to[a,b]$ satisfying
|
|
62
|
+
$A(a,\dots,a)=a$ and $A(b,\dots,b)=b$. `any [a,b] ⊂ ℝ` includes intervals
|
|
63
|
+
with negative values; `any [a,b] ⊆ [0,∞)` is restricted to nonnegative
|
|
64
|
+
intervals. `[0,1]` means only the unit interval. These are mathematical
|
|
65
|
+
properties; most callable objects do not validate input bounds at runtime.
|
|
66
|
+
Some tags depend on parameters or the fuzzy measure.
|
|
67
|
+
|
|
68
|
+
$\mathbf{A_{ch}^{(\mu)}}$ **- Choquet integral [1]**
|
|
69
|
+
|
|
70
|
+
Tags: `averaging` `aggregation interval: [0,1]` `symmetric if μ is symmetric`
|
|
71
|
+
|
|
72
|
+
For an input vector $(x_1,\dots,x_n)\in[0,1]^n$, let $\sigma$
|
|
73
|
+
sort its indices so that $x_{\sigma(1)} \leq \dots \leq x_{\sigma(n)}$.
|
|
74
|
+
Define $A_i=\{\sigma(i),\dots,\sigma(n)\}$ and $x_{\sigma(0)}=0$:
|
|
75
|
+
|
|
76
|
+
$$A_{ch}^{(\mu)}(x_1,\dots,x_n)=\sum_{i=1}^{n}(x_{\sigma(i)}-x_{\sigma(i-1)})\,\mu(A_i)$$
|
|
53
77
|
|
|
54
|
-
|
|
78
|
+
With the default cardinality measure $\mu(A)=|A|/n$, this is the arithmetic
|
|
79
|
+
mean, $A_{ch}^{(\mu)}(x_1,\dots,x_n)=\frac{1}{n}\sum_{i=1}^{n}x_i$.
|
|
80
|
+
|
|
81
|
+
$\mathbf{A_{sg}^{(\mu)}}$ **- Sugeno integral [1]**
|
|
82
|
+
|
|
83
|
+
Tags: `averaging` `aggregation interval: [0,1]` `symmetric if μ is symmetric`
|
|
84
|
+
|
|
85
|
+
For an input vector $(x_1,\dots,x_n)\in[0,1]^n$, let $\sigma$ sort its indices
|
|
86
|
+
so that $x_{\sigma(1)} \leq \dots \leq x_{\sigma(n)}$, and define
|
|
87
|
+
$A_i=\{\sigma(i),\dots,\sigma(n)\}$:
|
|
88
|
+
|
|
89
|
+
$$A_{sg}^{(\mu)}(x_1,\dots,x_n)=\max_{1\leq i\leq n}\min(x_{\sigma(i)},\mu(A_i))$$
|
|
55
90
|
|
|
56
91
|
$\mathbf{A_{ar}}$ **- Arithmetic mean**
|
|
57
92
|
|
|
93
|
+
Tags: `averaging` `symmetric` `aggregation interval: any [a,b] ⊂ ℝ`
|
|
94
|
+
|
|
58
95
|
$$A_{ar}(x_1,...,x_n)=\frac{1}{n}\sum \limits_{k=1}^{n} x_k$$
|
|
59
96
|
|
|
60
97
|
$\mathbf{A_{qd}}$ **- Quadratic mean**
|
|
61
98
|
|
|
99
|
+
Tags: `averaging` `symmetric` `aggregation interval: any [a,b] ⊆ [0,∞)`
|
|
100
|
+
|
|
62
101
|
$$A_{qd}(x_1,...,x_n)=\sqrt{\frac{1}{n}\sum
|
|
63
102
|
\limits_{k=1}^{n} x_k^2}$$
|
|
64
103
|
|
|
65
104
|
$\mathbf{A_{pr}}$ **- Product aggregation**
|
|
66
105
|
|
|
106
|
+
Tags: `conjunctive` `symmetric` `aggregation interval: [0,1]`
|
|
107
|
+
|
|
67
108
|
$$A_{pr}(x_1, x_2, \dots, x_n) = \prod_{k=1}^n x_k$$
|
|
68
109
|
|
|
69
110
|
$\mathbf{A_{gm}}$ **- Geometric mean**
|
|
70
111
|
|
|
112
|
+
Tags: `averaging` `symmetric` `aggregation interval: any [a,b] ⊆ [0,∞)`
|
|
113
|
+
|
|
71
114
|
$$A_{gm}(x_1,...,x_n)=\sqrt[n]{\prod
|
|
72
115
|
\limits_{k=1}^{n} x_k}$$
|
|
73
116
|
|
|
74
117
|
$\mathbf{A_{hm}}$ **- Harmonic mean**
|
|
75
118
|
|
|
119
|
+
Tags: `averaging` `symmetric` `aggregation interval: any [a,b] ⊆ [0,∞)`
|
|
120
|
+
|
|
76
121
|
$$
|
|
77
122
|
A_{hm}(x_1,...,x_n) =
|
|
78
123
|
\begin{cases}
|
|
@@ -84,6 +129,8 @@ $$
|
|
|
84
129
|
|
|
85
130
|
$\mathbf{A_{pw}^{(r)}}$ **- Power mean**
|
|
86
131
|
|
|
132
|
+
Tags: `averaging` `symmetric` `aggregation interval: any [a,b] ⊆ [0,∞)` `r ≠ 0`
|
|
133
|
+
|
|
87
134
|
$$
|
|
88
135
|
A_{pw}^{(r)}(x_1,...,x_n) =
|
|
89
136
|
\begin{cases}
|
|
@@ -104,6 +151,8 @@ special cases of power means $A_{\text{pw}}^r$ [1] are:
|
|
|
104
151
|
|
|
105
152
|
$\mathbf{A_{ex}^{(r)}}$ **- Exponential mean**
|
|
106
153
|
|
|
154
|
+
Tags: `averaging` `symmetric` `aggregation interval: any [a,b] ⊂ ℝ` `r ≠ 0`
|
|
155
|
+
|
|
107
156
|
$$A_{ex}^{(r)}(x_1,...,x_n)= \frac{1}{r}\ln
|
|
108
157
|
\Big(\frac{1}{n} \sum \limits_{k=1}^{n} e^{rx_k}\Big), \text{where
|
|
109
158
|
} r \in \mathbb{R}, r \neq 0$$
|
|
@@ -114,6 +163,8 @@ $$A_{ex}^{(r)}(x_1,...,x_n) = \frac{1}{r} \left[ a_{max} + \ln \left( \sum_{i=1}
|
|
|
114
163
|
|
|
115
164
|
$\mathbf{A_{lm}}$ **- Lehmer mean**
|
|
116
165
|
|
|
166
|
+
Tags: `averaging` `symmetric` `aggregation interval: any [a,b] ⊆ [0,∞) if 0 ≤ r ≤ 1`
|
|
167
|
+
|
|
117
168
|
$$A_{lm}(x_1,...,x_n)= \begin{cases}
|
|
118
169
|
0, & r\leq 1, \exists_{1 \leq k \leq n} x^{k} = 0 \\
|
|
119
170
|
\frac{\sum \limits_{k=1}^{n}x_k^r}{\sum \limits_{k=1}^{n}x_k^{r-1}}, & \text{otherwise}
|
|
@@ -121,11 +172,15 @@ $$A_{lm}(x_1,...,x_n)= \begin{cases}
|
|
|
121
172
|
|
|
122
173
|
$\mathbf{A_{amn}^{(p)}}$ **- Arithmetic minimum mean**
|
|
123
174
|
|
|
175
|
+
Tags: `averaging` `symmetric` `conjunctive if p = 0` `aggregation interval: any [a,b] ⊂ ℝ` `p ∈ [0,1]`
|
|
176
|
+
|
|
124
177
|
$$A_{amn}^{(p)}(x_1,...,x_n)=\frac{p}{n}\sum \limits_{k=1}^{n} x_k+
|
|
125
178
|
(1-p) \min \limits_{1 \leq k \leq n}x_k, p \in [0, 1]$$
|
|
126
179
|
|
|
127
180
|
$\mathbf{A_{amx}^{(p)}}$ **- Arithmetic maximum mean**
|
|
128
181
|
|
|
182
|
+
Tags: `averaging` `symmetric` `disjunctive if p = 0` `aggregation interval: any [a,b] ⊂ ℝ` `p ∈ [0,1]`
|
|
183
|
+
|
|
129
184
|
$$A_{amx}^{(p)}(x_1,...,x_n)=\frac{p}{n}\sum \limits_{k=1}^{n} x_k+
|
|
130
185
|
(1-p) \max \limits_{1\leq k \leq n}x_k, p \in [0, 1]$$
|
|
131
186
|
|
|
@@ -138,6 +193,8 @@ arithmetic mean of the given values.
|
|
|
138
193
|
|
|
139
194
|
$\mathbf{A_{md}}$ **- Median - ordered weighted aggregation**
|
|
140
195
|
|
|
196
|
+
Tags: `averaging` `symmetric` `aggregation interval: any [a,b] ⊂ ℝ`
|
|
197
|
+
|
|
141
198
|
$$A_{md}(x_1,\dots,x_n) =
|
|
142
199
|
\begin{cases}
|
|
143
200
|
y_{(n+1)/2},&\text{if $n$ is odd}\\
|
|
@@ -146,10 +203,14 @@ y_{(n+1)/2},&\text{if $n$ is odd}\\
|
|
|
146
203
|
|
|
147
204
|
$\mathbf{A_{ol}}$ **- Olimpic aggregation**
|
|
148
205
|
|
|
206
|
+
Tags: `averaging` `symmetric` `aggregation interval: any [a,b] ⊂ ℝ`
|
|
207
|
+
|
|
149
208
|
$$ A_{ol}(x_1,\dots,x_n) = \frac{1}{n-2} \sum \limits_{k=2}^{n-1} y_k, \quad \text{where } \{y_1, \dots, y_n\} = \{x_1, \dots, x_n\},\ y_1 \leq y_2 \leq \dots \leq y_n.$$
|
|
150
209
|
|
|
151
210
|
$\mathbf{A_{oln}^{(p)}}$ **- Olimpic aggregation**
|
|
152
211
|
|
|
212
|
+
Tags: `averaging` `symmetric` `aggregation interval: any [a,b] ⊂ ℝ` `p ∈ ℕ, p ≥ 1`
|
|
213
|
+
|
|
153
214
|
We can specify how many greatest and smallest records remove
|
|
154
215
|
|
|
155
216
|
$$ A_{oln}^{(p)}(x_1,\dots,x_n) = \frac{1}{n-2p} \sum \limits_{k=p+1}^{n-p} y_k, \quad \text{where } \{y_1, \dots, y_n\} = \{x_1, \dots, x_n\},\ y_1 \leq y_2 \leq \dots \leq y_n, p \in \mathbb{N}, p\geq 1$$
|
|
@@ -157,18 +218,26 @@ $$ A_{oln}^{(p)}(x_1,\dots,x_n) = \frac{1}{n-2p} \sum \limits_{k=p+1}^{n-p} y_k
|
|
|
157
218
|
--------------------
|
|
158
219
|
|
|
159
220
|
$\mathbf{A_{ln}}$ **- Logaritmic aggregation [2]**
|
|
221
|
+
|
|
222
|
+
Tags: `averaging (continuous formula)` `symmetric` `aggregation interval (after continuous extension): any [a,b] ⊂ (0,∞)`
|
|
223
|
+
|
|
160
224
|
$$
|
|
161
225
|
A_{ln}\left(x_1, x_2, \ldots, x_n\right)=(n-1) ! \sum_{i=1}^n \frac{x_i}{\prod_{\substack{j=1 \\ j \neq i}}^n \log \left(x_i / x_j\right)}
|
|
162
226
|
$$
|
|
163
227
|
|
|
228
|
+
The formula has a continuous averaging extension when input values coincide,
|
|
229
|
+
but the current implementation does not handle ties: a zero denominator makes
|
|
230
|
+
it return `0`.
|
|
231
|
+
|
|
164
232
|
### $\mathbf{A^{(p)}_{A_1,A_2}}$ - Convex combinations of aggregation functions
|
|
165
233
|
|
|
234
|
+
Tags: `aggregation interval: common interval of A₁ and A₂` `averaging if both inputs are averaging` `p ∈ [0,1]`
|
|
235
|
+
|
|
166
236
|
We can construct covex combination of aggregation functions as $A^{(p)}_{A_1,A_2}=pA_1+(1-p)A_2$, where $A_1, A_2$ are aggregation functions and $p \in [0,1]$.
|
|
167
237
|
|
|
168
238
|
|
|
169
239
|
|
|
170
240
|
## References
|
|
171
241
|
|
|
172
|
-
1. Beliakov, G., Bustince, H., and Calvo, T.: A
|
|
173
|
-
Berlin: Springer Vol. 329, 2016.
|
|
242
|
+
1. Beliakov, G., Bustince, H., and Calvo, T.: *A Practical Guide to Averaging Functions*. Berlin: Springer, vol. 329, 2016.
|
|
174
243
|
2. [Mustonen, Seppo. (2010). Logarithmic mean for several arguments. ](https://www.researchgate.net/publication/228886844_Logarithmic_mean_for_several_arguments)
|
|
@@ -36,7 +36,7 @@ python -m pip install aggregationslib
|
|
|
36
36
|
## Szybki przykład
|
|
37
37
|
|
|
38
38
|
```python
|
|
39
|
-
from aggregationslib
|
|
39
|
+
from aggregationslib import A_amn, A_ar, Combine2Aggregations
|
|
40
40
|
|
|
41
41
|
data = [0.2, 0.6, 0.7]
|
|
42
42
|
|
|
@@ -49,6 +49,29 @@ print(func2(data))
|
|
|
49
49
|
|
|
50
50
|
Informacje o funkcji agregacji można uzyskać za pomocą metod `__str__()` lub `__repr__()`.
|
|
51
51
|
|
|
52
|
+
## Całki rozmyte Choqueta i Sugeno
|
|
53
|
+
|
|
54
|
+
Funkcje `choquet_integral` i `sugeno_integral` oraz obiekty wywoływalne `A_ch`
|
|
55
|
+
i `A_sg` agregują jednowymiarowy wektor wartości z `[0, 1]` do jednej liczby.
|
|
56
|
+
Domyślnie korzystają z miary kardynalności; można też podać własną miarę
|
|
57
|
+
symetryczną albo pełną miarę rozmytą.
|
|
58
|
+
|
|
59
|
+
Dla wektora wejściowego $(x_1,\dots,x_n)\in[0,1]^n$ niech $\sigma$
|
|
60
|
+
porządkuje indeksy tak, aby $x_{\sigma(1)}\leq\dots\leq x_{\sigma(n)}$.
|
|
61
|
+
Definiujemy $A_i=\{\sigma(i),\dots,\sigma(n)\}$ oraz
|
|
62
|
+
$x_{\sigma(0)}=0$. Wtedy:
|
|
63
|
+
|
|
64
|
+
- **Całka Choqueta [1]**:
|
|
65
|
+
$C_\mu(x_1,\dots,x_n)=\sum_{i=1}^n(x_{\sigma(i)}-x_{\sigma(i-1)})\,\mu(A_i)$;
|
|
66
|
+
- **Całka Sugeno [1]**:
|
|
67
|
+
$S_\mu(x_1,\dots,x_n)=\max_{1\leq i\leq n}\min(x_{\sigma(i)},\mu(A_i))$.
|
|
68
|
+
|
|
69
|
+
Przy domyślnej mierze `mu(A) = |A| / n` całka Choqueta jest równa średniej
|
|
70
|
+
arytmetycznej: $C_\mu(x_1,\dots,x_n)=(1/n)\sum_{i=1}^n x_i$. Wersje `float` mogą różnić
|
|
71
|
+
się od średniej na ostatnich bitach wskutek zaokrągleń.
|
|
72
|
+
|
|
73
|
+
Szczegóły i przykłady: [całki rozmyte](docs/fuzzy-integrals.md).
|
|
74
|
+
|
|
52
75
|
## Zbiory klasyczne i rozmyte
|
|
53
76
|
|
|
54
77
|
Zbiór klasyczny (*crisp set*) opisuje funkcja przynależności:
|
|
@@ -706,8 +729,7 @@ A_arpw(r=3)
|
|
|
706
729
|
|
|
707
730
|
## Referencje
|
|
708
731
|
|
|
709
|
-
1. Beliakov, G., Bustince, H. i Calvo, T.: *A Practical Guide to Averaging Functions*.
|
|
710
|
-
Berlin: Springer, vol. 329, 2016.
|
|
732
|
+
1. Beliakov, G., Bustince, H. i Calvo, T.: *A Practical Guide to Averaging Functions*. Berlin: Springer, vol. 329, 2016.
|
|
711
733
|
2. Mustonen, Seppo (2010):
|
|
712
734
|
[Logarithmic mean for several arguments](https://www.researchgate.net/publication/228886844_Logarithmic_mean_for_several_arguments).
|
|
713
735
|
3. [Aggregation functions](https://arxiv.org/pdf/2208.01644).
|