Phantom types for robust hierarchical models with typegeist

Fuente: arXiv
Saved in:
Bibliographic Details
Main Author: O'Hanlon, Daniel
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866911240850243584
author O'Hanlon, Daniel
author_facet O'Hanlon, Daniel
contents In Bayesian hierarchical models, group-level parameter arrays must be mapped to the observation axis, often using explicit indexing. In complex models with numerous incompatible data and parameter sets, this introduces the potential for bugs, as indexing with the incorrect indices typically fails silently. Here we present typegeist, a type system for Python that uses static type analysis to enable specification and enforcement of data-parameter-index correspondences. We show how this can be used with common probabilistic programming frameworks to help guarantee model correctness with minimal run-time overhead.
format Preprint
id arxiv_https___arxiv_org_abs_2510_26726
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Phantom types for robust hierarchical models with typegeist
O'Hanlon, Daniel
Computation
In Bayesian hierarchical models, group-level parameter arrays must be mapped to the observation axis, often using explicit indexing. In complex models with numerous incompatible data and parameter sets, this introduces the potential for bugs, as indexing with the incorrect indices typically fails silently. Here we present typegeist, a type system for Python that uses static type analysis to enable specification and enforcement of data-parameter-index correspondences. We show how this can be used with common probabilistic programming frameworks to help guarantee model correctness with minimal run-time overhead.
title Phantom types for robust hierarchical models with typegeist
topic Computation
url https://arxiv.org/abs/2510.26726