SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2106.03904 · NeurIPS · 2021

When in Doubt: Neural Non-Parametric Uncertainty Quantification for Epidemic Forecasting

Lingkai Kong, Chao Zhang, Alexander Rodríguez, B Prakash, Harshavardhan Kamarthi

arXiv · PDF · Open in the Atlas

Code that ran

6 of 10 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; 1 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 2 failures of our instrument; 4 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/2106.03904.json · badge: /api/ran/2106.03904.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
adityalab/epifnp canonical (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
AdityaLab/EpiFNP marked official in Papers with Code
Papers with Code archive
5 ran · 4 no recorded run
FunctionStatusWhere it lives
LatentAtten Ran
ran on a synthesized input
AdityaLab/EpiFNP/models/fnpmodels.py
code served (permissive licence) · get_code("d15489d7cc9fb382")
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 Tensor, ndim 2, dtype family float, shape (2, 2) 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 torch
import torch.nn as nn

INIT_ARGS = {
    'h_dim': 4,
    'key_dim': 3,
}

ARGS = {
    'h_M': torch.randn(2, 4),
    'h_R': torch.randn(2, 4),
}

if __name__ == '__main__':
    model = nn.Module()
    
    # Import the class
    import math
    
    class LatentAtten(nn.Module):
        """
        Attention on latent representation
        """

        def __init__(self, h_dim, key_dim=None) -> None:
            super(LatentAtten, self).__init__()
            if key_dim is None:
                key_dim = h_dim
            self.key_dim = key_dim
            self.key_layer = nn.Linear(h_dim, key_dim)
            self.query_layer = nn.Linear(h_dim, key_dim)

        def forward(self, h_M, h_R):
            key = self.key_layer(h_M)
            query = self.query_layer(h_R)
            atten = key @ query.transpose(0, 1) / math.sqrt(self.key_dim)
            atten = torch.softmax(atten, 1)
            return atten
    
    # Construct and call
    model = LatentAtten(**INIT_ARGS)
    output = model(**ARGS)
    print("Output shape:", output.shape)
    print("Output:\n", output)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 2) — shape (2, 2) 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
LogitRelaxedBernoulli Ran
ran on a synthesized input
AdityaLab/EpiFNP/models/fnpmodels.py
code served (permissive licence) · get_code("969316ef79790b96")
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 Tensor, ndim 2, dtype family float, shape (2, 4) 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 torch
import math
import torch.nn.functional as F

class LogitRelaxedBernoulli(object):

    def __init__(self, logits, temperature=0.3, **kwargs):
        self.logits = logits
        self.temperature = temperature

    def rsample(self):
        eps = torch.clamp(torch.rand(self.logits.size(), dtype=self.logits.dtype, device=self.logits.device), min=1e-06, max=1 - 1e-06)
        y = (self.logits + torch.log(eps) - torch.log(1.0 - eps)) / self.temperature
        return y

    def log_prob(self, value):
        return math.log(self.temperature) - self.temperature * value + self.logits - 2 * F.softplus(-self.temperature * value + self.logits)


INIT_ARGS = {
    'logits': torch.randn(2, 4),
    'temperature': 0.3,
}

ARGS = {
    'value': torch.randn(2, 4),
}

METHOD = 'log_prob'


if __name__ == '__main__':
    instance = LogitRelaxedBernoulli(**INIT_ARGS)
    result = getattr(instance, METHOD)(**ARGS)
    print("Result shape:", result.shape if hasattr(result, 'shape') else type(result))
    print("Result:", result)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
Normal Ran
ran on a synthesized input
AdityaLab/EpiFNP/models/fnpmodels.py
code served (permissive licence) · get_code("d6d10a4f1222f2b0")
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 Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 torch
import math

float_tensor = torch.cuda.FloatTensor if torch.cuda.is_available() else torch.FloatTensor

class Normal(object):

    def __init__(self, means, logscales, **kwargs):
        self.means = means
        self.logscales = logscales

    def log_prob(self, value):
        log_prob = torch.pow(value - self.means, 2)
        log_prob *= -(1 / (2.0 * self.logscales.mul(2.0).exp()))
        log_prob -= self.logscales + 0.5 * math.log(2.0 * math.pi)
        return log_prob

    def sample(self, **kwargs):
        eps = torch.normal(float_tensor(self.means.size()).zero_(), float_tensor(self.means.size()).fill_(1))
        return self.means + self.logscales.exp() * eps

    def rsample(self, **kwargs):
        return self.sample(**kwargs)


INIT_ARGS = {
    'means': torch.randn(2, 4),
    'logscales': torch.randn(2, 4),
}

ARGS = {
    'value': torch.randn(2, 4),
}

METHOD = 'log_prob'

if __name__ == '__main__':
    instance = Normal(**INIT_ARGS)
    result = getattr(instance, METHOD)(**ARGS)
    print("Result shape:", result.shape)
    print("Result:", result)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
