Stats#
The frouros.utils.stats module contains auxiliary stats classes or exceptions.
Stats module.
- class frouros.utils.stats.BaseStat#
Abstract class representing an statistic.
- abstract get() float#
Get method.
- class frouros.utils.stats.IncrementalStat#
Abstract class representing an incremental statistic.
- abstract update(value: Union[int, float]) None#
Update abstract method.
- abstract get() float#
Get method.
- class frouros.utils.stats.Mean#
Incremental mean class.
- property mean: float#
Mean property.
- Returns:
mean value
- Return type:
float
- property num_values: int#
Number of values property.
- Returns:
number of values
- Return type:
int
- update(value: Union[int, float]) None#
Update the mean value sequentially.
- Parameters:
value (int) – value to use to update the mean
- Raises:
TypeError – Type error exception
- static incremental_op(value: Union[int, float], element: Union[int, float], size: int) float#
Incremental operation.
- get() float#
Get method.
- class frouros.utils.stats.CircularMean(size: int)#
Circular mean class.
- Parameters:
size (int) – size of the circular mean
- update(value: Union[int, float]) None#
Update the mean value sequentially.
- Parameters:
value (int) – value to use to update the mean
- Raises:
TypeError – Type error exception
- class frouros.utils.stats.EWMA(alpha: float)#
EWMA (Exponential Weighted Moving Average) class.
- Parameters:
alpha (float) – alpha value
- property alpha: float#
Alpha property.
- Returns:
alpha value
- Return type:
float
- property mean: float#
Mean property.
- Returns:
mean value
- Return type:
float
- update(value: Union[int, float]) None#
Update the mean value sequentially.
- Parameters:
value (int) – value to use to update the mean
- Raises:
TypeError – Type error exception
- get() float#
Get method.
- frouros.utils.stats.permutation(X: ndarray, Y: ndarray, statistic: Callable, statistical_args: Dict[str, Any], num_permutations: int, num_jobs: int, random_state: Optional[int] = None, verbose: bool = False) List[float]#
Permutation method.
- Parameters:
X (numpy.ndarray) – reference data
Y (numpy.ndarray) – test data
statistic (Callable) – statistic to use
statistical_args (Dict[str, Any]) – args to pass to statistic method
num_permutations (int) – number of permutations to use
num_jobs (int) – number of jobs to use
random_state (Optional[int]) – random state value, defaults to None
verbose (bool) – verbose flag, defaults to False
- Returns:
permuted statistics
- Return type:
List[float]