SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2011.00717 · NeurIPS · 2020

Noise-Contrastive Estimation for Multivariate Point Processes

Hongyuan Mei, Jason Eisner, Tom Wan

arXiv · PDF · Open in the Atlas

Code that ran

3 of 4 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 0 failures of our instrument; 1 no recorded run), measured 2026-11-21; 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/2011.00717.json · badge: /api/ran/2011.00717.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
hongyuanmei/nce-mpp community (classifier label)
classifier basis not recorded on the link
2 ran · 1 no recorded run
HMEIatJHU/nce-mpp marked official in Papers with Code
Papers with Code archive
1 ran · 0 no recorded run
FunctionStatusWhere it lives
NCE Ran
ran on a synthesized input · constructed an object; no result was computed
HMEIatJHU/nce-mpp/ncempp/objectives/nce.py
code served (permissive licence) · get_code("9d7496d41f73796d")
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, through the batch API) and returned an instance of its own class, NCE: the run constructed the object and did not call it, so no result was computed. 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 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
import numpy as np
import random

torch.manual_seed(0)
random.seed(0)
np.random.seed(0)

# Build minimal stand-in models that satisfy the interface used in forward()

class MinimalGNHP(nn.Module):
    """Minimal GNHP model with required methods"""
    def __init__(self, event_dim=5, hidden_dim=4):
        super().__init__()
        self.event_dim = event_dim
        self.hidden_dim = hidden_dim
        self.embedding = nn.Embedding(event_dim, hidden_dim)
        self.linear = nn.Linear(hidden_dim, event_dim)
        
    def get_target(self, event_tensor):
        """Returns target_tensor [B x T] and mask_tensor [B x T]"""
        B, T = event_tensor.shape
        target_tensor = event_tensor[:, 1:].long()  # [B x T-1]
        mask_tensor = torch.ones(B, T - 1, dtype=torch.float32)
        return target_tensor, mask_tensor
    
    def get_cells_gates_states(self, event_tensor, dtime_tensor):
        """Returns cell, gate, and state tensors"""
        B, T = event_tensor.shape
        hidden_dim = self.hidden_dim
        event_dim = self.event_dim
        
        all_c = torch.randn(B, T, hidden_dim)
        all_cb = torch.randn(B, T, hidden_dim)
        all_d = torch.randn(B, T, hidden_dim)
        all_o = torch.randn(B, T, hidden_dim)
        all_s1 = torch.randn(B, T, hidden_dim)
        all_s2 = torch.randn(B, T, hidden_dim)
        
        return all_c, all_cb, all_d, all_o, all_s1, all_s2
    
    def get_interpolated_cells(self, all_c, all_cb, all_d, all_o, all_S):
        """Interpolate cells at noise times"""
        B, T_noise, K = all_S.shape
        hidden_dim = self.hidden_dim
        
        all_c_noise = torch.randn(B, T_noise, K, hidden_dim)
        all_cb_noise = torch.randn(B, T_noise, K, hidden_dim)
        all_d_noise = torch.randn(B, T_noise, K, hidden_dim)
        all_o_noise = torch.randn(B, T_noise, K, hidden_dim)
        
        return all_c_noise, all_cb_noise, all_d_noise, all_o_noise
    
    def get_intensities_given_types(self, all_c, all_cb, all_d, all_o, all_types, dtime_tensor):
        """Compute intensities for given types"""
        # all_types shape: [B, T, K] where K is number of types to evaluate
        # Returns intensities of same shape
        return torch.abs(torch.randn_like(all_types.float())) + 0.1


class MinimalNoiseProcess(nn.Module):
    """Minimal noise distribution with required methods"""
    def __init__(self, event_dim=5):
        super().__init__()
        self.event_dim = event_dim
        
    def get_noise_samples(self, method, event_tensor, dtime_tensor, target_tensor, 
                         mask_tensor, duration_tensor, M1, M2, over_rate):
        """Generate noise samples"""
        B, T = event_tensor.shape
        T_actual = T - 1
        T_noise = int(T_actual * over_rate)
        K = M2  # number of noise types per time
        
        all_type_actual_noise = torch.randint(0, self.event_dim, (B, T_actual, K))
        all_type_noise_noise = torch.randint(0, self.event_dim, (B, T_noise, K))
        all_dtime_noise = torch.rand(B, T_noise)
        all_mask_noise = torch.ones(B, T_noise)
        inten_q_actual_both = torch.rand(B, T_actual, K + 1) + 0.1
        inten_q_noise_noise = torch.rand(B, T_noise, K) + 0.1
        all_accept_prob_noise = torch.rand(B, T_noise, K)
        all_S_noise = torch.rand(B, T_noise, M1)  # M1 noise processes
        all_inten_num_noise = torch.rand(B, T_noise, M1)
        
        return (all_type_actual_noise, all_type_noise_noise, all_dtime_noise, 
                all_mask_noise, inten_q_actual_both, inten_q_noise_noise, 
                all_accept_prob_noise, all_S_noise, all_inten_num_noise)


