Python implementation of Arithmetic, quasi arithmetic and other aggregating functions
Project description
Means
Means, Aggregation functions...
Example 1:
Mix numpy and pure python example:
import numpy as np
t1 = [0.0, 0.0, 0.0, 0.0, 0.1]
t2 = [1 - x for x in t1]
mean1 = np.mean(t1)
mean2 = np.mean(t2)
print(t1, mean1)
print(t2, mean2)
In output we can see that returned value does not sum to 1. It have impact on comparasion
>>> [0.0, 0.0, 0.0, 0.0, 0.1] 0.02
>>> [1.0, 1.0, 1.0, 1.0, 0.9] 0.9800000000000001
Using 1:
from aggregationslib.aggregation import arithmetic
t1 = [0.0, 0.0, 0.0, 0.0, 0.1]
t2 = [1 - x for x in t1]
mean1 = arithmetic_(t1)
mean2 = arithmetic_(t2)
print(t1, mean1)
print(t2, mean2)
In implementation we obtain exact number:
>>> [0.0, 0.0, 0.0, 0.0, 0.1] 0.02
>>> [1.0, 1.0, 1.0, 1.0, 0.9] 0.98
exponential(y, r=1)
is given by equation $A_6^{(r)}(x_1,...,x_n)= \frac{1}{r}\ln
\Big(\frac{1}{n} \sum \limits_{k=1}^{n} e^{rx_k}\Big)$, where
$r \in \mathbb{R}$, $r \neq 0$
1
arithmetic(y)
2
quadratic(y)
3
geometric(y)
4
harmonic(y)
5
power(y, r=1)
6
exponential(y, r=1)
7
lehmer(y, r=0)
8
arithmetic_min(y, p=0)
9
arithmetic_max(y, p=0)
10
median(y)
11
olimpic(y)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for aggregationslib-0.0.252-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3065325765b45662480cc7fb0ef2b2e86f44e378177c9b18c77dfd62b5351cf6 |
|
MD5 | 7ab839aa34902f2f6ba3ab64bf803893 |
|
BLAKE2b-256 | 2d716ff505add1d8927dfcd1343cdb38347cb498a0e121d26fb1a357805f7265 |