Skip to content

edaphos 1.1.0 — Bayesian PIML, BatchBALD, structure learning, LLM voting

Choose a tag to compare

@HugoMachadoRodrigues HugoMachadoRodrigues released this 22 Apr 17:18
· 174 commits to main since this release

Summary

Three pillars gain scientifically load-bearing depth in one coherent
release: point estimates become posteriors in Pillar 2, heuristic
batch acquisition becomes information-theoretic in Pillar 5, and the
LLM-only causal-discovery story in Pillar 1 acquires both a
bottom-up counterpart and a multi-extractor consensus layer.

Pillar 2 — Bayesian posterior over the pedogenetic ODE

piml_profile_fit_bayesian() returns the full posterior over
$(\lambda_0, \mu, y_\infty, y_0)$ via two nested approximations:

  • Laplace (default, O(ms) per pedon) — Gaussian posterior from
    the MAP + inverse observed Fisher information at the MAP (Bishop
    2006, §4.4), with 2 000 pre-sampled draws for downstream
    predict().
  • Adaptive random-walk Metropolis (Haario, Saksman and Tamminen
    2001; ~seconds per pedon) — proposal covariance starts at the
    Laplace covariance, scaled by the Roberts–Gelman–Gilks
    $(2.38)^2 / d$ factor, and is updated online by Haario recursion
    after warm-up, so multimodal and non-Gaussian posteriors are
    captured faithfully.

predict.edaphos_piml_bayes() propagates the full posterior through
the forward ODE; include_obs_noise = TRUE switches the credible
interval from "mean function" to "future observation" semantics.

The Neural-ODE analogue is piml_neural_ode_fit_ensemble() — a
deep ensemble (Lakshminarayanan, Pritzel and Blundell 2017; Wilson
and Izmailov 2020) whose K independent networks' empirical spread
approximates the Bayesian predictive posterior.

Pillar 5 — BatchBALD information-theoretic batch acquisition

al_query_batchbald() implements BatchBALD (Kirsch, van Amersfoort
and Gal 2019) for regression on top of the existing QRF backbone.
The trees of the forest are the T posterior parameter draws, the
joint epistemic covariance is their empirical covariance across
candidates, and the mutual-information objective reduces to

$$ \mathrm{BatchBALD}(B) ;\propto; \tfrac{1}{2}\log\det!\bigl( \mathrm{Cov}_\theta(f_\theta(B)) + \sigma_a^2 I_{|B|} \bigr). $$

Greedy argmax via incremental Cholesky / Schur-complement updates
gives every greedy step $O(m^2 n_{\mathrm{pool}})$ rather than
$O(m^3 n_{\mathrm{pool}})$; the log-det is monotone submodular so
greedy selection inherits a $(1 - 1/e)$ optimality guarantee
(Nemhauser, Wolsey and Fisher 1978). BatchBALD addresses the
cluster-of-near-duplicates failure mode of top-$n$ BALD and
complements — does not replace — the uncertainty + diversity hybrid
for physics-gated, cost-aware acquisition.

Pillar 1 — Structure learning + multi-extractor voting

Structure learning. causal_structure_learn() wires four
bnlearn algorithms through a uniform interface that returns an
edaphos_causal_kg:

  • "hc" — hill-climbing over Gaussian BIC (default).
  • "tabu" — tabu-search hill-climbing.
  • "pc-stable" — PC-stable constraint-based (Colombo and Maathuis
    2014).
  • "mmhc" — max-min hill-climbing hybrid (Tsamardinos, Brown and
    Aliferis 2006).

Whitelists / blacklists encode pedological priors ("parent material
must precede soil chemistry"); an optional non-parametric bootstrap
attaches per-edge strengths that become the confidence field of
the returned KG, so the learned DAG can be unioned with the
LLM-derived KG via the standard causal_augment_dag() path.

Multi-extractor consensus. causal_llm_vote() runs N LLM
backends on the same abstract and resolves disagreements by one of
three voting rules:

rule keeps edges asserted by
"majority" at least min_support backends (default ceil(N/2))
"weighted" edges with $\sum_i w_i c_i \geq$ threshold
"intersection" every backend

causal_llm_ingest_abstract_voted() wraps vote + KG insertion and
tags the source field with the vote metadata. A crashing backend
emits a warning and contributes zero claims — the vote continues
with the remaining backends so corpus-scale ingestion degrades
gracefully.

Documentation

  • Vignette pilar1-causal gains §12 "Structure learning from
    horizon data" and §13 "Multi-extractor consensus: voting across
    LLM backends" with reproducible examples.
  • Vignette pilar2-piml-profile gains §8 "Bayesian posterior over
    the ODE parameters" with Laplace + MCMC + deep ensemble
    derivations.
  • Vignette pilar5-active-learning gains §6 "Information-theoretic
    batch acquisition: BatchBALD" with the log-det derivation and a
    cluster-of-near-duplicates motivating example.
  • README gains a per-addition subsection in each affected pillar.

Quality

  • 89 new tests across five files (test-piml-bayesian,
    test-piml-neural-ode-ensemble, test-al-batchbald,
    test-causal-structure, test-causal-llm-vote). The LLM-voting
    tests use testthat::local_mocked_bindings() so the multi-
    backend path is exercised against deterministic fixtures.
  • R CMD check --as-cran: 0 errors / 0 warnings / 0 notes.

Install notes

New optional dependency for structure learning:

install.packages("bnlearn")

bnlearn is a Suggests; every entry point emits a clear install
hint if its stack is missing.