Skip to content

Commit ed5526c

Browse files
Add stats.md to documentation utils
1 parent 39a9fac commit ed5526c

File tree

3 files changed

+32
-13
lines changed

3 files changed

+32
-13
lines changed

docs/source/api_reference/utils.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ The {mod}`frouros.utils` module contains auxiliary classes, functions or excepti
77
88
utils/data_structures
99
utils/kernels
10+
utils/stats
1011
```
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Stats
2+
3+
The {mod}`frouros.utils.stats` module contains auxiliary stats classes or exceptions.
4+
5+
```{eval-rst}
6+
.. automodule:: frouros.utils.stats
7+
:members:
8+
:no-inherited-members:
9+
```

frouros/utils/stats.py

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ def get(self) -> float:
3636
class Mean(IncrementalStat):
3737
"""Incremental mean class."""
3838

39-
def __init__(self) -> None:
40-
"""Init method."""
39+
def __init__( # noqa: D107
40+
self,
41+
) -> None:
4142
self.mean = 0.0
4243
self.num_values = 0
4344

@@ -111,10 +112,16 @@ def get(self) -> float:
111112

112113

113114
class CircularMean(Mean):
114-
"""Circular mean class."""
115+
"""Circular mean class.
115116
116-
def __init__(self, size: int) -> None:
117-
"""Init method."""
117+
:param size: size of the circular mean
118+
:type size: int
119+
"""
120+
121+
def __init__( # noqa: D107
122+
self,
123+
size: int,
124+
) -> None:
118125
super().__init__()
119126
self.queue = CircularQueue(max_len=size)
120127

@@ -137,14 +144,16 @@ def update(self, value: Union[int, float]) -> None:
137144

138145

139146
class EWMA(IncrementalStat):
140-
"""EWMA (Exponential Weighted Moving Average) class."""
147+
"""EWMA (Exponential Weighted Moving Average) class.
141148
142-
def __init__(self, alpha: float) -> None:
143-
"""Init method.
149+
:param alpha: alpha value
150+
:type alpha: float
151+
"""
144152

145-
:param alpha:
146-
:type alpha: float
147-
"""
153+
def __init__( # noqa: D107
154+
self,
155+
alpha: float,
156+
) -> None:
148157
self.alpha = alpha
149158
self.one_minus_alpha = 1.0 - self.alpha
150159
self.mean = 0
@@ -228,9 +237,9 @@ def permutation( # pylint: disable=too-many-arguments,too-many-locals
228237
:type num_permutations: int
229238
:param num_jobs: number of jobs to use
230239
:type num_jobs: int
231-
:param random_state: random state value
240+
:param random_state: random state value, defaults to None
232241
:type random_state: Optional[int]
233-
:param verbose: verbose flag
242+
:param verbose: verbose flag, defaults to False
234243
:type verbose: bool
235244
:return: permuted statistics
236245
:rtype: List[float]

0 commit comments

Comments
 (0)