Skip to content

AbsoluteQuantileResidual

yohou.metrics.conformity.AbsoluteQuantileResidual

Bases: BaseConformityScorer

Absolute quantile residual scorer for interval forecasts.

Abstract base class for absolute quantile-based conformity scoring. Subclasses must implement the score method to compute absolute residuals between observed values and predicted interval bounds.

Notes

Unlike AbsoluteResidual and AbsoluteGammaResidual, this scorer operates on interval predictions. The prediction_type tag is set to "interval".

See Also

Source Code

Show/Hide source
class AbsoluteQuantileResidual(BaseConformityScorer):
    """Absolute quantile residual scorer for interval forecasts.

    Abstract base class for absolute quantile-based conformity scoring.
    Subclasses must implement the ``score`` method to compute absolute
    residuals between observed values and predicted interval bounds.

    Notes
    -----
    Unlike ``AbsoluteResidual`` and ``AbsoluteGammaResidual``, this scorer
    operates on interval predictions. The ``prediction_type`` tag is set
    to ``"interval"``.

    See Also
    --------
    - [`QuantileResidual`][yohou.metrics.conformity.QuantileResidual] : Signed variant of quantile residuals.
    - [`AbsoluteResidual`][yohou.metrics.conformity.AbsoluteResidual] : Point-prediction absolute conformity scorer.

    """

    def __sklearn_tags__(self):
        """Get the tags for this estimator."""
        tags = super().__sklearn_tags__()
        assert tags.scorer_tags is not None
        tags.scorer_tags.prediction_type = "interval"
        return tags

    @abc.abstractmethod
    def score(self, y_truth: pl.DataFrame, y_pred: pl.DataFrame, /, **score_params) -> pl.DataFrame:
        """Compute absolute quantile residual scores."""

Methods

__sklearn_tags__()

Get the tags for this estimator.

Source Code
Show/Hide source
def __sklearn_tags__(self):
    """Get the tags for this estimator."""
    tags = super().__sklearn_tags__()
    assert tags.scorer_tags is not None
    tags.scorer_tags.prediction_type = "interval"
    return tags

score(y_truth, y_pred, /, **score_params) abstractmethod

Compute absolute quantile residual scores.

Source Code
Show/Hide source
@abc.abstractmethod
def score(self, y_truth: pl.DataFrame, y_pred: pl.DataFrame, /, **score_params) -> pl.DataFrame:
    """Compute absolute quantile residual scores."""