SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1506.05843 · 2015

Dependent Multinomial Models Made Easy: Stick Breaking with the Pólya-Gamma Augmentation

arXiv · PDF · Open in the Atlas

Code that ran

10 of 18 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, 1 violated it and 9 have no contract verdict; 0 failures of our instrument; 8 no recorded run), measured 2026-11-23; 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/1506.05843.json · badge: /api/ran/1506.05843.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
HIPS/pgmult canonical (classifier label)
classifier basis: census
10 ran · 8 no recorded run
FunctionStatusWhere it lives
dpotrs Ran
ran on a synthesized input
HIPS/pgmult/pgmult/lda.py
code served (permissive licence) · get_code("bfdf3915c6140645")
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 ndarray, ndim 2, dtype family float, shape (4, 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
from scipy.linalg.lapack import dpotrs as _dpotrs

torch_imported = False
try:
    import torch
    torch_imported = True
except ImportError:
    pass

# Create test data for dpotrs
# dpotrs solves L * X = B where L is lower triangular from Cholesky decomposition
# L should be a lower triangular matrix from a Cholesky factorization
# a is the right-hand side matrix

# Create a symmetric positive definite matrix first
A = np.array([[4.0, 1.0, 0.5, 0.2],
              [1.0, 3.0, 0.3, 0.1],
              [0.5, 0.3, 2.0, 0.4],
              [0.2, 0.1, 0.4, 1.5]], dtype=np.float64)

# Compute Cholesky decomposition to get L (lower triangular)
L = np.linalg.cholesky(A)

# Create right-hand side matrix (4x3 to be distinct from L's dimension)
B = np.array([[1.0, 2.0, 3.0],
              [4.0, 5.0, 6.0],
              [7.0, 8.0, 9.0],
              [10.0, 11.0, 12.0]], dtype=np.float64)

ARGS = {
    "L": L,
    "a": B
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (4, 3) — shape (4, 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
load_mu_sigma Ran
ran on a synthesized input
HIPS/pgmult/pgmult/internals/ctm_wrapper.py
code served (permissive licence) · get_code("2729a67a71e53396")
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 numpy as np
import os
from os.path import join
import tempfile
import shutil

# Create a temporary directory with the required files
temp_dir = tempfile.mkdtemp()
results_subdir = os.path.join(temp_dir, 'data', 'ctm', 'results')
os.makedirs(results_subdir, exist_ok=True)

# Create sample data files
mu_data = np.array([1.0, 2.0, 3.0, 4.0])
np.savetxt(join(results_subdir, 'final-mu.dat'), mu_data)

sigma_data = np.random.randn(4, 4)
np.savetxt(join(results_subdir, 'final-cov.dat'), sigma_data)

ARGS = {
    'resultsdir': results_subdir
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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
log_censored_dirichlet_density Ran
ran on a synthesized input
HIPS/pgmult/pgmult/internals/dirichlet.py
code served (permissive licence) · get_code("a81165b10b792246")
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 ndarray, ndim 1, dtype family float, shape (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 numpy as np

# Set random seed for reproducibility
np.random.seed(0)

# Create a small valid Dirichlet sample (NxP matrix where each row sums to 1 and all values >= 0)
# N=2 samples, P=4 dimensions
x = np.array([
    [0.1, 0.2, 0.3, 0.4],
    [0.25, 0.25, 0.25, 0.25]
])

# Alpha parameter (concentration parameters for Dirichlet)
# Can be a scalar or a 1D array
alpha = np.array([2.0, 2.0, 2.0, 2.0])

# Data matrix (PxP censored counts matrix with zero diagonal)
# P=4, so 4x4 matrix
data = np.array([
    [0, 1, 2, 3],
    [1, 0, 2, 1],
    [2, 1, 0, 2],
    [1, 1, 1, 0]
])

ARGS = {
    "x": x,
    "alpha": alpha,
    "data": data
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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 (2,) — shape (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: none by the harness; any seed is in the setup block
log_dirichlet_density Ran
ran on a synthesized input
HIPS/pgmult/pgmult/internals/dirichlet.py
code served (permissive licence) · get_code("68990d73a38db2e0")
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 ndarray, ndim 1, dtype family float, shape (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 numpy as np
import scipy.special

# Construct test data for log_dirichlet_density
# x should be a 2D array where each row sums to 1 and all elements are non-negative
# (valid simplex points)
x = np.array([
    [0.2, 0.3, 0.5],
    [0.1, 0.4, 0.5]
], dtype=np.float64)

# alpha is a 1D array of concentration parameters for the Dirichlet distribution
alpha = np.array([1.0, 2.0, 3.0], dtype=np.float64)

# data is optional and should be a 1D array matching the number of categories
# (same length as alpha and x.shape[1])
data = np.array([0.1, 0.2, 0.3], dtype=np.float64)

ARGS = {
    "x": x,
    "alpha": alpha,
    "data": data
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — 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 (2,) — shape (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: none by the harness; any seed is in the setup block
logistic Ran
ran, violated the contract we drafted
HIPS/pgmult/pgmult/utils.py
code served (permissive licence) · get_code("cf4bb5e9f8634ad2")
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 ndarray, ndim 1, dtype family float, shape (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 numpy as np

def logistic(x):
    return 1.0 / (1 + np.exp(-x))

# Create valid arguments for the logistic function
# The function takes a single parameter x and applies the logistic sigmoid function
# x should be a numpy array or scalar

x = np.array([0.5, -0.3, 1.2, -2.1])

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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 (4,) — shape (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
make_onehot_seq Ran
ran on a synthesized input
HIPS/pgmult/experiments/alice_lds.py
code served (permissive licence) · get_code("e4855bd5b78bd460")
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 ndarray, ndim 2, dtype family float, shape (3, 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 numpy as np
from sklearn.feature_extraction.text import TfidfVectorizer

# Create a simple vectorizer with some vocabulary
vectorizer = TfidfVectorizer(vocabulary=['hello', 'world', 'test', 'python'])
# Fit it on some dummy data to populate the vocabulary properly
vectorizer.fit(['hello world', 'test python'])

# Create a document as a string
doc = "hello world test"

ARGS = {
    'doc': doc,
    'vectorizer': vectorizer
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (3, 4) — shape (3, 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
mesh Ran
ran on a synthesized input
HIPS/pgmult/pgmult/internals/simplex.py
code served (permissive licence) · get_code("2bc83dce3a7ce30e")
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 ndarray, ndim 2, dtype family float, shape (15, 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 = {
    "N": 5,
    "edges": True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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 2, dtype family float, shape (15, 3) — shape (15, 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
meshnd Ran
ran on a synthesized input
HIPS/pgmult/pgmult/internals/simplex.py
code served (permissive licence) · get_code("bc6066b454265076")
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 ndarray, ndim 2, dtype family float, shape (3, 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

# D is an integer representing the number of dimensions
# N is an integer (or list/array of integers) representing the number of points per dimension
# Looking at the function, it uses D for recursion depth and N as a count parameter

D = 3  # Number of dimensions
N = 2  # Number of points/divisions

ARGS = {
    "D": D,
    "N": N
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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 2, dtype family float, shape (3, 3) — shape (3, 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
sample_dirichlet Ran
ran on a synthesized input
HIPS/pgmult/pgmult/lda.py
code served (permissive licence) · get_code("4e552abc7e8c8072")
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 ndarray, ndim 2, dtype family float, shape (4, 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

# sample_dirichlet takes a numpy array and a string parameter
# It uses a.T (transpose) if normalize starts with 'vertical'
# It iterates over a.T (columns) or a (rows) and calls np.random.dirichlet on each

# Create a small numpy array with distinct dimensions (4 rows, 3 columns)
# Each row/column should sum to positive values for dirichlet sampling
a = np.array([
    [1.0, 2.0, 3.0],
    [2.0, 1.0, 2.0],
    [3.0, 2.0, 1.0],
    [1.0, 1.0, 1.0]
], dtype=np.float64)

# normalize parameter: string that determines if we process vertically or horizontally
normalize_vertical = 'vertical'
normalize_horizontal = 'horizontal'

ARGS = {
    'a': a,
    'normalize': normalize_vertical
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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 2, dtype family float, shape (4, 3) — shape (4, 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
solve_triangular Ran
ran on a synthesized input
HIPS/pgmult/pgmult/lda.py
code served (permissive licence) · get_code("9215b1ce31f92b0b")
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 ndarray, ndim 1, dtype family float, shape (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 numpy as np
from scipy.linalg import solve_triangular as _solve_triangular

# Create a small lower triangular matrix
# L should be a square matrix that will be used as the lower triangular matrix
L = np.array([
    [2.0, 0.0, 0.0, 0.0],
    [1.0, 3.0, 0.0, 0.0],
    [0.5, 1.5, 4.0, 0.0],
    [0.25, 0.75, 2.0, 5.0]
], dtype=np.float64)

# Create a right-hand side vector
# a should be a 1D or 2D array to solve L @ x = a (transposed)
a = np.array([1.0, 2.0, 3.0, 4.0], dtype=np.float64)

ARGS = {
    'L': L,
    'a': a
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — 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 (4,) — shape (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
filter_wordseq Not yet run
unverified (harvested, no recorded run)
HIPS/pgmult/experiments/alice_lds.py
code served (permissive licence) · get_code("ffa8285abe4398ed")
How it ran

no invocation recorded.

load Not yet run
unverified (harvested, no recorded run)
HIPS/pgmult/experiments/alice_lds.py
code served (permissive licence) · get_code("324f4b596bfebf51")
How it ran

no invocation recorded.

load_ldac_ctm_results Not yet run
unverified (harvested, no recorded run)
HIPS/pgmult/pgmult/internals/ctm_wrapper.py
code served (permissive licence) · get_code("5a894653419ef604")
How it ran

no invocation recorded.

log_polya_gamma_density Not yet run
unverified (harvested, no recorded run)
HIPS/pgmult/pgmult/utils.py
code served (permissive licence) · get_code("a74dfc9972ff1607")
How it ran

no invocation recorded.

nonlinear_meshnd Not yet run
unverified (harvested, no recorded run)
HIPS/pgmult/pgmult/internals/simplex.py
code served (permissive licence) · get_code("e44ee64745989e0a")
How it ran

no invocation recorded.

polya_gamma_density Not yet run
unverified (harvested, no recorded run)
HIPS/pgmult/pgmult/utils.py
code served (permissive licence) · get_code("a18077e703e02044")
How it ran

no invocation recorded.

resample_logistic_documents Not yet run
unverified (harvested, no recorded run)
HIPS/pgmult/pgmult/parallel.py
code served (permissive licence) · get_code("ca09b18d10fb5464")
How it ran

no invocation recorded.

resample_standard_documents Not yet run
unverified (harvested, no recorded run)
HIPS/pgmult/pgmult/parallel.py
code served (permissive licence) · get_code("421faa43f99df234")
How it ran

no invocation recorded.

Also present in other papers' code

Of 18 samples lifted from this paper's linked repositories, 18 carry a function identity and 0 do not. Of the 18 distinct functions with an identity, 1 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 1 later) and 17 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
logistic 1 other paper
1 later
2601.21696 (2026-01)
Independent Component Discovery in Temporal Count Data

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-23.

Repositories linked to this paper

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

Abstract

Many practical modeling problems involve discrete data that are best represented as draws from multinomial or categorical distributions. For example, nucleotides in a DNA sequence, children's names in a given state and year, and text documents are all commonly modeled with multinomial distributions. In all of these cases, we expect some form of dependency between the draws: the nucleotide at one position in the DNA strand may depend on the preceding nucleotides, children's names are highly correlated from year to year, and topics in text may be correlated and dynamic. These dependencies are not naturally captured by the typical Dirichlet-multinomial formulation. Here, we leverage a logistic stick-breaking representation and recent innovations in Pólya-gamma augmentation to reformulate the multinomial distribution in terms of latent variables with jointly Gaussian likelihoods, enabling us to take advantage of a host of Bayesian inference techniques for Gaussian models with minimal overhead.

For agents

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

get_harvested_code_for_paper("1506.05843")
get_code_for_paper("1506.05843")
have("1506.05843")

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

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

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

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

Connect an agent — have() is free.