-
Notifications
You must be signed in to change notification settings - Fork 3
/
_utils.py
38 lines (26 loc) · 976 Bytes
/
_utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import statistics
from typing import Iterable
def get_values_mean(cosines: Iterable[float]) -> float:
"""Calculate the mean of an iterable of values.
Args:
cosines: An iterable of float values.
Returns:
The mean of the values in the iterable.
"""
return statistics.mean(cosines)
def get_values_sample_std(cosines: Iterable[float]) -> float:
"""Calculate the sample standard deviation of an iterable of values.
Args:
cosines: An iterable of float values.
Returns:
The sample standard deviation of the values in the iterable.
"""
return statistics.stdev(cosines)
def get_values_population_std(cosines: Iterable[float]) -> float:
"""Calculate the population standard deviation of an iterable of values.
Args:
cosines: An iterable of float values.
Returns:
The population standard deviation of the values in the iterable.
"""
return statistics.pstdev(cosines)