SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2010.09107 · ICML · 2020

Conformal prediction for time series

Chen Xu, Yao Xie

arXiv · PDF · Open in the Atlas

Code that ran

2 of 2 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 1 failure of our instrument; 0 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2010.09107.json · badge: /api/ran/2010.09107.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
hamrel-cxu/EnbPI canonical (classifier label)
classifier basis: classifier_2025
2 ran · 0 no recorded run
FunctionStatusWhere it lives
prediction_interval Ran
ran on a synthesized input
hamrel-cxu/EnbPI/PI_class_EnbPI.py
code served (permissive licence) · get_code("f8aaf94082872ea5")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned ndarray, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
import pandas as pd
from sklearn.linear_model import Ridge

def generate_bootstrap_samples(n, m, B):
    """
      Return: B-by-m matrix, where row b gives the indices for b-th bootstrap sample
    """
    samples_idx = np.zeros((B, m), dtype=int)
    for b in range(B):
        sample_idx = np.random.choice(n, m)
        samples_idx[b, :] = sample_idx
    return samples_idx

def strided_app(a, L, S):
    nrows = (a.size - L) // S + 1
    n = a.strides[0]
    return np.lib.stride_tricks.as_strided(a, shape=(nrows, L), strides=(S * n, n))

def weighted_quantile(values, quantiles, sample_weight=None, values_sorted=False, old_style=False):
    """ Very close to numpy.percentile, but supports weights.
    NOTE: quantiles should be in [0, 1]!
    :param values: numpy.array with data
    :param quantiles: array-like with many quantiles needed
    :param sample_weight: array-like of the same length as `array`
    :param values_sorted: bool, if True, then will avoid sorting of
        initial array
    :param old_style: if True, will correct output to be consistent
        with numpy.percentile.
    :return: numpy.array with computed quantiles.
    """
    values = np.array(values)
    quantiles = np.array(quantiles)
    if sample_weight is None:
        sample_weight = np.ones(len(values))
    sample_weight = np.array(sample_weight)
    assert np.all(quantiles >= 0) and np.all(quantiles <= 1), 'quantiles should be in [0, 1]'
    if not values_sorted:
        sorter = np.argsort(values)
        values = values[sorter]
        sample_weight = sample_weight[sorter]
    weighted_quantiles = np.cumsum(sample_weight) - 0.5 * sample_weight
    if old_style:
        weighted_quantiles -= weighted_quantiles[0]
        weighted_quantiles /= weighted_quantiles[-1]
    else:
        weighted_quantiles /= np.sum(sample_weight)
    return np.interp(quantiles, weighted_quantiles, values)

class prediction_interval:
    """
        Create prediction intervals using different methods (Ensemble, LOO, ICP, weighted...)
    """

    def __init__(self, fit_func, X_train, X_predict, Y_train, Y_predict):
        """
            Fit_func: ridge, lasso, linear model, data
        """
        self.regressor = fit_func
        self.X_train = X_train
        self.X_predict = X_predict
        self.Y_train = Y_train
        self.Y_predict = Y_predict
        self.Ensemble_fitted_func = []
        self.Ensemble_online_resid = np.array([])
        self.ICP_fitted_func = []
        self.ICP_online_resid = np.array([])
        self.WeightCP_online_resid = np.array([])

    def fit_bootstrap_models_online(self, alpha, B, miss_test_idx):
        """
          Train B bootstrap estimators from subsets of (X_train, Y_train) and calculate predictions on original data X_train
          Return 1-alpha quantile of each prediction on self.X_predict
        """
        n = len(self.X_train)
        n1 = len(self.X_predict)
        boot_samples_idx = generate_bootstrap_samples(n, n, B)
        boot_predictions = np.zeros((B, n + n1), dtype=float)
        in_boot_sample = np.zeros((B, n), dtype=bool)
        out_sample_predict = np.zeros((n, n1))
        ind_q = int((1 - alpha) * n)
        
        for b in range(B):
            model = Ridge()
            model.fit(self.X_train[boot_samples_idx[b], :], self.Y_train[boot_samples_idx[b]])
            combined_X = np.r_[self.X_train, self.X_predict]
            boot_predictions[b] = model.predict(combined_X).flatten()
            self.Ensemble_fitted_func.append(model)
        
        return boot_predictions


X_train = np.random.randn(8, 4)
Y_train = np.random.randn(8)
X_predict = np.random.randn(3, 4)
Y_predict = np.random.randn(3)
fit_func = Ridge()

INIT_ARGS = {
    'fit_func': fit_func,
    'X_train': X_train,
    'X_predict': X_predict,
    'Y_train': Y_train,
    'Y_predict': Y_predict
}

ARGS = {
    'alpha': 0.1,
    'B': 2,
    'miss_test_idx': np.array([])
}

METHOD = 'fit_bootstrap_models_online'

if __name__ == '__main__':
    instance = prediction_interval(**INIT_ARGS)
    result = getattr(instance, METHOD)(**ARGS)
    print("Result shape:", result.shape)
    print("Ensemble fitted functions count:", len(instance.Ensemble_fitted_func))
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
keras, matplotlib, numpy, pandas, sklearn, statsmodels — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
weighted_quantile Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
hamrel-cxu/EnbPI/PI_class_EnbPI.py
code served (permissive licence) · get_code("4a1fecc5fdd65c47")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned ndarray, ndim 1, dtype family float, shape (3,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

ARGS = {
    "values": np.array([1.5, 2.3, 3.1, 4.7, 5.2]),
    "quantiles": np.array([0.25, 0.5, 0.75]),
    "sample_weight": np.array([1.0, 2.0, 1.5, 2.5, 1.0]),
    "values_sorted": False,
    "old_style": False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (3,) — shape (3,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block

Also present in other papers' code

Of 2 samples lifted from this paper's linked repositories, 2 carry a function identity and 0 do not. Of the 2 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 2 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

We develop a general framework for constructing distribution-free prediction intervals for time series. Theoretically, we establish explicit bounds on conditional and marginal coverage gaps of estimated prediction intervals, which asymptotically converge to zero under additional assumptions. We obtain similar bounds on the size of set differences between oracle and estimated prediction intervals. Methodologically, we introduce a computationally efficient algorithm called EnbPI that wraps around ensemble predictors, which is closely related to conformal prediction (CP) but does not require data exchangeability. EnbPI avoids data-splitting and is computationally efficient by avoiding retraining and thus scalable to sequentially producing prediction intervals. We perform extensive simulation and real-data analyses to demonstrate its effectiveness compared with existing methods. We also discuss the extension of EnbPI on various other applications.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2010.09107")
get_code_for_paper("2010.09107")
have("2010.09107")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2010.09107.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2010.09107.svg)](https://syntology.ai/paper/2010.09107)

Connect an agent — have() is free.