SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 0710.3742 · 2007

Bayesian Online Changepoint Detection

arXiv · PDF · Open in the Atlas

Code that ran

8 of 17 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 6 have no contract verdict; 2 failures of our instrument; 9 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/0710.3742.json · badge: /api/ran/0710.3742.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
hildensia/bayesian_changepoint_detection community (classifier label)
classifier basis not recorded on the link
6 ran · 6 no recorded run
gwgundersen/bocd reimplementation (classifier label)
classifier basis: classifier_2025
2 ran · 0 no recorded run
Ralami1859/BayesianOnlineChange-pointDetection-python-codes- reimplementation (classifier label)
classifier basis: classifier_2025
0 ran · 3 no recorded run
FunctionStatusWhere it lives
bocd Ran
ran; our contract draft was wrong, not the code
gwgundersen/bocd/bocd.py
code served (permissive licence) · get_code("e5e4b7005fc5f697")
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 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

class SimpleModel:
    """Minimal model satisfying the interface used in bocd()"""
    def __init__(self, T_max=10):
        self.T_max = T_max
        self.mean_params = np.random.randn(T_max)
        self.var_params = np.abs(np.random.randn(T_max)) + 0.1
        self.update_count = 0
    
    def log_pred_prob(self, t, x):
        """Return log predictive probabilities for run lengths 0 to t-1"""
        # Return array of length t with log probabilities
        return np.random.randn(t) - 5.0
    
    def update_params(self, t, x):
        """Update model parameters given new observation"""
        self.update_count += 1
        # Simple update: shift and add noise
        self.mean_params = np.roll(self.mean_params, 1)
        self.mean_params[0] = x
        self.var_params = np.roll(self.var_params, 1)
        self.var_params[0] = np.abs(x) + 0.1

# Create small test data
np.random.seed(42)
data = np.array([1.5, 2.3, 1.8, 2.1, 3.5])

# Create model
model = SimpleModel(T_max=len(data) + 1)

# Hazard rate (probability of changepoint)
hazard = 0.02

ARGS = {
    "data": data,
    "model": model,
    "hazard": hazard,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, scipy — 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
changepoint_probabilities Ran
ran on a synthesized input
hildensia/bayesian_changepoint_detection/bayesian_changepoint_detection/bayesian_models.py
code served (permissive licence) · get_code("e7d40318b2fd295b")
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 1, dtype family float, shape (6,) 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)

# R is a 2D tensor representing run length posterior
# Shape is [run_length_dim, time_steps]
# The function accesses R[lag, lag:n_cols], so we need:
# - R.shape[0] > lag (verified in the function)
# - R.shape[1] >= lag (implied by the slicing)
# Using distinct dimensions: 5 for run_length, 8 for time_steps
R = torch.randn(5, 8)

lag = 2

ARGS = {
    'R': R,
    'lag': lag,
}
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 1, dtype family float, shape (6,) — shape (6,) 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
const_prior Ran
ran on a synthesized input
hildensia/bayesian_changepoint_detection/bayesian_changepoint_detection/priors.py
code served (permissive licence) · get_code("76db590daebc2a02")
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 float, ndim 0, dtype family float, shape () 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

# Helper functions that const_prior uses
def get_device(device):
    if device is None:
        return torch.device('cpu')
    if isinstance(device, str):
        return torch.device(device)
    return device

def ensure_tensor(t, device=None):
    if isinstance(t, torch.Tensor):
        return t.to(device) if device else t
    return torch.tensor(t, device=device)

# Test with integer argument
torch.manual_seed(0)

ARGS = {
    't': 5,
    'p': 0.25,
    'device': None
}
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 float, ndim 0, dtype family float, shape () — shape () 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
constant_hazard Ran
ran on a synthesized input
hildensia/bayesian_changepoint_detection/bayesian_changepoint_detection/hazard_functions.py
code served (permissive licence) · get_code("44ea33bd1b5485b0")
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 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 torch

torch.manual_seed(0)

# Helper functions that are called in the function body
def get_device(device):
    if device is None:
        return torch.device('cpu')
    if isinstance(device, str):
        return torch.device(device)
    return device

def ensure_tensor(r, device):
    return torch.tensor(r, device=device, dtype=torch.float32)

# Test case 1: lam with int r
lam_value = 10.0
r_int = 5
device_value = None

# Test case 2: lam with tensor r
r_tensor = torch.arange(3, dtype=torch.float32)

