# Theory to Implementation

BABAPPA v1 implements the revised framework with:

- Canonical bounded codon embedding `u(c)` and gene/site representation
  `psi(C) = B * T^(-1/2) * [u(c1); ...; u(cT)]`.
- Explicit stochastic Gaussian smoothing with configurable bandwidth, applied in
  training, observed-gene scoring, and null calibration replicates.
- Null-only training of a frozen quadratic/Gaussian energy model.
- Gene statistic defined as sample variance of site energies within each gene.
- Exact one-sided Monte Carlo rank p-values as default.
- Optional pooled symmetric two-sided Monte Carlo construction.
- Deterministic seed schedule derived from base seed + stage + gene + site index.

See source modules:

- `babappa.features.codon`
- `babappa.features.representation`
- `babappa.features.smoothing`
- `babappa.null.simulator`
- `babappa.model.energy`
- `babappa.stats.inference`
