Skip to main content

spyn: hyper-graphical probabilistic inference

Discrete probabilistic inference whose model is a set of "hyper-edges": tables (potentials) that carry probabilistic information about subsets of random variables. It generalizes Bayesian networks (the join tree of a Bayesian network is a hyper-tree). You don't need to know Bayesian statistics to start: if you can count things and put the counts in a table, you can use it.

pip install spyn

Requirements are numpy, pandas and matplotlib. Core variables are discrete; for non-discrete ones, wrap them in your own binning.

Quick example

A potential is a table that maps each combination of values of some discrete variables to a number (a count, a probability, a likelihood):

import pandas as pd
from spyn.ppi.pot import Pot

ab_counts = Pot(
    pd.DataFrame({"A": [0, 0, 1, 1], "B": [0, 1, 0, 1], "pval": [2, 4, 5, 9]})
)
print(ab_counts["A"])  # project to A: sum out B
   A  pval
0  0     6
1  1    14

ab_counts["A"] is shorthand for ab_counts.project_to(var_list=["A"]), which can also be written ab_counts >> ["A"].

Learn more

The tutorial builds up from counting: projecting, slicing, multiplying and dividing potentials, integrating evidence, and building a join tree from your own data.

For spyn used in a real project, see odus.

Metadata

Release files for spyn 0.0.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spyn 0.0.12
File Size Uploaded Provenance Actions
spyn-0.0.12.tar.gz 132.3 kB Without provenance Details for spyn-0.0.12.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for spyn 0.0.12
File Interpreter ABI Platform Actions
spyn-0.0.12-py3-none-any.whl Python 3 none any Details for spyn-0.0.12-py3-none-any.whl

Total release size: 165.2 kB

Release files / spyn-0.0.12.tar.gz

Download URL spyn-0.0.12.tar.gz
Size 132.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4c2ff552e96712b41cf89f934b9adb0b44741fc62ceb3aa2c91282880defebd5
BLAKE2b-256 checksum
How to use checksums
4d1ab24cc64b94fc8e211f1c772f2737031cd5d57ca4adf4dd3819fe3772ca86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / spyn-0.0.12-py3-none-any.whl

Download URL spyn-0.0.12-py3-none-any.whl
Size 32.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9fa9f682425855d68cc7ae303c7e6940eeedfb613497ba020a0e75d2efe91cca
BLAKE2b-256 checksum
How to use checksums
06fe3356a31be37bc2a8e88bdfc4e989a262e2e1c3926efd8fdfb77bf5991d2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for spyn 0.0.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page