Skip to content

xhep-lab/stanhf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌀 stanhf

Convert a histfactory model into a Stan model

arXiv GitHub License GitHub Actions Workflow Status GitHub Tag PyPI - Version


Convert a histfactory declarative specification of a model in json into a Stan model. Stan is a probabilistic programming language and a set of algorithms with automatic differentiation.

We follow the histfactory specification as closely as possible and the target function (log-likelihood) should match that from pyhf up to a constant term to within a negligible numerical difference.

See the paper at [2503.22188] for more information.

Install

pip install stanhf

At runtime, the first time you use stanhf it could install cmdstan if it isn't found. This is required to lint, validate and compile any Stan models, though stanhf can be used as a conversion tool without it.

Run

Stanhf consists of one CLI. See

stanhf --help

for details. Try e.g.,

stanhf ./examples/normfactor.json

This converts, compiles and validates the example model. The compiled model is a cmdstan executable. You can run the usual Stan algorithms (HMC, optimization etc) through this executable.

Workflows

See EXAMPLE.md for a walkthrough of how to run and analyse outpus from a compiled Stan model.

About

Convert a histfactory model into a Stan model

Resources

License

Stars

Watchers

Forks

Packages

No packages published