BaseMetric
chronax.metrics.base_metric.BaseMetric
Base class for Chronax metrics, providing standardized input validation and preprocessing of predictions (y_pred) based on the model type (deterministic, stochastic, or hybrid) before delegating the final computation to subclass implementations.
__init__(self, metric_type: str)
| Parameter | Type | Default | Description |
|---|---|---|---|
| metric_type | str | - | (undocumented) |
__call__(self, y_true: np.ndarray, y_pred: np.ndarray, **kwargs)
Process y_pred based on model type and delegate to _compute method. This method ensures all subclasses automatically get preprocessed y_pred without needing to manually call process_y_pred.
| Parameter | Type | Default | Description |
|---|---|---|---|
| y_true | np.ndarray | - | (undocumented) |
| y_pred | np.ndarray | - | (undocumented) |
| **kwargs | - | (undocumented) |
Returns: The computed metric value.
Raises: ValueError (If 'model_type' must be provided in kwargs).
process_y_pred(self, y_true: np.ndarray, y_pred: np.ndarray, model_type: str, point_forecast_statistic: str \| None = None) -> np.ndarray
Process y_pred based on model type, applying necessary transformations.
| Parameter | Type | Default | Description |
|---|---|---|---|
| y_true | np.ndarray | - | (undocumented) |
| y_pred | np.ndarray | - | (undocumented) |
| model_type | str | - | (undocumented) |
| point_forecast_statistic | str | None | None | (undocumented) |
Returns: np.ndarray (The processed forecast array).