PrequentialError#
- class frouros.metrics.prequential_error.PrequentialError(alpha: int | float = 1.0, name: str | None = None)#
Prequential error [dawid1984present] using fading factor [gama2009issues] metric.
- Parameters:
alpha (Union[int, float]) – fading factor value, defaults to 1.0
name (Optional[str]) – name value, defaults to None. If None, the name will be set to PrequentialError.
- References:
[dawid1984present]Dawid, A. Philip. “Present position and potential developments: Some personal views statistical theory the prequential approach.” Journal of the Royal Statistical Society: Series A (General) 147.2 (1984): 278-290.
[gama2009issues]Gama, Joao, Raquel Sebastiao, and Pedro Pereira Rodrigues. “Issues in evaluation of stream learning algorithms.” Proceedings of the 15th ACM SIGKDD international conference on Knowledge discovery and data mining. 2009.
- Example:
>>> from frouros.metrics import PrequentialError >>> metric = PrequentialError(alpha=0.9) >>> X = [1, 1, 0, 1, 0, 0] >>> Y = [1, 0, 0, 0, 1, 1] >>> for i, (X_sample, Y_sample) in enumerate(zip(X, Y)): ... error_value = 1 - (X_sample == Y_sample) ... prequential_error = metric(error_value=error_value) ... print(f"Metric={prequential_error:.5f} at step {i}") Metric=0.00000 at step 0 Metric=0.52632 at step 1 Metric=0.33210 at step 2 Metric=0.52632 at step 3 Metric=0.64199 at step 4 Metric=0.71839 at step 5
- property alpha: int | float#
Fading factor property.
- Returns:
fading factor value
- Return type:
Union[int, float]
- property cumulative_instances: int | float#
Cumulative instances’ property.
- Returns:
fading factor value
- Return type:
Union[int, float]
- property cumulative_fading_error: int | float#
Cumulative fading error property.
- Returns:
cumulative facing error value
- Return type:
Union[int, float]
- property name: str#
Metrics’ name property.
- Returns:
metrics’ name
- Return type:
str
- reset() None #
Reset method.