aggregationslib 0.2.9__tar.gz → 0.3.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.2.9/aggregationslib.egg-info → aggregationslib-0.3.0}/PKG-INFO +64 -33
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/README.md +41 -28
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/README.pl.md +8 -1
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/README.rst +63 -32
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/aggregationslib/__init__.py +2 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/aggregationslib/aggregation.py +27 -9
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/aggregationslib/aggregations.py +23 -28
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/aggregationslib/decimalaggregations.py +15 -1
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/aggregationslib/ndarray.py +6 -1
- {aggregationslib-0.2.9 → aggregationslib-0.3.0/aggregationslib.egg-info}/PKG-INFO +64 -33
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/aggregationslib.egg-info/SOURCES.txt +12 -4
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/aggregationslib.egg-info/scm_file_list.json +11 -3
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/aggregationslib.egg-info/scm_version.json +2 -2
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/apps/shiny/README.md +3 -4
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/apps/shiny/README.pl.md +3 -4
- aggregationslib-0.3.0/apps/shiny/app.py +1604 -0
- aggregationslib-0.3.0/apps/shiny/core.py +615 -0
- aggregationslib-0.3.0/apps/shiny/evaluation.py +270 -0
- aggregationslib-0.3.0/apps/shiny/example_binary.csv +31 -0
- aggregationslib-0.3.0/apps/shiny/example_multiclass.csv +37 -0
- aggregationslib-0.3.0/build_docs.ps1 +76 -0
- aggregationslib-0.3.0/docs/_config.yml +5 -0
- aggregationslib-0.3.0/docs/assets/means-icon.svg +20 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/docs/assets/site.css +18 -0
- aggregationslib-0.3.0/docs/en/index.md +381 -0
- aggregationslib-0.3.0/docs/en/shiny/index.md +75 -0
- aggregationslib-0.3.0/docs/pl/index.md +761 -0
- aggregationslib-0.3.0/docs/pl/shiny/index.md +75 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/pyproject.toml +1 -1
- aggregationslib-0.3.0/tests/data/wolfram_quadratic_reference.json +86 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/tests/test_aggregations.py +14 -2
- aggregationslib-0.3.0/tests/test_lehmer_zero.py +73 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/tests/test_ndarray.py +2 -1
- aggregationslib-0.3.0/tests/test_quadratic_stability.py +38 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/tests/test_shiny_app.py +52 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/tests/test_shiny_evaluation.py +38 -2
- aggregationslib-0.2.9/apps/shiny/app.py +0 -709
- aggregationslib-0.2.9/apps/shiny/core.py +0 -271
- aggregationslib-0.2.9/apps/shiny/evaluation.py +0 -98
- aggregationslib-0.2.9/build_docs.ps1 +0 -49
- aggregationslib-0.2.9/docs/.nojekyll +0 -1
- aggregationslib-0.2.9/docs/en/index.html +0 -548
- aggregationslib-0.2.9/docs/pl/index.html +0 -723
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/.gitignore +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/AGENTS.md +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/LICENSE +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/aggregation_classification.html +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/aggregationslib/cli.py +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/aggregationslib/conjuctive/__init__.py +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/aggregationslib/conjuctive/purepython.py +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/aggregationslib/disjunctive/__init__.py +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/aggregationslib/example.py +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/aggregationslib/feature_selection/__init__.py +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/aggregationslib/feature_selection/binary_fuzzy_entropy.py +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/aggregationslib/feature_selection/fuzzy_com_entropy.py +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/aggregationslib/models/__init__.py +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/aggregationslib/models/ensemble/__init__.py +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/aggregationslib/models/ensemble/aggregation_regressor.py +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/aggregationslib/models/single/__init__.py +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/aggregationslib/purepython.py +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/aggregationslib.egg-info/dependency_links.txt +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/aggregationslib.egg-info/entry_points.txt +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/aggregationslib.egg-info/requires.txt +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/aggregationslib.egg-info/top_level.txt +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/apps/shiny/column-selection.js +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/apps/shiny/example.csv +0 -0
- {aggregationslib-0.2.9/docs/assets → aggregationslib-0.3.0/apps/shiny}/means-icon.svg +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/assets/icons/icon.ico +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/assets/icons/icon.png +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/assets/icons/icon.svg +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/commands.md +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/diagram-aggregation-classification.svg +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/diagram-implikacja-agregacja.svg +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/diagram-klasyfikacja-agregacji.svg +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/diagram-odwzorowanie.svg +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/docs/CNAME +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/docs/aggregation-classes.md +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/docs/aggregation-plots.md +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/docs/aggregation_classification.html +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/docs/assets/aggregation-surfaces-all.png +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/docs/assets/aggregation-surfaces.png +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/docs/assets/aggregations/A_amn_p=0.5.png +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/docs/assets/aggregations/A_amx_p=0.5.png +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/docs/assets/aggregations/A_ar.png +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/docs/assets/aggregations/A_ex2_p=2,q=2.png +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/docs/assets/aggregations/A_ex3_p=2,q=1.5.png +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/docs/assets/aggregations/A_ex_r=1.png +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/docs/assets/aggregations/A_gm.png +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/docs/assets/aggregations/A_hm.png +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/docs/assets/aggregations/A_lm_r=2.png +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/docs/assets/aggregations/A_lo.png +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/docs/assets/aggregations/A_md.png +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/docs/assets/aggregations/A_mn.png +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/docs/assets/aggregations/A_mx.png +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/docs/assets/aggregations/A_ol.png +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/docs/assets/aggregations/A_oln_p=1.png +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/docs/assets/aggregations/A_pr.png +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/docs/assets/aggregations/A_pw_r=2.png +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/docs/assets/aggregations/A_qd.png +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/docs/assets/diagram-aggregation-classification.svg +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/docs/assets/diagram-klasyfikacja-agregacji.svg +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/docs/fuzzy-integrals.md +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/docs/index.html +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/docs/klasyfikacja_agregacji.html +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/generate_aggregation_plots.py +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/klasyfikacja_agregacji.html +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/setup.cfg +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/tests/__init__.py +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/tests/data/README.md +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/tests/data/wolfram_integral_reference.json +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/tests/data/wolfram_measure_reference.json +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/tests/test_decimal_exponential_mean.py +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/tests/test_decimal_fuzzy_integrals.py +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/tests/test_exponential_cardinality.py +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/tests/test_fuzzy_integrals.py +0 -0
- {aggregationslib-0.2.9 → aggregationslib-0.3.0}/tests/test_wolfram_measures.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aggregationslib
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.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
|
|
@@ -25,10 +25,8 @@ Requires-Dist: pygments<3,>=2.19; extra == "app"
|
|
|
25
25
|
Requires-Dist: matplotlib<4,>=3.9; extra == "app"
|
|
26
26
|
Dynamic: license-file
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
Means, Aggregation functions...
|
|
28
|
+
.. contents:: Table of contents
|
|
29
|
+
:depth: 4
|
|
32
30
|
|
|
33
31
|
Documentation:
|
|
34
32
|
|
|
@@ -39,7 +37,8 @@ Aggregation functions can be classified in several ways. A familiar
|
|
|
39
37
|
distinction is between three types of behaviour:
|
|
40
38
|
|
|
41
39
|
- Conjunctive — an AND-like combination of the inputs.
|
|
42
|
-
- Averaging — a result between the smallest and largest input
|
|
40
|
+
- Averaging (Means) — a result between the smallest and largest input
|
|
41
|
+
values.
|
|
43
42
|
- Disjunctive — an OR-like combination of the inputs.
|
|
44
43
|
|
|
45
44
|
These are not the only possibilities: aggregation functions can also
|
|
@@ -59,7 +58,7 @@ An interactive version of this diagram is available at:
|
|
|
59
58
|
https://wgalka.github.io/Means/aggregation_classification.html
|
|
60
59
|
|
|
61
60
|
Example 1:
|
|
62
|
-
|
|
61
|
+
----------
|
|
63
62
|
|
|
64
63
|
.. code:: pycon
|
|
65
64
|
|
|
@@ -75,8 +74,8 @@ Example 1:
|
|
|
75
74
|
# use combination of aggregation funciton
|
|
76
75
|
print(func2(data))
|
|
77
76
|
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
Example 2:
|
|
78
|
+
----------
|
|
80
79
|
|
|
81
80
|
To get information about aggregation function you can use ``__str__()``
|
|
82
81
|
or '**repr**\ ()' methods.
|
|
@@ -162,7 +161,8 @@ intervals. ``[0,1]`` means only the unit interval. These are
|
|
|
162
161
|
mathematical properties; most callable objects do not validate input
|
|
163
162
|
bounds at runtime. Some tags depend on parameters or the fuzzy measure.
|
|
164
163
|
|
|
165
|
-
:math:`\mathbf{A_{ch}^{(\mu)}}`
|
|
164
|
+
:math:`\mathbf{A_{ch}^{(\mu)}}` - Discrete Choquet integral [1]
|
|
165
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
166
166
|
|
|
167
167
|
Tags: ``averaging`` ``aggregation interval: [0,1]``
|
|
168
168
|
``symmetric if μ is symmetric``
|
|
@@ -216,7 +216,8 @@ two-argument function ``O(x, mu)`` as ``quasi_overlap`` to
|
|
|
216
216
|
``choquet_integral`` or ``A_ch``. The default remains the classical
|
|
217
217
|
product-based Choquet integral.
|
|
218
218
|
|
|
219
|
-
:math:`\mathbf{A_{sg}^{(\mu)}}`
|
|
219
|
+
:math:`\mathbf{A_{sg}^{(\mu)}}` - Discrete Sugeno integral [1]
|
|
220
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
220
221
|
|
|
221
222
|
Tags: ``averaging`` ``aggregation interval: [0,1]``
|
|
222
223
|
``symmetric if μ is symmetric``
|
|
@@ -260,14 +261,16 @@ available in ``aggregationslib.aggregation`` and
|
|
|
260
261
|
:math:`\mu(A)=(|A|/n)^q`, where ``q`` must be finite and :math:`q>0`.
|
|
261
262
|
For :math:`q=1`, this is the uniform/cardinality measure.
|
|
262
263
|
|
|
263
|
-
:math:`\mathbf{A_{ar}}`
|
|
264
|
+
:math:`\mathbf{A_{ar}}` - Arithmetic mean
|
|
265
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
264
266
|
|
|
265
267
|
Tags: ``averaging`` ``symmetric``
|
|
266
268
|
``aggregation interval: any [a,b] ⊂ ℝ``
|
|
267
269
|
|
|
268
270
|
.. math:: A_{ar}(x_1,...,x_n)=\frac{1}{n}\sum \limits_{k=1}^{n} x_k
|
|
269
271
|
|
|
270
|
-
:math:`\mathbf{A_{qd}}`
|
|
272
|
+
:math:`\mathbf{A_{qd}}` - Quadratic mean
|
|
273
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
271
274
|
|
|
272
275
|
Tags: ``averaging`` ``symmetric``
|
|
273
276
|
``aggregation interval: any [a,b] ⊆ [0,∞)``
|
|
@@ -277,13 +280,22 @@ Tags: ``averaging`` ``symmetric``
|
|
|
277
280
|
A_{qd}(x_1,...,x_n)=\sqrt{\frac{1}{n}\sum
|
|
278
281
|
\limits_{k=1}^{n} x_k^2}
|
|
279
282
|
|
|
280
|
-
|
|
283
|
+
To avoid overflow when squaring, inputs are converted to ``float64`` and
|
|
284
|
+
the quadratic mean is computed as
|
|
285
|
+
:math:`s\sqrt{\operatorname{mean}((x/s)^2)}`, where
|
|
286
|
+
:math:`s=\max_i |x_i|`; all-zero inputs return ``0``. For example,
|
|
287
|
+
``[2**32, 2**32]`` correctly returns ``4294967296``, whereas direct
|
|
288
|
+
squaring in ``int64`` previously overflowed and produced ``0``.
|
|
289
|
+
|
|
290
|
+
:math:`\mathbf{A_{pr}}` - Product aggregation
|
|
291
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
281
292
|
|
|
282
293
|
Tags: ``conjunctive`` ``symmetric`` ``aggregation interval: [0,1]``
|
|
283
294
|
|
|
284
295
|
.. math:: A_{pr}(x_1, x_2, \dots, x_n) = \prod_{k=1}^n x_k
|
|
285
296
|
|
|
286
|
-
:math:`\mathbf{A_{gm}}`
|
|
297
|
+
:math:`\mathbf{A_{gm}}` - Geometric mean
|
|
298
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
287
299
|
|
|
288
300
|
Tags: ``averaging`` ``symmetric``
|
|
289
301
|
``aggregation interval: any [a,b] ⊆ [0,∞)``
|
|
@@ -293,7 +305,8 @@ Tags: ``averaging`` ``symmetric``
|
|
|
293
305
|
A_{gm}(x_1,...,x_n)=\sqrt[n]{\prod
|
|
294
306
|
\limits_{k=1}^{n} x_k}
|
|
295
307
|
|
|
296
|
-
:math:`\mathbf{A_{hm}}`
|
|
308
|
+
:math:`\mathbf{A_{hm}}` - Harmonic mean
|
|
309
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
297
310
|
|
|
298
311
|
Tags: ``averaging`` ``symmetric``
|
|
299
312
|
``aggregation interval: any [a,b] ⊆ [0,∞)``
|
|
@@ -307,7 +320,8 @@ Tags: ``averaging`` ``symmetric``
|
|
|
307
320
|
\frac{n}{\sum\limits_{k=1}^{n} \frac{1}{x_k}}, & \text{otherwise}
|
|
308
321
|
\end{cases}
|
|
309
322
|
|
|
310
|
-
:math:`\mathbf{A_{pw}^{(r)}}`
|
|
323
|
+
:math:`\mathbf{A_{pw}^{(r)}}` - Power mean
|
|
324
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
311
325
|
|
|
312
326
|
Tags: ``averaging`` ``symmetric``
|
|
313
327
|
``aggregation interval: any [a,b] ⊆ [0,∞)`` ``r ≠ 0``
|
|
@@ -331,7 +345,8 @@ special cases of power means :math:`A_{\text{pw}}^r` [1] are:
|
|
|
331
345
|
|
|
332
346
|
--------------
|
|
333
347
|
|
|
334
|
-
:math:`\mathbf{A_{ex}^{(r)}}`
|
|
348
|
+
:math:`\mathbf{A_{ex}^{(r)}}` - Exponential mean
|
|
349
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
335
350
|
|
|
336
351
|
Tags: ``averaging`` ``symmetric``
|
|
337
352
|
``aggregation interval: any [a,b] ⊂ ℝ`` ``r ≠ 0``
|
|
@@ -350,19 +365,31 @@ formulation by shifting the exponents by
|
|
|
350
365
|
|
|
351
366
|
.. 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]
|
|
352
367
|
|
|
353
|
-
:math:`\mathbf{A_{lm}}`
|
|
368
|
+
:math:`\mathbf{A_{lm}}`, :math:`\mathbf{A_{lm1}}` - Lehmer mean
|
|
369
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
354
370
|
|
|
355
371
|
Tags: ``averaging`` ``symmetric``
|
|
356
372
|
``aggregation interval: any [a,b] ⊆ [0,∞) if 0 ≤ r ≤ 1``
|
|
357
373
|
|
|
358
|
-
|
|
374
|
+
For positive inputs, both variants use the same formula:
|
|
359
375
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
376
|
+
.. math:: L^{(r)}(x_1,\dots,x_n)=\frac{\sum_{k=1}^n x_k^r}{\sum_{k=1}^n x_k^{r-1}}.
|
|
377
|
+
|
|
378
|
+
- **``A_lm`` (``0/0 = 0`` convention).** If :math:`r \leq 1` and any
|
|
379
|
+
input is zero, the result is zero. This convention assigns zero to
|
|
380
|
+
:math:`0/0` in this formula.
|
|
381
|
+
- **``A_lm1`` (continuous extension).** If :math:`r < 1` and any input
|
|
382
|
+
is zero, the result is zero. At :math:`r = 1` the result is the
|
|
383
|
+
arithmetic mean, including when some inputs are zero. For
|
|
384
|
+
:math:`r > 1`, both variants use the quotient for nonnegative inputs
|
|
385
|
+
and return zero for an all-zero vector.
|
|
386
|
+
|
|
387
|
+
For example, ``A_lm(r=1)([0, 1])`` returns ``0`` and
|
|
388
|
+
``A_lm1(r=1)([0, 1])`` returns ``0.5``. The functional and Decimal APIs
|
|
389
|
+
expose the same variants as ``lehmer`` and ``lehmer1``, respectively.
|
|
364
390
|
|
|
365
|
-
:math:`\mathbf{A_{amn}^{(p)}}`
|
|
391
|
+
:math:`\mathbf{A_{amn}^{(p)}}` - Arithmetic minimum mean
|
|
392
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
366
393
|
|
|
367
394
|
Tags: ``averaging`` ``symmetric`` ``conjunctive if p = 0``
|
|
368
395
|
``aggregation interval: any [a,b] ⊂ ℝ`` ``p ∈ [0,1]``
|
|
@@ -372,7 +399,8 @@ Tags: ``averaging`` ``symmetric`` ``conjunctive if p = 0``
|
|
|
372
399
|
A_{amn}^{(p)}(x_1,...,x_n)=\frac{p}{n}\sum \limits_{k=1}^{n} x_k+
|
|
373
400
|
(1-p) \min \limits_{1 \leq k \leq n}x_k, p \in [0, 1]
|
|
374
401
|
|
|
375
|
-
:math:`\mathbf{A_{amx}^{(p)}}`
|
|
402
|
+
:math:`\mathbf{A_{amx}^{(p)}}` - Arithmetic maximum mean
|
|
403
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
376
404
|
|
|
377
405
|
Tags: ``averaging`` ``symmetric`` ``disjunctive if p = 0``
|
|
378
406
|
``aggregation interval: any [a,b] ⊂ ℝ`` ``p ∈ [0,1]``
|
|
@@ -389,7 +417,8 @@ In the case of n = 2 (when only two values are aggregated) the
|
|
|
389
417
|
calculation of the median and the Olympic aggregation are reduced to the
|
|
390
418
|
case of calculating the arithmetic mean of the given values.
|
|
391
419
|
|
|
392
|
-
:math:`\mathbf{A_{md}}`
|
|
420
|
+
:math:`\mathbf{A_{md}}` - Median - ordered weighted aggregation
|
|
421
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
393
422
|
|
|
394
423
|
Tags: ``averaging`` ``symmetric``
|
|
395
424
|
``aggregation interval: any [a,b] ⊂ ℝ``
|
|
@@ -402,14 +431,16 @@ Tags: ``averaging`` ``symmetric``
|
|
|
402
431
|
\frac{y_{n/2}+y_{(n/2)+1}}{2},&\text{if $n$ is even}
|
|
403
432
|
\end{cases},
|
|
404
433
|
|
|
405
|
-
:math:`\mathbf{A_{ol}}`
|
|
434
|
+
:math:`\mathbf{A_{ol}}` - Olimpic aggregation
|
|
435
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
406
436
|
|
|
407
437
|
Tags: ``averaging`` ``symmetric``
|
|
408
438
|
``aggregation interval: any [a,b] ⊂ ℝ``
|
|
409
439
|
|
|
410
440
|
.. 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.
|
|
411
441
|
|
|
412
|
-
:math:`\mathbf{A_{oln}^{(p)}}`
|
|
442
|
+
:math:`\mathbf{A_{oln}^{(p)}}` - Olimpic aggregation
|
|
443
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
413
444
|
|
|
414
445
|
Tags: ``averaging`` ``symmetric``
|
|
415
446
|
``aggregation interval: any [a,b] ⊂ ℝ`` ``p ∈ ℕ, p ≥ 1``
|
|
@@ -420,7 +451,8 @@ We can specify how many greatest and smallest records remove
|
|
|
420
451
|
|
|
421
452
|
--------------
|
|
422
453
|
|
|
423
|
-
:math:`\mathbf{A_{ln}}`
|
|
454
|
+
:math:`\mathbf{A_{ln}}` - Logaritmic aggregation [2]
|
|
455
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
424
456
|
|
|
425
457
|
Tags: ``averaging (continuous formula)`` ``symmetric``
|
|
426
458
|
``aggregation interval (after continuous extension): any [a,b] ⊂ (0,∞)``
|
|
@@ -453,13 +485,12 @@ References
|
|
|
453
485
|
arguments. <https://www.researchgate.net/publication/228886844_Logarithmic_mean_for_several_arguments>`__
|
|
454
486
|
|
|
455
487
|
Shiny app
|
|
456
|
-
|
|
488
|
+
---------
|
|
457
489
|
|
|
458
490
|
A local interface lets you upload a CSV table, select columns and an
|
|
459
491
|
aggregation, add input vectors, and download row-wise results. It also
|
|
460
492
|
generates the equivalent Python code using ``aggregationslib.ndarray``.
|
|
461
|
-
See `setup and
|
|
462
|
-
usage <https://github.com/wgalka/Means/blob/main/apps/shiny/README.md>`__.
|
|
493
|
+
See `setup and usage <https://wgalka.github.io/Means/en/shiny/>`__.
|
|
463
494
|
|
|
464
495
|
.. |Classification of aggregation functions| image:: https://raw.githubusercontent.com/wgalka/Means/main/docs/assets/diagram-aggregation-classification.svg
|
|
465
496
|
:target: https://wgalka.github.io/Means/aggregation_classification.html
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
# Means
|
|
2
|
-
Means, Aggregation functions...
|
|
3
|
-
|
|
4
1
|
Documentation:
|
|
5
2
|
|
|
6
3
|
- [English](https://wgalka.github.io/Means/en/)
|
|
@@ -10,7 +7,7 @@ Aggregation functions can be classified in several ways. A familiar distinction
|
|
|
10
7
|
is between three types of behaviour:
|
|
11
8
|
|
|
12
9
|
- Conjunctive — an AND-like combination of the inputs.
|
|
13
|
-
- Averaging — a result between the smallest and largest input values.
|
|
10
|
+
- Averaging (Means) — a result between the smallest and largest input values.
|
|
14
11
|
- Disjunctive — an OR-like combination of the inputs.
|
|
15
12
|
|
|
16
13
|
These are not the only possibilities: aggregation functions can also exhibit
|
|
@@ -22,7 +19,7 @@ mixed behaviour. The diagram below presents a broader classification.
|
|
|
22
19
|
|
|
23
20
|
An interactive version of this diagram is available at: https://wgalka.github.io/Means/aggregation_classification.html
|
|
24
21
|
|
|
25
|
-
|
|
22
|
+
## Example 1:
|
|
26
23
|
|
|
27
24
|
```pycon
|
|
28
25
|
# example data
|
|
@@ -38,7 +35,7 @@ func2 = Combine2Aggregations(A_ar(), min)
|
|
|
38
35
|
print(func2(data))
|
|
39
36
|
```
|
|
40
37
|
|
|
41
|
-
|
|
38
|
+
## Example 2:
|
|
42
39
|
To get information about aggregation function you can use `__str__()` or '__repr__()' methods.
|
|
43
40
|
|
|
44
41
|
```pycon
|
|
@@ -118,7 +115,7 @@ intervals. `[0,1]` means only the unit interval. These are mathematical
|
|
|
118
115
|
properties; most callable objects do not validate input bounds at runtime.
|
|
119
116
|
Some tags depend on parameters or the fuzzy measure.
|
|
120
117
|
|
|
121
|
-
$\mathbf{A_{ch}^{(\mu)}}$
|
|
118
|
+
### $\mathbf{A_{ch}^{(\mu)}}$ - Discrete Choquet integral [1]
|
|
122
119
|
|
|
123
120
|
Tags: `averaging` `aggregation interval: [0,1]` `symmetric if μ is symmetric`
|
|
124
121
|
|
|
@@ -164,7 +161,7 @@ For the quasi-overlap generalization from Equation (9), pass a two-argument
|
|
|
164
161
|
function `O(x, mu)` as `quasi_overlap` to `choquet_integral` or `A_ch`. The
|
|
165
162
|
default remains the classical product-based Choquet integral.
|
|
166
163
|
|
|
167
|
-
$\mathbf{A_{sg}^{(\mu)}}$
|
|
164
|
+
### $\mathbf{A_{sg}^{(\mu)}}$ - Discrete Sugeno integral [1]
|
|
168
165
|
|
|
169
166
|
Tags: `averaging` `aggregation interval: [0,1]` `symmetric if μ is symmetric`
|
|
170
167
|
|
|
@@ -202,33 +199,39 @@ $\mu(\emptyset)=0$ and $\mu(N)=1$. The same constructors are available in
|
|
|
202
199
|
$\mu(A)=(|A|/n)^q$, where `q` must be finite and $q>0$.
|
|
203
200
|
For $q=1$, this is the uniform/cardinality measure.
|
|
204
201
|
|
|
205
|
-
$\mathbf{A_{ar}}$
|
|
202
|
+
### $\mathbf{A_{ar}}$ - Arithmetic mean
|
|
206
203
|
|
|
207
204
|
Tags: `averaging` `symmetric` `aggregation interval: any [a,b] ⊂ ℝ`
|
|
208
205
|
|
|
209
206
|
$$A_{ar}(x_1,...,x_n)=\frac{1}{n}\sum \limits_{k=1}^{n} x_k$$
|
|
210
207
|
|
|
211
|
-
$\mathbf{A_{qd}}$
|
|
208
|
+
### $\mathbf{A_{qd}}$ - Quadratic mean
|
|
212
209
|
|
|
213
210
|
Tags: `averaging` `symmetric` `aggregation interval: any [a,b] ⊆ [0,∞)`
|
|
214
211
|
|
|
215
212
|
$$A_{qd}(x_1,...,x_n)=\sqrt{\frac{1}{n}\sum
|
|
216
213
|
\limits_{k=1}^{n} x_k^2}$$
|
|
217
214
|
|
|
218
|
-
|
|
215
|
+
To avoid overflow when squaring, inputs are converted to `float64` and the
|
|
216
|
+
quadratic mean is computed as $s\sqrt{\operatorname{mean}((x/s)^2)}$, where
|
|
217
|
+
$s=\max_i |x_i|$; all-zero inputs return `0`. For example, `[2**32, 2**32]`
|
|
218
|
+
correctly returns `4294967296`, whereas direct squaring in `int64` previously
|
|
219
|
+
overflowed and produced `0`.
|
|
220
|
+
|
|
221
|
+
### $\mathbf{A_{pr}}$ - Product aggregation
|
|
219
222
|
|
|
220
223
|
Tags: `conjunctive` `symmetric` `aggregation interval: [0,1]`
|
|
221
224
|
|
|
222
225
|
$$A_{pr}(x_1, x_2, \dots, x_n) = \prod_{k=1}^n x_k$$
|
|
223
226
|
|
|
224
|
-
$\mathbf{A_{gm}}$
|
|
227
|
+
### $\mathbf{A_{gm}}$ - Geometric mean
|
|
225
228
|
|
|
226
229
|
Tags: `averaging` `symmetric` `aggregation interval: any [a,b] ⊆ [0,∞)`
|
|
227
230
|
|
|
228
231
|
$$A_{gm}(x_1,...,x_n)=\sqrt[n]{\prod
|
|
229
232
|
\limits_{k=1}^{n} x_k}$$
|
|
230
233
|
|
|
231
|
-
$\mathbf{A_{hm}}$
|
|
234
|
+
### $\mathbf{A_{hm}}$ - Harmonic mean
|
|
232
235
|
|
|
233
236
|
Tags: `averaging` `symmetric` `aggregation interval: any [a,b] ⊆ [0,∞)`
|
|
234
237
|
|
|
@@ -241,7 +244,7 @@ A_{hm}(x_1,...,x_n) =
|
|
|
241
244
|
$$
|
|
242
245
|
|
|
243
246
|
|
|
244
|
-
$\mathbf{A_{pw}^{(r)}}$
|
|
247
|
+
### $\mathbf{A_{pw}^{(r)}}$ - Power mean
|
|
245
248
|
|
|
246
249
|
Tags: `averaging` `symmetric` `aggregation interval: any [a,b] ⊆ [0,∞)` `r ≠ 0`
|
|
247
250
|
|
|
@@ -263,7 +266,7 @@ special cases of power means $A_{\text{pw}}^r$ [1] are:
|
|
|
263
266
|
|
|
264
267
|
----
|
|
265
268
|
|
|
266
|
-
$\mathbf{A_{ex}^{(r)}}$
|
|
269
|
+
### $\mathbf{A_{ex}^{(r)}}$ - Exponential mean
|
|
267
270
|
|
|
268
271
|
Tags: `averaging` `symmetric` `aggregation interval: any [a,b] ⊂ ℝ` `r ≠ 0`
|
|
269
272
|
|
|
@@ -275,23 +278,33 @@ For computer implementations, to avoid numerical instability (overflow when $r x
|
|
|
275
278
|
|
|
276
279
|
$$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]$$
|
|
277
280
|
|
|
278
|
-
$\mathbf{A_{lm}}$
|
|
281
|
+
### $\mathbf{A_{lm}}$, $\mathbf{A_{lm1}}$ - Lehmer mean
|
|
279
282
|
|
|
280
283
|
Tags: `averaging` `symmetric` `aggregation interval: any [a,b] ⊆ [0,∞) if 0 ≤ r ≤ 1`
|
|
281
284
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
285
|
+
For positive inputs, both variants use the same formula:
|
|
286
|
+
|
|
287
|
+
$$L^{(r)}(x_1,\dots,x_n)=\frac{\sum_{k=1}^n x_k^r}{\sum_{k=1}^n x_k^{r-1}}.$$
|
|
288
|
+
|
|
289
|
+
- **`A_lm` (`0/0 = 0` convention).** If $r \leq 1$ and any input is zero,
|
|
290
|
+
the result is zero. This convention assigns zero to $0/0$ in this formula.
|
|
291
|
+
- **`A_lm1` (continuous extension).** If $r < 1$ and any input is zero,
|
|
292
|
+
the result is zero. At $r = 1$ the result is the arithmetic mean, including
|
|
293
|
+
when some inputs are zero. For $r > 1$, both variants use the quotient
|
|
294
|
+
for nonnegative inputs and return zero for an all-zero vector.
|
|
295
|
+
|
|
296
|
+
For example, `A_lm(r=1)([0, 1])` returns `0` and
|
|
297
|
+
`A_lm1(r=1)([0, 1])` returns `0.5`. The functional and Decimal APIs
|
|
298
|
+
expose the same variants as `lehmer` and `lehmer1`, respectively.
|
|
286
299
|
|
|
287
|
-
$\mathbf{A_{amn}^{(p)}}$
|
|
300
|
+
### $\mathbf{A_{amn}^{(p)}}$ - Arithmetic minimum mean
|
|
288
301
|
|
|
289
302
|
Tags: `averaging` `symmetric` `conjunctive if p = 0` `aggregation interval: any [a,b] ⊂ ℝ` `p ∈ [0,1]`
|
|
290
303
|
|
|
291
304
|
$$A_{amn}^{(p)}(x_1,...,x_n)=\frac{p}{n}\sum \limits_{k=1}^{n} x_k+
|
|
292
305
|
(1-p) \min \limits_{1 \leq k \leq n}x_k, p \in [0, 1]$$
|
|
293
306
|
|
|
294
|
-
$\mathbf{A_{amx}^{(p)}}$
|
|
307
|
+
### $\mathbf{A_{amx}^{(p)}}$ - Arithmetic maximum mean
|
|
295
308
|
|
|
296
309
|
Tags: `averaging` `symmetric` `disjunctive if p = 0` `aggregation interval: any [a,b] ⊂ ℝ` `p ∈ [0,1]`
|
|
297
310
|
|
|
@@ -305,7 +318,7 @@ In the case of n = 2 (when only two values are aggregated) the
|
|
|
305
318
|
calculation of the median and the Olympic aggregation are reduced to the case of calculating the
|
|
306
319
|
arithmetic mean of the given values.
|
|
307
320
|
|
|
308
|
-
$\mathbf{A_{md}}$
|
|
321
|
+
#### $\mathbf{A_{md}}$ - Median - ordered weighted aggregation
|
|
309
322
|
|
|
310
323
|
Tags: `averaging` `symmetric` `aggregation interval: any [a,b] ⊂ ℝ`
|
|
311
324
|
|
|
@@ -315,13 +328,13 @@ y_{(n+1)/2},&\text{if $n$ is odd}\\
|
|
|
315
328
|
\frac{y_{n/2}+y_{(n/2)+1}}{2},&\text{if $n$ is even}
|
|
316
329
|
\end{cases},$$
|
|
317
330
|
|
|
318
|
-
$\mathbf{A_{ol}}$
|
|
331
|
+
#### $\mathbf{A_{ol}}$ - Olimpic aggregation
|
|
319
332
|
|
|
320
333
|
Tags: `averaging` `symmetric` `aggregation interval: any [a,b] ⊂ ℝ`
|
|
321
334
|
|
|
322
335
|
$$ 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.$$
|
|
323
336
|
|
|
324
|
-
$\mathbf{A_{oln}^{(p)}}$
|
|
337
|
+
#### $\mathbf{A_{oln}^{(p)}}$ - Olimpic aggregation
|
|
325
338
|
|
|
326
339
|
Tags: `averaging` `symmetric` `aggregation interval: any [a,b] ⊂ ℝ` `p ∈ ℕ, p ≥ 1`
|
|
327
340
|
|
|
@@ -331,7 +344,7 @@ $$ A_{oln}^{(p)}(x_1,\dots,x_n) = \frac{1}{n-2p} \sum \limits_{k=p+1}^{n-p} y_k
|
|
|
331
344
|
|
|
332
345
|
--------------------
|
|
333
346
|
|
|
334
|
-
$\mathbf{A_{ln}}$
|
|
347
|
+
### $\mathbf{A_{ln}}$ - Logaritmic aggregation [2]
|
|
335
348
|
|
|
336
349
|
Tags: `averaging (continuous formula)` `symmetric` `aggregation interval (after continuous extension): any [a,b] ⊂ (0,∞)`
|
|
337
350
|
|
|
@@ -355,9 +368,9 @@ We can construct covex combination of aggregation functions as $A^{(p)}_{A_1,A_2
|
|
|
355
368
|
|
|
356
369
|
1. Beliakov, G., Bustince, H., and Calvo, T.: *A Practical Guide to Averaging Functions*. Berlin: Springer, vol. 329, 2016.
|
|
357
370
|
2. [Mustonen, Seppo. (2010). Logarithmic mean for several arguments. ](https://www.researchgate.net/publication/228886844_Logarithmic_mean_for_several_arguments)
|
|
358
|
-
|
|
371
|
+
## Shiny app
|
|
359
372
|
|
|
360
373
|
A local interface lets you upload a CSV table, select columns and an
|
|
361
374
|
aggregation, add input vectors, and download row-wise results. It also
|
|
362
375
|
generates the equivalent Python code using `aggregationslib.ndarray`.
|
|
363
|
-
See [setup and usage](https://github.
|
|
376
|
+
See [setup and usage](https://wgalka.github.io/Means/en/shiny/).
|
|
@@ -358,6 +358,13 @@ potęgowych `P^(r)` zachodzą zależności:
|
|
|
358
358
|
|
|
359
359
|
Obie rodziny spotykają się dla `r = 1`.
|
|
360
360
|
|
|
361
|
+
W bibliotece dostępne są dwa warianty średniej Lehmera (dla argumentów dodatnich dające ten sam wynik):
|
|
362
|
+
|
|
363
|
+
- **`A_lm` / `lehmer` (konwencja `0/0 = 0`)** — jeśli `r <= 1` i dowolny argument wynosi `0`, wynikiem jest `0` (konwencja ta przypisuje również `0` do wyrażenia `0/0`).
|
|
364
|
+
- **`A_lm1` / `lehmer1` (ciągłe rozszerzenie)** — jeśli `r < 1` i dowolny argument wynosi `0`, wynikiem jest `0`; dla `r = 1` funkcja zwraca średnią arytmetyczną również wtedy, gdy część argumentów wynosi `0`. Dla `r > 1` oba warianty liczą iloraz na argumentach nieujemnych i zwracają `0` dla wektora złożonego z samych zer.
|
|
365
|
+
|
|
366
|
+
Przykładowo `A_lm(r=1)([0, 1])` zwraca `0`, natomiast `A_lm1(r=1)([0, 1])` zwraca `0.5`.
|
|
367
|
+
|
|
361
368
|
## Operator OWA
|
|
362
369
|
|
|
363
370
|
OWA (*Ordered Weighted Averaging*) oznacza **uporządkowaną średnią ważoną**.
|
|
@@ -746,4 +753,4 @@ Lokalny interfejs pozwala wgrać tabelę CSV, wybrać kolumny oraz funkcję
|
|
|
746
753
|
agregacji, dopisać dodatkowe wektory i pobrać wyniki dla poszczególnych
|
|
747
754
|
wierszy. Generuje także równoważny kod w Pythonie z użyciem
|
|
748
755
|
`aggregationslib.ndarray`.
|
|
749
|
-
Zobacz [instalację i instrukcję użycia](https://github.
|
|
756
|
+
Zobacz [instalację i instrukcję użycia](https://wgalka.github.io/Means/pl/shiny/).
|