# Construct the ARGS dict with all parameters
ARGS = {
    'lam': 10.0,
    'r': torch.arange(3, dtype=torch.float32),
    'device': None
}
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 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
ensure_tensor Ran
ran on a synthesized input
hildensia/bayesian_changepoint_detection/bayesian_changepoint_detection/device.py
code served (permissive licence) · get_code("5aaf8567766d4ffa")
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 1, dtype family float, shape (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 numpy as np

torch.manual_seed(0)

# Test data: a simple numpy array
test_data = np.array([1.5, 2.5, 3.5, 4.5])

# Test device: None (CPU default)
test_device = None

ARGS = {
    "data": test_data,
    "device": test_device,
}
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 Tensor, 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
generate_data Ran
ran; our contract draft was wrong, not the code
gwgundersen/bocd/bocd.py
code served (permissive licence) · get_code("a3e839f4e90f8279")
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 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

np.random.seed(42)

ARGS = {
    "varx": 1.5,
    "mean0": 0.0,
    "var0": 2.0,
    "T": 10,
    "cp_prob": 0.3
}
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 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
get_device Ran
ran on a synthesized input
hildensia/bayesian_changepoint_detection/bayesian_changepoint_detection/device.py
code served (permissive licence) · get_code("a47ff1e0584cddd9")
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 device. 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

torch.manual_seed(0)

ARGS = {
    "device": None,
}
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 device — a device output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a device 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
to_tensor Ran
ran on a synthesized input
hildensia/bayesian_changepoint_detection/bayesian_changepoint_detection/device.py
code served (permissive licence) · get_code("9b2309beadac7772")
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 1, dtype family float, shape (3,) 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 numpy as np

torch.manual_seed(0)

# Create test data in various formats
numpy_float64_array = np.array([1.5, 2.5, 3.5])
numpy_int_array = np.array([1, 2, 3])
python_list = [1.0, 2.0, 3.0]
python_float = 3.14
torch_tensor = torch.tensor([1.5, 2.5, 3.5], dtype=torch.float32)

ARGS = {
    "data": numpy_float64_array,
    "device": None,
    "dtype": None,
}
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 Tensor, 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
BOCD Not yet run
unverified (harvested, no recorded run)
Ralami1859/BayesianOnlineChange-pointDetection-python-codes-/BOCD_Algorithms.py
pointer only (licence: NONE) · get_code("057c9fc1bdcf53cb")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, Ralami1859/BayesianOnlineChange-pointDetection-python-codes- when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

BOCD_restart Not yet run
unverified (harvested, no recorded run)
Ralami1859/BayesianOnlineChange-pointDetection-python-codes-/BOCD_Algorithms.py
pointer only (licence: NONE) · get_code("91336b50b36e0090")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, Ralami1859/BayesianOnlineChange-pointDetection-python-codes- when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

BOCDm Not yet run
unverified (harvested, no recorded run)
Ralami1859/BayesianOnlineChange-pointDetection-python-codes-/BOCD_Algorithms.py
pointer only (licence: NONE) · get_code("5aa99e73486cea56")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, Ralami1859/BayesianOnlineChange-pointDetection-python-codes- when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

generate_correlation_change_example Not yet run
unverified (harvested, no recorded run)
hildensia/bayesian_changepoint_detection/bayesian_changepoint_detection/generate_data.py
code served (permissive licence) · get_code("f3f727dac2bd44fd")
How it ran

no invocation recorded.

generate_multivariate_normal_time_series Not yet run
unverified (harvested, no recorded run)
hildensia/bayesian_changepoint_detection/bayesian_changepoint_detection/generate_data.py
code served (permissive licence) · get_code("854b746e79ea4716")
How it ran

no invocation recorded.

generate_normal_time_series Not yet run
unverified (harvested, no recorded run)
hildensia/bayesian_changepoint_detection/bayesian_changepoint_detection/generate_data.py
code served (permissive licence) · get_code("c4ac09707d8e3952")
How it ran

no invocation recorded.

geometric_prior Not yet run
unverified (harvested, no recorded run)
hildensia/bayesian_changepoint_detection/bayesian_changepoint_detection/priors.py
code served (permissive licence) · get_code("355d784e27036bbb")
How it ran

no invocation recorded.

negative_binomial_hazard Not yet run
unverified (harvested, no recorded run)
hildensia/bayesian_changepoint_detection/bayesian_changepoint_detection/hazard_functions.py
code served (permissive licence) · get_code("a0eb9ba98c61036c")
How it ran

no invocation recorded.

negative_binomial_prior Not yet run
unverified (harvested, no recorded run)
hildensia/bayesian_changepoint_detection/bayesian_changepoint_detection/priors.py
code served (permissive licence) · get_code("0b60628f4e24d2ac")
How it ran

no invocation recorded.

Also present in other papers' code

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

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

Changepoints are abrupt variations in the generative parameters of a data sequence. Online detection of changepoints is useful in modelling and prediction of time series in application areas such as finance, biometrics, and robotics. While frequentist methods have yielded online filtering and prediction techniques, most Bayesian papers have focused on the retrospective segmentation problem. Here we examine the case where the model parameters before and after the changepoint are independent and we derive an online algorithm for exact inference of the most recent changepoint. We compute the probability distribution of the length of the current ``run,'' or time since the last changepoint, using a simple message-passing algorithm. Our implementation is highly modular so that the algorithm may be applied to a variety of types of data. We illustrate this modularity by demonstrating the algorithm on three different real-world data sets.

For agents

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

get_harvested_code_for_paper("0710.3742")
get_code_for_paper("0710.3742")
have("0710.3742")

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

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

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

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

Connect an agent — have() is free.