#4420·sktime

[BUG] sporadic failure in `test_predict_quantiles` during monotonicity check for `VAR`

Author: yarnabrinaCreated Apr 2, 2023Updated Sep 27, 2026
Labelsbugmodule:forecasting

Describe the bug

Since quantile function if non-decreasing, predicted quantiles should be monotone, i.e. prediction of smaller quantile should not be larger than that for higher quantile. For VAR, this check is failing occasionally.

To Reproduce

This script takes a fixture name for VAR as an input and number of replications as another. It repeats the corresponding fixture that number of times and then prints the proportion of times it failed.

python
# test_random_failures.py
import argparse
import statistics
import warnings

from sktime.forecasting.var import VAR
from sktime.utils.estimator_checks import check_estimator

warnings.filterwarnings("ignore")

parser = argparse.ArgumentParser()

parser.add_argument("fixture", type=str)
parser.add_argument("replication", type=int)

parsed_arguments, _ = parser.parse_known_args()

results = list(
    check_estimator(VAR, fixtures_to_run=parsed_arguments.fixture)[
        parsed_arguments.fixture
    ]
    for _ in range(parsed_arguments.replication)
)
print(statistics.mean(result != "PASSED" for result in results))

Running the following leads to these results:

bash
❯ python test_random_failures.py "test_predict_quantiles[VAR-0-fh=1-alpha=[0.25, 0.75]]" 1000
...
0.066
❯ python test_random_failures.py "test_predict_quantiles[VAR-0-fh=[2 5]-alpha=[0.25, 0.75]]" 1000
...
0.048

Expected behavior

The tests should pass all the time, leading zero failure proportion.

Additional context

See https://github.com/sktime/sktime/pull/4394#issuecomment-1493244223.

Versions

The above results are on Ubuntu WSL running on Windows 11. The local environment is using Python 3.8.16 and have editable sktime installation same as https://github.com/sktime/sktime/pull/4394/commits/80ccaf7512abd057ee485fe85713a7177cc2e7ca.

Note: show_versions() failed with following, so unable to share that information:

AssertionError: assert '_distutils' in core.file, core.file