Skip to content

Status

transiograms 0.1.0 is an alpha release. This page records what each milestone of the design contract delivers, the test that accepts it, and what is still missing.

The API draws on the compositional design of the original pomegranate library (explicit distributions, transition graphs, fit, predict and sample methods), scoped to geological sequences and spatial facies models. transiograms has no dependency on boitata; the two exchange drillhole intervals, category codes, coordinates and grids as NumPy arrays, and transiograms follows boitata's Python conventions (flat namespace, Rust-backed value types with JSON and pickle support, .pyi stubs, tg.plot and tg.datasets).

Milestones

Status as of 2026-11-20 (mise run verify passes; each milestone's acceptance test is named below):

Milestone Status Acceptance test Missing
M1 done crates/chain/tests/theory.rs::m1_acceptance_fixed_recovery example pages for from_matrix, from_rates, from_geology, symmetry_test, asymmetry, proportion_std, simulate_beds, homogeneity_test, Sojourn.survival; Sojourn.exponential_test does not bound n_bootstrap (runtime only, memory is constant)
M2 done crates/hmm/tests/theory.rs::m2_gaussian_k4_t8_matches_brute_force none known
M3 done crates/hsmm/tests/model.rs::m3_bic_selects_three_states_hmm none known
M4 done crates/transiogram/tests/theory.rs::m4_lag_grid_validity none known
M5 done, with a size change crates/tpsim/tests/theory.rs::m5_acceptance, m5_spec_cell_reproduces_hard_data_and_auto_transiograms the proportion check runs at cell 6 x 6 x 1 because 3 sigma is 0.194 at the spec cell; spec.md does not record this yet; the x RMSE at the spec cell is three times the y RMSE (within 0.05, cause not investigated); the 0.05 RMSE is a fixed tolerance, and auto- and cross-transiograms miss the model by up to 0.026 (15 standard errors) at mid lags, a documented method limit pinned by crates/tpsim/tests/limits.rs
M6 done, with a size change crates/mcrf/tests/acceptance.rs::m6_acceptance, m6_acceptance_spec_grid the proportion check runs on 96 x 96 x 32 with 4 x 4 x 1 cells because 3 sigma is 0.118 to 0.180 on the spec grid; the 0.02 bound holds with 16 conditioning holes only: unconditional ensembles miss it (0.038) and miss the transiograms by up to 0.19, a documented method limit pinned by crates/mcrf/tests/limits.rs
M7 partial python/tests/test_integration.py T-PROGS meets every check; MCRF on the 32 x 32 x 30 integration grid honours every hard datum but misses the 0.02 proportion bound (largest gap about 0.04 over 20 realizations, 3 sigma 0.013), so the test asserts proportions for T-PROGS only; this is the MCRF limit described in docs/guide/mcrf-mcp.md

Milestone scopes and acceptance checks

M1: Markov chains on sequences

  • Scope: Rust workspace and pyo3 skeleton (crates/core, crates/chain, crates/py), tg.MarkovChain (embedded and fixed-step transition counting, smoothing, generator matrix fitting, stationary distribution, chi-square and G-test for Markov order and stationarity, seeded 1D simulation), .pyi stubs, and tg.plot.transition_matrix.
  • Acceptance check: For any fitted MarkovChain, every row of the transition matrix sums to 1 within 1e-12, and a seeded simulated chain of $10^5$ steps reproduces the input transition matrix and stationary proportions within a three-sigma binomial tolerance.

M2: Hidden Markov models (HMM)

  • Scope: crates/hmm and tg.HiddenMarkovModel with Gaussian (diagonal and full covariance) and categorical emissions, log-domain forward-backward, Viterbi decoding, Baum-Welch fitting with optional clamped states on logged intervals, and tg.plot.strip_log.
  • Acceptance check: On a 4-state, 8-step test sequence, hmm.viterbi(obs) matches an exhaustive brute-force enumeration of all $4^8$ state paths in both path and log-probability (atol=1e-12), forward-backward state posteriors sum to 1 at every depth step, and log-likelihood is non-decreasing at every Baum-Welch iteration.

M3: Hidden semi-Markov models and model selection

  • Scope: tg.HiddenSemiMarkovModel with explicit dwell-time distributions (geometric, Poisson, negative binomial, empirical), forward-backward and Viterbi duration decoding, EM fitting, and tg.select_order / tg.select_states returning AIC, BIC, and leave-one-hole-out log-likelihood tables.
  • Acceptance check: An HSMM configured with geometric dwell-time distributions produces the same log-likelihood (atol=1e-10) and Viterbi state sequence as the equivalent standard HMM on the same observations, and BIC recovers the true number of states $K=3$ on a seeded synthetic drillhole dataset.

M4: Transiograms

  • Scope: crates/transiogram, tg.experimental_transiogram (1D downhole and 3D directional lag tolerances), tg.TransiogramModel (matrix-exponential and coupled analytical models with row-sum-to-one projection), and tg.plot.transiogram.
  • Acceptance check: At every lag $h \ge 0$ and for every source category $i$, the modelled transition probabilities satisfy $p_{ij}(h) \ge 0$ and $\sum_j p_{ij}(h) = 1$ within 1e-12, equal the Kronecker delta $\delta_{ij}$ at $h = 0$, and converge to the target category proportions as $h \to \infty$.

M5: Transition-probability simulation on grids

  • Scope: crates/tpsim T-PROGS engine (tg.tprogs_simulate), 3D anisotropy from principal Markov rates or mean lens dimensions, sequential transition-probability indicator simulation, and simulated annealing quenching on 2D/3D grids conditioned to point or interval samples.
  • Acceptance check: Every realization reproduces all hard conditioning grid nodes without exception, and the ensemble average over 20 seeded realizations reproduces input category proportions within 0.02 and input directional auto-transiograms within 0.05 RMSE up to two correlation lengths.

M6: MCRF and MCP on grids

  • Scope: tg.mcp_predict (deterministic conditional probability cubes, most-probable category, and Shannon entropy) and tg.mcrf_simulate (sequential Markov chain random field realizations on 2D/3D grids conditioned to drillholes).
  • Acceptance check: Predicted MCP probabilities at every grid node are non-negative and sum to 1 across categories within 1e-12, hard conditioning nodes return a degenerate probability of 1 on the observed category, and seeded MCRF realizations reproduce target category proportions within 0.02.

M7: boitata integration example

  • Scope: Worked end-to-end documentation example (examples/07-boitata-integration/) and test showing how boitata desurveyed/composited drillhole intervals pass as NumPy arrays into transiograms for HMM lithology segmentation, 3D transiogram fitting, and MCRF/T-PROGS categorical grid simulation, and how the resulting categorical array feeds back into boitata for domain-controlled kriging.
  • Acceptance check: The standalone integration check passes NumPy drillhole arrays into transiograms and returns a 3D integer category grid matching the target grid shape, with 100% hard-data agreement at conditioning cells and category proportions within 0.02 of target proportions.

Stack

  • Core: Rust workspace, rayon for thread-count-independent parallelism, proptest for property tests, criterion for benchmarks (none written yet).
  • Python bindings: pyo3 (abi3-py311) built with maturin.
  • Runtime dependencies: numpy as the sole required runtime dependency; matplotlib as the optional plot extra (pip install "transiograms[plot]").
  • Tooling: mise for task running and tool pinning, uv for Python environments, mkdocs for documentation.

Non-goals

  • General Bayesian networks or arbitrary factor graphs.
  • Unstructured mixture models without sequence or spatial transition structure.
  • Neural sequence models.
  • Continuous-variable variography, kriging, or Gaussian simulation (those live in boitata).

Performance

Not measured. No benchmark has been run yet, so this repository states no speed or throughput. The plan is to benchmark the Rust kernels with criterion and to compare end-to-end Python calls with hmmlearn and pomegranate, in interleaved rounds on one machine and session, reporting medians and the machine load. mise run bench runs cargo bench, and no crate has benches yet.

Workload transiograms hmmlearn pomegranate
Markov chain transition tally ($10^6$ samples, 8 categories) not measured not measured not measured
HMM forward-backward ($10^4$ steps, 6 states, 4 Gaussian channels) not measured not measured not measured
HMM Viterbi decoding ($10^4$ steps, 6 states, 4 Gaussian channels) not measured not measured not measured
HMM Baum-Welch 20 iterations (100 drillholes $\times$ 500 steps) not measured not measured not measured
3D T-PROGS / MCRF grid simulation ($100 \times 100 \times 50$, 4 facies) not measured not measured not measured