logitexp Ran
ran; our contract draft was wrong, not the code
AdityaLab/EpiFNP/models/fnpmodels.py
code served (permissive licence) · get_code("c5214c9940d62f9b")
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 Tensor, ndim 2, dtype family float, shape (2, 4) 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 torch

torch.manual_seed(0)

# logitexp takes a single parameter: logp
# which should be a tensor that the function performs clamping and log operations on
logp = torch.randn(2, 4)

ARGS = {
    "logp": logp
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) 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
one_hot Ran
ran, honoured the contract we drafted
adityalab/epifnp/train_ili.py
code served (permissive licence) · get_code("a5a22adb6b1bdc7e")
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 (10,) 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

city_idx = {f'Region {i}': i for i in range(1, 11)}

def one_hot(idx, dim=len(city_idx)):
    ans = np.zeros(dim, dtype='float32')
    ans[idx] = 1.0
    return ans

ARGS = {
    'idx': 3,
    'dim': len(city_idx)
}
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 (10,) — shape (10,) 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
order_z Ran
ran; our contract draft was wrong, not the code
AdityaLab/EpiFNP/models/fnpmodels.py
code served (permissive licence) · get_code("b6972a75eef49950")
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 Tensor, ndim 2, dtype family float, shape (2, 1) 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 torch
import math

torch.manual_seed(0)

# The function order_z takes a tensor z and:
# 1. Checks z.size(1) to see if it equals 1
# 2. If not, computes log_cdf using z with operations along dim=1
# 3. Returns a tensor with keepdim=True on dim=1

# Create a small tensor with batch size 2 and feature dimension 4
z = torch.randn(2, 4)

ARGS = {
    "z": z
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 1) — shape (2, 1) 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
RegressionFNP Not yet run
unverified (harvested, no recorded run)
AdityaLab/EpiFNP/models/fnpmodels.py
code served (permissive licence) · get_code("ab492d2caa9b814b")
How it ran

no invocation recorded.

sample_Clique Not yet run
unverified (harvested, no recorded run)
AdityaLab/EpiFNP/models/fnpmodels.py
code served (permissive licence) · get_code("fe7a55d9d9cb5019")
How it ran

no invocation recorded.

sample_DAG Not yet run
unverified (harvested, no recorded run)
AdityaLab/EpiFNP/models/fnpmodels.py
code served (permissive licence) · get_code("e561be9fbe5b8abe")
How it ran

no invocation recorded.

sample_bipartite Not yet run
unverified (harvested, no recorded run)
AdityaLab/EpiFNP/models/fnpmodels.py
code served (permissive licence) · get_code("f04a1bf005dd0175")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 5 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 5 later) and 5 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.

FunctionAlso present inEarliest-datedOthers named
LogitRelaxedBernoulli
brick of this paper's assembly: model
1 other paper
1 later · 1 only as an assembly brick
2109.07438 (2021-09)
CAMul: Calibrated and Accurate Multi-view Time-Series Forecasting
Normal
brick of this paper's assembly: model
1 other paper
1 later · 1 only as an assembly brick
2109.07438 (2021-09)
CAMul: Calibrated and Accurate Multi-view Time-Series Forecasting
logitexp
brick of this paper's assembly: helper
1 other paper
1 later · 1 only as an assembly brick
2109.07438 (2021-09)
CAMul: Calibrated and Accurate Multi-view Time-Series Forecasting
one_hot 1 other paper
1 later
2109.07438 (2021-09)
CAMul: Calibrated and Accurate Multi-view Time-Series Forecasting
sample_bipartite
brick of this paper's assembly: helper
1 other paper
1 later
2109.07438 (2021-09)
CAMul: Calibrated and Accurate Multi-view Time-Series Forecasting

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

Accurate and trustworthy epidemic forecasting is an important problem for public health planning and disease mitigation. Most existing epidemic forecasting models disregard uncertainty quantification, resulting in mis-calibrated predictions. Recent works in deep neural models for uncertainty-aware time-series forecasting also have several limitations; e.g., it is difficult to specify proper priors in Bayesian NNs, while methods like deep ensembling can be computationally expensive. In this paper, we propose to use neural functional processes to fill this gap. We model epidemic time-series with a probabilistic generative process and propose a functional neural process model called EPIFNP, which directly models the probability distribution of the forecast value in a non-parametric way. In EPIFNP, we use a dynamic stochastic correlation graph to model the correlations between sequences, and design different stochastic latent variables to capture functional uncertainty from different perspectives. Our experiments in a real-time flu forecasting setting show that EPIFNP significantly outperforms state-of-the-art models in both accuracy and calibration metrics, up to 2.5x in accuracy and 2.4x in calibration. Additionally, as EPIFNP learns the relations between the current season and similar patterns of historical seasons, it enables interpretable forecasts. Beyond epidemic forecasting, EPIFNP can be of independent interest for advancing uncertainty quantification in deep sequential models for predictive analytics.

For agents

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

get_harvested_code_for_paper("2106.03904")
get_code_for_paper("2106.03904")
have("2106.03904")

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

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

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

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

Connect an agent — have() is free.