Tutorials¶
Two tracks. The QVR track writes and fits statistical models in QVR, the modeling language of quivers. The Python track builds the same objects from the Python classes that QVR compiles to: finite sets, morphisms, algebras, and probabilistic programs. Prerequisites: Python 3.14 or later, PyTorch, and quivers (installation).
QVR track¶
Start with checked model fitting for inferred dimensions, checked external inputs, reusable inference methods, and posterior prediction. The numbered chapters then explain the modeling and inference components.
- Your first model. Bayesian linear regression beside PyMC and NumPyro, effect signatures, data inputs, a fit by stochastic variational inference (SVI), and posterior draws.
- Generalized linear models. Logistic and Poisson regression, inverse link functions, and the calibration of the posterior mean probability.
- Hierarchical models. Eight schools, plates, centered and non-centered parameterizations, and the No-U-Turn Sampler (NUTS).
- Mixtures and discrete latents. Summing a discrete latent variable out with
marginalize, for each row or for each group of rows. - Sequence models.
scan, recurrent networks, hidden Markov models summed by the forward algorithm, and state space models. - Choosing an inference algorithm. Guides, variational objectives, gradient estimators, MCMC kernels, and hybrids, with the literature for each.
- Categorical foundations. Morphisms as matrices over a semiring or t-norm, the laws of each composition rule, change of base, and programs as Markov kernels.
- Diagnostics and model comparison. Convergence diagnostics, posterior predictive checks, and PSIS-LOO comparison through ArviZ.
- Indexed data and total functions. Inductive families, parameters and indices, and case analysis with a motive.
- Effects and handlers. Effect instances, effect rows, authored and foreign handlers, and resumption grades.
- Parsing as an effectful computation. A categorial grammar compiled to a chart parser and to a search computation, and parsing inside a probabilistic program.
- Tree autoencoders. Autoencoders over typed terms, attachments, and gradients through a run of the loss.
- Check, inspect, and transpile a module. Target checks, entry points, traces, the language server, and transpiling before a release.
- Exact Bayes with finite collection expressions.
traverse,map, andlogsumexp_overin a posterior computed by enumeration. - Object languages. A typed lambda calculus with binding, a generated normalizer, a typing judgment, notation, and a derived translation, tested by exact normal forms.
- Composing a grammar. A categorial grammar assembled from a core, lexicon modules, and a polymorphic entry, read by generic code and specialized to semirings.
Python track¶
- Your first quiver.
FinSet, learnable and observed morphisms, composition with>>, andProgram. - Stochastic relations. Markov kernels on finite sets, discretized families, conditioning, and queries.
- Probabilistic programs.
MonadicProgrambuilt fromDrawandLetsteps, sampling, andlog_joint. - Fuzzy logic factorization. Factorizing a relation under the product t-norm and noisy-OR.
- Variational inference. Traces, conditioning,
Guide,ELBO,SVI, andPredictive. - First-class transformations. Entrywise maps and morphism transformations as values,
compose_trans, and Bayesian inversion. - Composition rules beyond algebras.
Algebra,Semigroupoid, andMagmoidby the laws they claim, andEinsumWiringfor contractions of several tensors. - Analysis pipelines. Regression formulas compiled to QVR, hierarchical, ordinal, categorical, and mixture regressions, PSIS-LOO, and posterior predictive checks.
- Debugging quivers programs.
CompileError, compiled steps, traces, the SVI loss, and NUTS diagnostics.