aggregationslib 0.2.7__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.3.0/AGENTS.md +7 -0
- {aggregationslib-0.2.7/aggregationslib.egg-info → aggregationslib-0.3.0}/PKG-INFO +138 -45
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/README.md +43 -30
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/README.pl.md +20 -5
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/README.rst +140 -47
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/aggregationslib/__init__.py +2 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/aggregationslib/aggregation.py +27 -9
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/aggregationslib/aggregations.py +23 -28
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/aggregationslib/decimalaggregations.py +15 -1
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/aggregationslib/ndarray.py +6 -1
- {aggregationslib-0.2.7 → aggregationslib-0.3.0/aggregationslib.egg-info}/PKG-INFO +138 -45
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/aggregationslib.egg-info/SOURCES.txt +16 -4
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/aggregationslib.egg-info/scm_file_list.json +15 -3
- aggregationslib-0.3.0/aggregationslib.egg-info/scm_version.json +8 -0
- aggregationslib-0.3.0/apps/shiny/README.md +70 -0
- aggregationslib-0.3.0/apps/shiny/README.pl.md +70 -0
- 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/apps/shiny/means-icon.svg +20 -0
- aggregationslib-0.3.0/build_docs.ps1 +76 -0
- aggregationslib-0.3.0/docs/CNAME +1 -0
- aggregationslib-0.3.0/docs/_config.yml +5 -0
- aggregationslib-0.3.0/docs/assets/means-icon.svg +20 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/docs/assets/site.css +206 -185
- 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.7 → aggregationslib-0.3.0}/pyproject.toml +1 -1
- aggregationslib-0.3.0/tests/data/wolfram_quadratic_reference.json +86 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/tests/test_aggregations.py +14 -2
- aggregationslib-0.3.0/tests/test_lehmer_zero.py +73 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/tests/test_ndarray.py +2 -1
- aggregationslib-0.3.0/tests/test_quadratic_stability.py +38 -0
- aggregationslib-0.3.0/tests/test_shiny_app.py +203 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/tests/test_shiny_evaluation.py +38 -2
- aggregationslib-0.2.7/aggregationslib.egg-info/scm_version.json +0 -8
- aggregationslib-0.2.7/apps/shiny/README.md +0 -118
- aggregationslib-0.2.7/apps/shiny/app.py +0 -513
- aggregationslib-0.2.7/apps/shiny/core.py +0 -170
- aggregationslib-0.2.7/apps/shiny/evaluation.py +0 -98
- aggregationslib-0.2.7/build_docs.ps1 +0 -49
- aggregationslib-0.2.7/docs/.nojekyll +0 -1
- aggregationslib-0.2.7/docs/en/index.html +0 -80
- aggregationslib-0.2.7/docs/pl/index.html +0 -80
- aggregationslib-0.2.7/tests/test_shiny_app.py +0 -101
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/.gitignore +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/LICENSE +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/aggregation_classification.html +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/aggregationslib/cli.py +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/aggregationslib/conjuctive/__init__.py +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/aggregationslib/conjuctive/purepython.py +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/aggregationslib/disjunctive/__init__.py +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/aggregationslib/example.py +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/aggregationslib/feature_selection/__init__.py +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/aggregationslib/feature_selection/binary_fuzzy_entropy.py +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/aggregationslib/feature_selection/fuzzy_com_entropy.py +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/aggregationslib/models/__init__.py +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/aggregationslib/models/ensemble/__init__.py +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/aggregationslib/models/ensemble/aggregation_regressor.py +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/aggregationslib/models/single/__init__.py +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/aggregationslib/purepython.py +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/aggregationslib.egg-info/dependency_links.txt +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/aggregationslib.egg-info/entry_points.txt +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/aggregationslib.egg-info/requires.txt +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/aggregationslib.egg-info/top_level.txt +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/apps/shiny/column-selection.js +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/apps/shiny/example.csv +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/assets/icons/icon.ico +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/assets/icons/icon.png +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/assets/icons/icon.svg +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/commands.md +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/diagram-aggregation-classification.svg +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/diagram-implikacja-agregacja.svg +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/diagram-klasyfikacja-agregacji.svg +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/diagram-odwzorowanie.svg +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/docs/aggregation-classes.md +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/docs/aggregation-plots.md +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/docs/aggregation_classification.html +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/docs/assets/aggregation-surfaces-all.png +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/docs/assets/aggregation-surfaces.png +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/docs/assets/aggregations/A_amn_p=0.5.png +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/docs/assets/aggregations/A_amx_p=0.5.png +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/docs/assets/aggregations/A_ar.png +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/docs/assets/aggregations/A_ex2_p=2,q=2.png +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/docs/assets/aggregations/A_ex3_p=2,q=1.5.png +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/docs/assets/aggregations/A_ex_r=1.png +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/docs/assets/aggregations/A_gm.png +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/docs/assets/aggregations/A_hm.png +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/docs/assets/aggregations/A_lm_r=2.png +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/docs/assets/aggregations/A_lo.png +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/docs/assets/aggregations/A_md.png +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/docs/assets/aggregations/A_mn.png +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/docs/assets/aggregations/A_mx.png +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/docs/assets/aggregations/A_ol.png +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/docs/assets/aggregations/A_oln_p=1.png +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/docs/assets/aggregations/A_pr.png +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/docs/assets/aggregations/A_pw_r=2.png +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/docs/assets/aggregations/A_qd.png +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/docs/assets/diagram-aggregation-classification.svg +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/docs/assets/diagram-klasyfikacja-agregacji.svg +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/docs/fuzzy-integrals.md +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/docs/index.html +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/docs/klasyfikacja_agregacji.html +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/generate_aggregation_plots.py +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/klasyfikacja_agregacji.html +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/setup.cfg +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/tests/__init__.py +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/tests/data/README.md +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/tests/data/wolfram_integral_reference.json +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/tests/data/wolfram_measure_reference.json +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/tests/test_decimal_exponential_mean.py +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/tests/test_decimal_fuzzy_integrals.py +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/tests/test_exponential_cardinality.py +0 -0
- {aggregationslib-0.2.7 → aggregationslib-0.3.0}/tests/test_fuzzy_integrals.py +0 -0
- {aggregationslib-0.2.7 → 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,36 +25,40 @@ 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
|
|
|
35
|
-
- English
|
|
36
|
-
- Polski
|
|
33
|
+
- `English <https://wgalka.github.io/Means/en/>`__
|
|
34
|
+
- `Polski <https://wgalka.github.io/Means/pl/>`__
|
|
37
35
|
|
|
38
|
-
Aggregation functions can be classified in several ways. A familiar
|
|
39
|
-
is between three types of behaviour:
|
|
36
|
+
Aggregation functions can be classified in several ways. A familiar
|
|
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
|
-
These are not the only possibilities: aggregation functions can also
|
|
46
|
-
mixed behaviour. The diagram below presents a broader
|
|
44
|
+
These are not the only possibilities: aggregation functions can also
|
|
45
|
+
exhibit mixed behaviour. The diagram below presents a broader
|
|
46
|
+
classification.
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
:alt: Classification of aggregation functions
|
|
50
|
-
:target: https://wgalka.github.io/Means/aggregation_classification.html
|
|
48
|
+
|Classification of aggregation functions|
|
|
51
49
|
|
|
52
|
-
*Diagram elaborated on the basis of: A. Pradera, G. Beliakov, H.
|
|
50
|
+
*Diagram elaborated on the basis of: A. Pradera, G. Beliakov, H.
|
|
51
|
+
Bustince, B. De Baets, "A review of the relationships between
|
|
52
|
+
implication, negation and aggregation functions from the point of view
|
|
53
|
+
of material implication", Information Sciences 329 (2016) 357–380,*
|
|
54
|
+
`DOI:
|
|
55
|
+
10.1016/j.ins.2015.09.033 <https://doi.org/10.1016/j.ins.2015.09.033>`__\ *.*
|
|
53
56
|
|
|
54
|
-
An interactive version of this diagram is available at:
|
|
57
|
+
An interactive version of this diagram is available at:
|
|
58
|
+
https://wgalka.github.io/Means/aggregation_classification.html
|
|
55
59
|
|
|
56
60
|
Example 1:
|
|
57
|
-
|
|
61
|
+
----------
|
|
58
62
|
|
|
59
63
|
.. code:: pycon
|
|
60
64
|
|
|
@@ -70,8 +74,8 @@ Example 1:
|
|
|
70
74
|
# use combination of aggregation funciton
|
|
71
75
|
print(func2(data))
|
|
72
76
|
|
|
73
|
-
|
|
74
|
-
|
|
77
|
+
Example 2:
|
|
78
|
+
----------
|
|
75
79
|
|
|
76
80
|
To get information about aggregation function you can use ``__str__()``
|
|
77
81
|
or '**repr**\ ()' methods.
|
|
@@ -90,6 +94,49 @@ or '**repr**\ ()' methods.
|
|
|
90
94
|
print(func3.__repr__()) # function parameters are printed in order: func1, func2
|
|
91
95
|
>>>A_arpw(r=3)
|
|
92
96
|
|
|
97
|
+
Multidimensional arrays
|
|
98
|
+
-----------------------
|
|
99
|
+
|
|
100
|
+
``aggregationslib.ndarray`` provides the same ``A_...`` objects as
|
|
101
|
+
``aggregationslib.aggregations``, with additional constructor options
|
|
102
|
+
``axis`` and ``keepdims``. It applies the existing vector implementation
|
|
103
|
+
separately to each vector along the selected axis.
|
|
104
|
+
|
|
105
|
+
.. code:: python
|
|
106
|
+
|
|
107
|
+
import numpy as np
|
|
108
|
+
from aggregationslib.ndarray import A_ar, A_ch
|
|
109
|
+
from aggregationslib import weighted_measure
|
|
110
|
+
|
|
111
|
+
X = np.array([[0.2, 0.6, 0.9], [0.9, 0.2, 0.6]])
|
|
112
|
+
A_ar(axis=1)(X) # shape (2,): one value per row
|
|
113
|
+
A_ar(axis=0)(X) # shape (3,): one value per column
|
|
114
|
+
A_ar(axis=1, keepdims=True)(X) # shape (2, 1)
|
|
115
|
+
A_ar()(X) # scalar: aggregate all elements
|
|
116
|
+
|
|
117
|
+
mu = weighted_measure([0.5, 0.3, 0.2])
|
|
118
|
+
A_ch(measure=mu, axis=-1)(X) # array([0.46, 0.63])
|
|
119
|
+
|
|
120
|
+
``axis=None`` (the default) flattens the input in C order. An integer
|
|
121
|
+
axis, including a negative index, reduces that axis; tuples of axes are
|
|
122
|
+
not supported. For an input of shape ``(m, n)``, ``axis=1`` returns
|
|
123
|
+
shape ``(m,)``, including ``(1,)`` when there is just one row.
|
|
124
|
+
``keepdims=True`` retains reduced dimensions with length one. A complete
|
|
125
|
+
reduction returns a scalar unless ``keepdims=True``.
|
|
126
|
+
|
|
127
|
+
Choquet and Sugeno use the same measure for each vector. Its size must
|
|
128
|
+
match the selected axis length, or the total element count for
|
|
129
|
+
``axis=None``. Choquet's ``quasi_overlap`` continues to accept scalar
|
|
130
|
+
callbacks. ``Combine2Aggregations`` accepts vector callables or objects
|
|
131
|
+
from this module; the combination's own ``axis`` and ``keepdims``
|
|
132
|
+
control the reduction.
|
|
133
|
+
|
|
134
|
+
Empty vectors are rejected. An empty batch of nonempty vectors returns
|
|
135
|
+
an empty floating-point array of the appropriate shape. The mathematical
|
|
136
|
+
domains, parameter rules and numerical behavior are inherited from the
|
|
137
|
+
vector implementations. This module uses iteration over vectors, not
|
|
138
|
+
vectorized implementations of the aggregation formulas.
|
|
139
|
+
|
|
93
140
|
Aggregation functions
|
|
94
141
|
---------------------
|
|
95
142
|
|
|
@@ -114,7 +161,8 @@ intervals. ``[0,1]`` means only the unit interval. These are
|
|
|
114
161
|
mathematical properties; most callable objects do not validate input
|
|
115
162
|
bounds at runtime. Some tags depend on parameters or the fuzzy measure.
|
|
116
163
|
|
|
117
|
-
:math:`\mathbf{A_{ch}^{(\mu)}}`
|
|
164
|
+
:math:`\mathbf{A_{ch}^{(\mu)}}` - Discrete Choquet integral [1]
|
|
165
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
118
166
|
|
|
119
167
|
Tags: ``averaging`` ``aggregation interval: [0,1]``
|
|
120
168
|
``symmetric if μ is symmetric``
|
|
@@ -150,10 +198,11 @@ Each constructor returns a monotone fuzzy measure with
|
|
|
150
198
|
:math:`\mu(A)=\sum_{j=1}^{|A|}w_j`. The normalized weights are applied
|
|
151
199
|
by descending value rank, so the first belongs to the largest value;
|
|
152
200
|
with the Choquet integral this capacity gives the OWA aggregation.
|
|
153
|
-
- **Exponential cardinality**
|
|
201
|
+
- **Exponential cardinality**
|
|
202
|
+
(``exponential_cardinality_measure(n, q=1)``):
|
|
154
203
|
:math:`\mu(A)=(|A|/n)^q`, where ``q`` must be finite and :math:`q>0`.
|
|
155
|
-
For :math:`q=1`, this is the uniform/cardinality measure, and the
|
|
156
|
-
Choquet integral equals the arithmetic mean.
|
|
204
|
+
For :math:`q=1`, this is the uniform/cardinality measure, and the
|
|
205
|
+
discrete Choquet integral equals the arithmetic mean.
|
|
157
206
|
|
|
158
207
|
The constructors are in ``aggregationslib.aggregation``; Decimal
|
|
159
208
|
equivalents are available in ``aggregationslib.decimalaggregations``.
|
|
@@ -167,7 +216,8 @@ two-argument function ``O(x, mu)`` as ``quasi_overlap`` to
|
|
|
167
216
|
``choquet_integral`` or ``A_ch``. The default remains the classical
|
|
168
217
|
product-based Choquet integral.
|
|
169
218
|
|
|
170
|
-
:math:`\mathbf{A_{sg}^{(\mu)}}`
|
|
219
|
+
:math:`\mathbf{A_{sg}^{(\mu)}}` - Discrete Sugeno integral [1]
|
|
220
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
171
221
|
|
|
172
222
|
Tags: ``averaging`` ``aggregation interval: [0,1]``
|
|
173
223
|
``symmetric if μ is symmetric``
|
|
@@ -206,18 +256,21 @@ available in ``aggregationslib.aggregation`` and
|
|
|
206
256
|
by descending value rank, so the first belongs to the largest value.
|
|
207
257
|
In the Sugeno integral this capacity is used in the max–min formula;
|
|
208
258
|
the result is not the OWA aggregation.
|
|
209
|
-
- **Exponential cardinality**
|
|
259
|
+
- **Exponential cardinality**
|
|
260
|
+
(``exponential_cardinality_measure(n, q=1)``):
|
|
210
261
|
:math:`\mu(A)=(|A|/n)^q`, where ``q`` must be finite and :math:`q>0`.
|
|
211
262
|
For :math:`q=1`, this is the uniform/cardinality measure.
|
|
212
263
|
|
|
213
|
-
:math:`\mathbf{A_{ar}}`
|
|
264
|
+
:math:`\mathbf{A_{ar}}` - Arithmetic mean
|
|
265
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
214
266
|
|
|
215
267
|
Tags: ``averaging`` ``symmetric``
|
|
216
268
|
``aggregation interval: any [a,b] ⊂ ℝ``
|
|
217
269
|
|
|
218
270
|
.. math:: A_{ar}(x_1,...,x_n)=\frac{1}{n}\sum \limits_{k=1}^{n} x_k
|
|
219
271
|
|
|
220
|
-
:math:`\mathbf{A_{qd}}`
|
|
272
|
+
:math:`\mathbf{A_{qd}}` - Quadratic mean
|
|
273
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
221
274
|
|
|
222
275
|
Tags: ``averaging`` ``symmetric``
|
|
223
276
|
``aggregation interval: any [a,b] ⊆ [0,∞)``
|
|
@@ -227,13 +280,22 @@ Tags: ``averaging`` ``symmetric``
|
|
|
227
280
|
A_{qd}(x_1,...,x_n)=\sqrt{\frac{1}{n}\sum
|
|
228
281
|
\limits_{k=1}^{n} x_k^2}
|
|
229
282
|
|
|
230
|
-
|
|
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
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
231
292
|
|
|
232
293
|
Tags: ``conjunctive`` ``symmetric`` ``aggregation interval: [0,1]``
|
|
233
294
|
|
|
234
295
|
.. math:: A_{pr}(x_1, x_2, \dots, x_n) = \prod_{k=1}^n x_k
|
|
235
296
|
|
|
236
|
-
:math:`\mathbf{A_{gm}}`
|
|
297
|
+
:math:`\mathbf{A_{gm}}` - Geometric mean
|
|
298
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
237
299
|
|
|
238
300
|
Tags: ``averaging`` ``symmetric``
|
|
239
301
|
``aggregation interval: any [a,b] ⊆ [0,∞)``
|
|
@@ -243,7 +305,8 @@ Tags: ``averaging`` ``symmetric``
|
|
|
243
305
|
A_{gm}(x_1,...,x_n)=\sqrt[n]{\prod
|
|
244
306
|
\limits_{k=1}^{n} x_k}
|
|
245
307
|
|
|
246
|
-
:math:`\mathbf{A_{hm}}`
|
|
308
|
+
:math:`\mathbf{A_{hm}}` - Harmonic mean
|
|
309
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
247
310
|
|
|
248
311
|
Tags: ``averaging`` ``symmetric``
|
|
249
312
|
``aggregation interval: any [a,b] ⊆ [0,∞)``
|
|
@@ -257,7 +320,8 @@ Tags: ``averaging`` ``symmetric``
|
|
|
257
320
|
\frac{n}{\sum\limits_{k=1}^{n} \frac{1}{x_k}}, & \text{otherwise}
|
|
258
321
|
\end{cases}
|
|
259
322
|
|
|
260
|
-
:math:`\mathbf{A_{pw}^{(r)}}`
|
|
323
|
+
:math:`\mathbf{A_{pw}^{(r)}}` - Power mean
|
|
324
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
261
325
|
|
|
262
326
|
Tags: ``averaging`` ``symmetric``
|
|
263
327
|
``aggregation interval: any [a,b] ⊆ [0,∞)`` ``r ≠ 0``
|
|
@@ -281,7 +345,8 @@ special cases of power means :math:`A_{\text{pw}}^r` [1] are:
|
|
|
281
345
|
|
|
282
346
|
--------------
|
|
283
347
|
|
|
284
|
-
:math:`\mathbf{A_{ex}^{(r)}}`
|
|
348
|
+
:math:`\mathbf{A_{ex}^{(r)}}` - Exponential mean
|
|
349
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
285
350
|
|
|
286
351
|
Tags: ``averaging`` ``symmetric``
|
|
287
352
|
``aggregation interval: any [a,b] ⊂ ℝ`` ``r ≠ 0``
|
|
@@ -300,19 +365,31 @@ formulation by shifting the exponents by
|
|
|
300
365
|
|
|
301
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]
|
|
302
367
|
|
|
303
|
-
:math:`\mathbf{A_{lm}}`
|
|
368
|
+
:math:`\mathbf{A_{lm}}`, :math:`\mathbf{A_{lm1}}` - Lehmer mean
|
|
369
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
304
370
|
|
|
305
371
|
Tags: ``averaging`` ``symmetric``
|
|
306
372
|
``aggregation interval: any [a,b] ⊆ [0,∞) if 0 ≤ r ≤ 1``
|
|
307
373
|
|
|
308
|
-
|
|
374
|
+
For positive inputs, both variants use the same formula:
|
|
309
375
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
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.
|
|
314
386
|
|
|
315
|
-
|
|
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.
|
|
390
|
+
|
|
391
|
+
:math:`\mathbf{A_{amn}^{(p)}}` - Arithmetic minimum mean
|
|
392
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
316
393
|
|
|
317
394
|
Tags: ``averaging`` ``symmetric`` ``conjunctive if p = 0``
|
|
318
395
|
``aggregation interval: any [a,b] ⊂ ℝ`` ``p ∈ [0,1]``
|
|
@@ -322,7 +399,8 @@ Tags: ``averaging`` ``symmetric`` ``conjunctive if p = 0``
|
|
|
322
399
|
A_{amn}^{(p)}(x_1,...,x_n)=\frac{p}{n}\sum \limits_{k=1}^{n} x_k+
|
|
323
400
|
(1-p) \min \limits_{1 \leq k \leq n}x_k, p \in [0, 1]
|
|
324
401
|
|
|
325
|
-
:math:`\mathbf{A_{amx}^{(p)}}`
|
|
402
|
+
:math:`\mathbf{A_{amx}^{(p)}}` - Arithmetic maximum mean
|
|
403
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
326
404
|
|
|
327
405
|
Tags: ``averaging`` ``symmetric`` ``disjunctive if p = 0``
|
|
328
406
|
``aggregation interval: any [a,b] ⊂ ℝ`` ``p ∈ [0,1]``
|
|
@@ -339,7 +417,8 @@ In the case of n = 2 (when only two values are aggregated) the
|
|
|
339
417
|
calculation of the median and the Olympic aggregation are reduced to the
|
|
340
418
|
case of calculating the arithmetic mean of the given values.
|
|
341
419
|
|
|
342
|
-
:math:`\mathbf{A_{md}}`
|
|
420
|
+
:math:`\mathbf{A_{md}}` - Median - ordered weighted aggregation
|
|
421
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
343
422
|
|
|
344
423
|
Tags: ``averaging`` ``symmetric``
|
|
345
424
|
``aggregation interval: any [a,b] ⊂ ℝ``
|
|
@@ -352,14 +431,16 @@ Tags: ``averaging`` ``symmetric``
|
|
|
352
431
|
\frac{y_{n/2}+y_{(n/2)+1}}{2},&\text{if $n$ is even}
|
|
353
432
|
\end{cases},
|
|
354
433
|
|
|
355
|
-
:math:`\mathbf{A_{ol}}`
|
|
434
|
+
:math:`\mathbf{A_{ol}}` - Olimpic aggregation
|
|
435
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
356
436
|
|
|
357
437
|
Tags: ``averaging`` ``symmetric``
|
|
358
438
|
``aggregation interval: any [a,b] ⊂ ℝ``
|
|
359
439
|
|
|
360
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.
|
|
361
441
|
|
|
362
|
-
:math:`\mathbf{A_{oln}^{(p)}}`
|
|
442
|
+
:math:`\mathbf{A_{oln}^{(p)}}` - Olimpic aggregation
|
|
443
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
363
444
|
|
|
364
445
|
Tags: ``averaging`` ``symmetric``
|
|
365
446
|
``aggregation interval: any [a,b] ⊂ ℝ`` ``p ∈ ℕ, p ≥ 1``
|
|
@@ -370,7 +451,8 @@ We can specify how many greatest and smallest records remove
|
|
|
370
451
|
|
|
371
452
|
--------------
|
|
372
453
|
|
|
373
|
-
:math:`\mathbf{A_{ln}}`
|
|
454
|
+
:math:`\mathbf{A_{ln}}` - Logaritmic aggregation [2]
|
|
455
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
374
456
|
|
|
375
457
|
Tags: ``averaging (continuous formula)`` ``symmetric``
|
|
376
458
|
``aggregation interval (after continuous extension): any [a,b] ⊂ (0,∞)``
|
|
@@ -401,3 +483,14 @@ References
|
|
|
401
483
|
Averaging Functions*. Berlin: Springer, vol. 329, 2016.
|
|
402
484
|
2. `Mustonen, Seppo. (2010). Logarithmic mean for several
|
|
403
485
|
arguments. <https://www.researchgate.net/publication/228886844_Logarithmic_mean_for_several_arguments>`__
|
|
486
|
+
|
|
487
|
+
Shiny app
|
|
488
|
+
---------
|
|
489
|
+
|
|
490
|
+
A local interface lets you upload a CSV table, select columns and an
|
|
491
|
+
aggregation, add input vectors, and download row-wise results. It also
|
|
492
|
+
generates the equivalent Python code using ``aggregationslib.ndarray``.
|
|
493
|
+
See `setup and usage <https://wgalka.github.io/Means/en/shiny/>`__.
|
|
494
|
+
|
|
495
|
+
.. |Classification of aggregation functions| image:: https://raw.githubusercontent.com/wgalka/Means/main/docs/assets/diagram-aggregation-classification.svg
|
|
496
|
+
:target: https://wgalka.github.io/Means/aggregation_classification.html
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
# Means
|
|
2
|
-
Means, Aggregation functions...
|
|
3
|
-
|
|
4
1
|
Documentation:
|
|
5
2
|
|
|
6
|
-
- English
|
|
7
|
-
- Polski
|
|
3
|
+
- [English](https://wgalka.github.io/Means/en/)
|
|
4
|
+
- [Polski](https://wgalka.github.io/Means/pl/)
|
|
8
5
|
|
|
9
6
|
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](
|
|
376
|
+
See [setup and usage](https://wgalka.github.io/Means/en/shiny/).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Means
|
|
2
2
|
|
|
3
|
-
Means to biblioteka
|
|
3
|
+
Means to biblioteka, która udostępnia funkcje agregacji dla Python.
|
|
4
4
|
|
|
5
5
|
Dokumentacja:
|
|
6
6
|
|
|
@@ -76,7 +76,7 @@ Przy domyślnej mierze `mu(A) = |A| / n` całka Choqueta jest równa średniej
|
|
|
76
76
|
arytmetycznej: $C_\mu(x_1,\dots,x_n)=(1/n)\sum_{i=1}^n x_i$. Wersje `float` mogą różnić
|
|
77
77
|
się od średniej na ostatnich bitach wskutek zaokrągleń.
|
|
78
78
|
|
|
79
|
-
Szczegóły i przykłady: [całki rozmyte](docs/fuzzy-integrals.md).
|
|
79
|
+
Szczegóły i przykłady: [całki rozmyte](https://github.com/wgalka/Means/blob/main/docs/fuzzy-integrals.md).
|
|
80
80
|
|
|
81
81
|
## Zbiory klasyczne i rozmyte
|
|
82
82
|
|
|
@@ -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ą**.
|
|
@@ -409,7 +416,7 @@ z biblioteki. Zakres jest dobierany osobno dla każdej funkcji, dlatego część
|
|
|
409
416
|
wykresów pokazuje wartości spoza `[0,1]`, a funkcje wymagające dodatnich
|
|
410
417
|
argumentów są rysowane na dziedzinie dodatniej:
|
|
411
418
|
|
|
412
|
-

|
|
419
|
+

|
|
413
420
|
|
|
414
421
|
Wykres można odtworzyć poleceniem:
|
|
415
422
|
|
|
@@ -418,7 +425,7 @@ python .\generate_aggregation_plots.py
|
|
|
418
425
|
```
|
|
419
426
|
|
|
420
427
|
Każdy wykres jest również dostępny osobno w
|
|
421
|
-
[`docs/aggregation-plots.md`](docs/aggregation-plots.md), pod nazwą swojej
|
|
428
|
+
[`docs/aggregation-plots.md`](https://github.com/wgalka/Means/blob/main/docs/aggregation-plots.md), pod nazwą swojej
|
|
422
429
|
funkcji, np. `A_amx`.
|
|
423
430
|
|
|
424
431
|
OWA jest zwykle symetryczny, monotoniczny i idempotentny. W niektórych
|
|
@@ -537,7 +544,7 @@ Dla argumentów `2, 5, 8` funkcja averaging musi spełniać:
|
|
|
537
544
|
Średnia arytmetyczna daje w tym przykładzie `5`.
|
|
538
545
|
|
|
539
546
|
Wizualny schemat klas agregacji znajduje się w pliku
|
|
540
|
-
[`docs/aggregation-classes.md`](docs/aggregation-classes.md).
|
|
547
|
+
[`docs/aggregation-classes.md`](https://github.com/wgalka/Means/blob/main/docs/aggregation-classes.md).
|
|
541
548
|
|
|
542
549
|
## Funkcja dualna i samodualność
|
|
543
550
|
|
|
@@ -739,3 +746,11 @@ A_arpw(r=3)
|
|
|
739
746
|
2. Mustonen, Seppo (2010):
|
|
740
747
|
[Logarithmic mean for several arguments](https://www.researchgate.net/publication/228886844_Logarithmic_mean_for_several_arguments).
|
|
741
748
|
3. [Aggregation functions](https://arxiv.org/pdf/2208.01644).
|
|
749
|
+
|
|
750
|
+
# Aplikacja Shiny
|
|
751
|
+
|
|
752
|
+
Lokalny interfejs pozwala wgrać tabelę CSV, wybrać kolumny oraz funkcję
|
|
753
|
+
agregacji, dopisać dodatkowe wektory i pobrać wyniki dla poszczególnych
|
|
754
|
+
wierszy. Generuje także równoważny kod w Pythonie z użyciem
|
|
755
|
+
`aggregationslib.ndarray`.
|
|
756
|
+
Zobacz [instalację i instrukcję użycia](https://wgalka.github.io/Means/pl/shiny/).
|