Skip to content

Commit 4033c00

Browse files
Initial release: quivers v0.1.0
Categorical and probabilistic modeling as differentiable PyTorch programs. Includes core categorical algebra (quantales, V-enriched morphisms), stochastic morphisms (Markov kernels, Giry monad), 30+ continuous distribution families, monadic programs, the QVR DSL compiler, variational inference (ELBO, SVI), documentation, tests, and CI/CD workflows (lint, typecheck, test, docs deployment).
0 parents  commit 4033c00

227 files changed

Lines changed: 46976 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-python@v5
15+
with:
16+
python-version: "3.12"
17+
- run: pip install ruff
18+
- run: ruff check src/ tests/
19+
- run: ruff format --check src/ tests/
20+
21+
typecheck:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
- uses: actions/setup-python@v5
26+
with:
27+
python-version: "3.12"
28+
- run: pip install mypy torch
29+
- run: mypy src/quivers --ignore-missing-imports
30+
31+
test:
32+
runs-on: ubuntu-latest
33+
strategy:
34+
matrix:
35+
python-version: ["3.12"]
36+
steps:
37+
- uses: actions/checkout@v4
38+
- uses: actions/setup-python@v5
39+
with:
40+
python-version: ${{ matrix.python-version }}
41+
- run: pip install -e ".[dev]"
42+
- run: python -m pytest tests/ -x -q

.github/workflows/docs.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Deploy Docs
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
permissions:
8+
contents: read
9+
pages: write
10+
id-token: write
11+
12+
concurrency:
13+
group: pages
14+
cancel-in-progress: true
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: actions/setup-python@v5
22+
with:
23+
python-version: "3.12"
24+
- run: pip install -e ".[docs]"
25+
- run: mkdocs build --strict
26+
- uses: actions/upload-pages-artifact@v3
27+
with:
28+
path: site/
29+
30+
deploy:
31+
needs: build
32+
runs-on: ubuntu-latest
33+
environment:
34+
name: github-pages
35+
url: ${{ steps.deployment.outputs.page_url }}
36+
steps:
37+
- id: deployment
38+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# Distribution / packaging
7+
dist/
8+
build/
9+
*.egg-info/
10+
*.egg
11+
12+
# Virtual environments
13+
.venv/
14+
venv/
15+
env/
16+
17+
# Testing
18+
.pytest_cache/
19+
pytest-cache-files-*/
20+
.coverage
21+
htmlcov/
22+
23+
# Type checking / linting
24+
.mypy_cache/
25+
.ruff_cache/
26+
27+
# Documentation build
28+
site/
29+
30+
# IDE
31+
.idea/
32+
.vscode/
33+
*.swp
34+
*.swo
35+
*~
36+
37+
# OS
38+
.DS_Store
39+
Thumbs.db

CHANGELOG.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Changelog
2+
3+
All notable changes to the quivers library are documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/), and this project adheres to [Semantic Versioning](https://semver.org/).
6+
7+
## [Unreleased]
8+
9+
## [0.1.0] - 2026-03-26
10+
11+
### Added
12+
13+
#### Core Categorical Algebra
14+
15+
- Fundamental category types and morphisms
16+
- Object declarations and morphism composition
17+
- Support for latent and observed morphisms
18+
- Basic categorical operations and abstractions
19+
20+
#### Stochastic Morphisms
21+
22+
- Stochastic morphism declarations and semantics
23+
- Integration with probability theory
24+
- Support for morphism composition in stochastic settings
25+
26+
#### Continuous Distributions (30+ Families)
27+
28+
- Normal distribution and variants (LogitNormal, TruncatedNormal)
29+
- Beta, Dirichlet for probability simplices
30+
- Exponential family: Exponential, Gamma, Chi2
31+
- Heavy-tailed: Cauchy, StudentT, Pareto
32+
- Bounded: Uniform, Kumaraswamy
33+
- Half-variants: HalfCauchy, HalfNormal
34+
- Transformed: LogNormal, Gumbel, Laplace, Weibull
35+
- Multivariate: MultivariateNormal, LowRankMVN, Wishart
36+
- Bernoulli variants: Bernoulli, ContinuousBernoulli, RelaxedBernoulli
37+
- Advanced: RelaxedOneHotCategorical, FisherSnedecor
38+
- Normalized flows: Flow
39+
- Categorical and discrete approximations
40+
41+
#### Monadic Programs
42+
43+
- Draw statements for sampling from morphisms
44+
- Observe statements for conditioning and likelihood
45+
- Return statements with optional labeled outputs
46+
- Variable binding and destructuring in patterns
47+
- Program parameters and composition
48+
49+
#### QVR DSL
50+
51+
- Complete lexer with token recognition for all language constructs
52+
- Recursive descent parser with full grammar support
53+
- Abstract syntax tree (AST) node definitions
54+
- Program block execution with proper scoping
55+
- Let bindings for expression computation
56+
- Built-in let functions: sigmoid, exp, log, abs, softplus
57+
- Comment support (#)
58+
- Type expressions: products (*), coproducts (+)
59+
- Expression operators: composition (>>), tensor product (@), marginalization
60+
- Indentation-aware program body parsing
61+
- Specialized handling for draw/observe arguments
62+
63+
#### Variational Inference Layer
64+
65+
- Inference interface for probabilistic programs
66+
- Support for approximate posterior computation
67+
- Integration with continuous distribution families

0 commit comments

Comments
 (0)