# Set up NCE initialization arguments
ARGS = {
    'noise_process_num': 2,  # M1
    'noise_type_num': 3,     # M2
    'over_rate': 1.5,
    'redraw_prob': 0.5,
    'device': 'cpu'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type NCE — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a NCE output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
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
draw_mc_samples Ran
ran on a synthesized input
hongyuanmei/nce-mpp/ncempp/models/utils.py
code served (permissive licence) · get_code("b2551e910644a0b7")
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, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type 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)

batch_size = 2
D = 4
device = 'cpu'

c = torch.randn(batch_size, D, device=device)
cb = torch.randn(batch_size, D, device=device)
d = torch.randn(batch_size, D, device=device)
o = torch.randn(batch_size, D, device=device)
dtime = torch.rand(batch_size, device=device) * 2.0
M = torch.tensor([3, 2], dtype=torch.long, device=device)

ARGS = {
    'c': c,
    'cb': cb,
    'd': d,
    'o': o,
    'dtime': dtime,
    'M': M,
    'device': device
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
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
sample_multinomial_torch Ran
ran on a synthesized input
hongyuanmei/nce-mpp/ncempp/models/utils.py
code served (permissive licence) · get_code("0c65a51dcd8625ae")
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, through the batch API) and returned Tensor, ndim 3, dtype family int; no output shape is stated. It ran in syntology-harvest-sandbox:v5-deps (sha256:6a292aa1aed1) at 2026-09-26T22:17:14Z. 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 torch

torch.manual_seed(0)

# Analyze the function:
# - probs: tensor that gets reshaped to (-1, event_num), then passed to torch.multinomial
# - s0, s1: dimensions for reshaping the output
# - num: number of samples for multinomial
# - event_num: number of events/categories

# torch.multinomial expects a 2D tensor of shape (batch_size, num_events)
# where each row sums to 1 (probabilities)

# Let's set up: s0=2, s1=3, event_num=4, num=2
s0 = 2
s1 = 3
event_num = 4
num = 2

# probs should reshape to (-1, event_num) = (6, 4)
# So probs should have 6 * 4 = 24 elements total
# We can create it as shape (2, 3, 4) which flattens to (6, 4)
probs = torch.rand(s0, s1, event_num)
probs = probs / probs.sum(dim=-1, keepdim=True)  # normalize so each row sums to 1

ARGS = {
    "probs": probs,
    "s0": s0,
    "s1": s1,
    "num": num,
    "event_num": event_num,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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 3, dtype family int — no output shape is stated: no later run recorded an output shape for this sample (observed_output and metamorphic_properties carry none; shape_contract and output_contract record ndim only)
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 syntology-harvest-sandbox:v5-deps (sha256:6a292aa1aed1); 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
sample_noise_types Not yet run
unverified (harvested, no recorded run)
hongyuanmei/nce-mpp/ncempp/models/utils.py
code served (permissive licence) · get_code("a8cc0ad46cb1960b")
How it ran

no invocation recorded.

Also present in other papers' code

Of 4 samples lifted from this paper's linked repositories, 4 carry a function identity and 0 do not. Of the 4 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 4 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-21.

Repositories linked to this paper

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

Abstract

The log-likelihood of a generative model often involves both positive and negative terms. For a temporal multivariate point process, the negative term sums over all the possible event types at each time and also integrates over all the possible times. As a result, maximum likelihood estimation is expensive. We show how to instead apply a version of noise-contrastive estimation-a general parameter estimation method with a less expensive stochastic objective. Our specific instantiation of this general idea works out in an interestingly non-trivial way and has provable guarantees for its optimality, consistency and efficiency. On several synthetic and real-world datasets, our method shows benefits: for the model to achieve the same level of log-likelihood on held-out data, our method needs considerably fewer function evaluations and less wall-clock time. * This paper uses endnotes instead of footnotes. They are found at the start of the supplementary material.

For agents

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

get_harvested_code_for_paper("2011.00717")
get_code_for_paper("2011.00717")
have("2011.00717")

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

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

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

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

Connect an agent — have() is free.