IntervalScore¶
yohou.metrics.interval.IntervalScore
¶
Bases: BaseIntervalScorer
Interval Score (Winkler Score) for prediction intervals.
Combines interval width with penalties for observations falling outside the interval. Balances sharpness and coverage in a single metric.
The interval score for coverage rate α is:
where the first term is interval width and the second/third terms are penalties for under/over-coverage.
Parameters¶
| Name | Type | Description | Default |
|---|---|---|---|
aggregation_method
|
list of str or str
|
Dimensions to collapse when aggregating scores. Orthogonal modes:
|
"all"
|
coverage_rates
|
list of float, dict of float to float, or None
|
Coverage rate filter (list) or filter with weights (dict). |
None
|
groups
|
list of str, dict of str to float, or None
|
Panel group filter (list) or filter with weights (dict). |
None
|
components
|
list of str, dict of str to float, or None
|
Component filter (list) or filter with weights (dict). |
None
|
Attributes¶
| Name | Type | Description |
|---|---|---|
lower_is_better |
bool
|
True for interval score (lower is better). |
Examples¶
>>> import polars as pl
>>> from datetime import datetime
>>> from yohou.metrics import IntervalScore
>>> y_true = pl.DataFrame({"time": [datetime(2020, 1, 1), datetime(2020, 1, 2)], "value": [10.0, 20.0]})
>>> y_pred = pl.DataFrame({
... "vintage_time": [datetime(2019, 12, 31)] * 2,
... "time": [datetime(2020, 1, 1), datetime(2020, 1, 2)],
... "value_lower_0.9": [8.0, 18.0],
... "value_upper_0.9": [12.0, 22.0],
... })
>>> scorer = IntervalScore()
>>> _ = scorer.fit(y_true)
>>> scorer.score(y_true, y_pred)
4.0
Notes¶
- Lower is better
- Penalizes both wide intervals and poor coverage
- Scale-dependent (same units as target)
- Also known as "Winkler score" in literature
- Widely used in forecasting competitions (M4, M5)
See Also¶
EmpiricalCoverage: Coverage-only metricMeanIntervalWidth: Width-only metricPinballLoss: Asymmetric quantile-based metric
Source Code¶
Show/Hide source
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | |
Tutorials¶
The following example notebooks use this component:
-
How to Use Conformity Scorers
Evaluation-Search
Compare Residual, AbsoluteResidual, GammaResidual, and AbsoluteGammaResidual conformity scorers with coverage/width analysis and DistanceSimilarity interaction.
-
How to Evaluate Interval Forecasts
Evaluation-Search
Evaluate prediction intervals with EmpiricalCoverage, IntervalScore, MeanIntervalWidth, PinballLoss, and CalibrationError across coverage levels.
-
How to Search Interval Forecaster Hyperparameters
Evaluation-Search
Tune interval forecaster parameters directly with interval metrics in GridSearchCV, including mixed point+interval multimetric search.
-
How to Forecast Intervals with CatBoost Multiquantile
Forecasting-Models
Use IntervalReductionForecaster with CatBoost's native multiquantile objective for simultaneous lower and upper bound estimation.
-
How to Use Distance-Based Similarity for Intervals
Forecasting-Models
Adaptive prediction intervals via similarity-weighted conformal prediction using DistanceSimilarity with configurable distance metrics and bandwidths.
-
How to Build Interval Forecasts with Reduction
Forecasting-Models
Wrap any quantile-capable sklearn estimator with IntervalReductionForecaster to produce calibrated prediction intervals across multiple horizons.
-
Conformal Prediction Intervals
Getting-Started
Build distribution-free prediction intervals with SplitConformalForecaster using calibration holdouts and configurable conformity scoring functions.