Skip to content

edaphos 0.4.0 — Pillar 1 scale: corpus + ontology + BART

Choose a tag to compare

@HugoMachadoRodrigues HugoMachadoRodrigues released this 21 Apr 21:52
· 199 commits to main since this release

Summary

Pillar 1 (Causal AI) ships three new production-grade capabilities
that together promote it from a self-contained Knowledge-Graph
extractor into a literature-ingestion pipeline with a
non-linear estimator:

  1. Corpus clients for SciELO and OpenAlex — pull real abstracts
    from the world's two largest keyless open literature APIs and pipe
    them straight into the existing LLM extraction pipeline.
  2. Ontology alignment against a curated Cerrado pedometric
    vocabulary (subset of AGROVOC + ENVO) plus live AGROVOC SPARQL
    and local ENVO .obo parsing — collapses synonymous
    LLM-extracted node labels onto canonical terms before they reach
    the DAG.
  3. BART as a drop-in non-linear estimator for
    causal_estimate_effect() — the average partial derivative
    recovered from the dbarts posterior replaces the OLS coefficient
    when the covariate-outcome relationship is non-linear, with a 95 %
    posterior credible interval.

New API surface

Literature ingestion

Function Purpose
causal_corpus_scielo(query, max_results, from_year, to_year) SciELO ArticleMeta REST client. Tidy output ready for causal_llm_ingest_corpus().
causal_corpus_openalex(query, max_results, mailto, ...) OpenAlex /works client with automatic inverted-index abstract reconstruction.

Ontology

Function Purpose
causal_ontology_cerrado() Hand-curated 60-term vocabulary covering climate / relief / parent material / chemistry / vegetation / processes / outcomes.
causal_ontology_agrovoc(query, limit) Live SPARQL query to the FAO AGROVOC endpoint.
causal_ontology_envo(path) Local .obo parser via optional ontologyIndex.
causal_kg_alignment(kg, vocab, method) Three-tier matcher (exact → substring → fuzzy Levenshtein) with optional stringdist acceleration.
causal_kg_rename(kg, mapping) Collapses synonymous nodes; re-merges duplicate edges with the causal_kg_add_edge() dedup rules.

Non-linear estimator

Change Behaviour
causal_estimate_effect(estimator = \"bart\") Fits dbarts::bart() on (exposure, adjustment_set), computes counterfactual predictions at exposure + delta, and returns the average partial derivative with a 95 % credible interval from the BART posterior.

On the linear-by-construction br_cerrado data-generating process
the BART point estimate (18.82, 95 % credible [14.48, 22.45])
agrees with the OLS backdoor estimate (18.43, 95 % CI
[14.61, 22.25]) within the posterior credible width — a reassuring
sanity check that the non-linear estimator does not over-fit the
adjustment set on a known-linear problem.

Vignette upgrade

vignettes/pilar1-causal.Rmd gains three new sections:

  • §6.6 — Ontology alignment demo (mapping table + renamed KG).
  • §7 — Corpus ingestion from SciELO and OpenAlex.
  • §8 — BART non-linear estimator with full posterior recovery.

Quality

  • 221 testthat assertions (184 prior + 37 new covering corpus
    clients under httr2::with_mocked_responses(), ontology
    matchers, and the BART estimator agreement with LM on a linear
    DGP).
  • R CMD check --as-cran: 0 errors / 0 warnings / 0 notes.
  • GitHub Actions matrix: 5 / 5 jobs green on macOS, Windows and
    Ubuntu × R release / devel / oldrel-1.

Installation

remotes::install_github(\"HugoMachadoRodrigues/edaphos@v0.4.0\",
                         build_vignettes = TRUE)

# Optional heavier dependencies for the Pillar 1 scale features:
install.packages(\"dbarts\")         # BART estimator
install.packages(\"stringdist\")     # faster fuzzy matcher
install.packages(\"ontologyIndex\")  # local ENVO .obo parsing

httr2 and jsonlite remain mandatory Imports; the corpus clients
need neither account nor API key in their default configurations.

Quick start — full pipeline

library(edaphos)

# 1. Pull literature
corpus <- rbind(
  causal_corpus_scielo(\"Cerrado soil organic carbon\", max_results = 30),
  causal_corpus_openalex(\"Cerrado soil organic carbon\", max_results = 30,
                          mailto = \"you@example.org\")
)

# 2. Extract causal triples into a Knowledge Graph via a local LLM
kg <- causal_llm_ingest_corpus(
  causal_kg_new(), corpus,
  abstract_col = \"abstract\", source_col = \"source\",
  backend = \"ollama\", model = \"gemma4:latest\"
)

# 3. Align onto the canonical Cerrado vocabulary
kg <- causal_kg_rename(kg, causal_kg_alignment(kg))

# 4. Fuse with the expert Cerrado DAG
g_aug <- causal_augment_dag(causal_cerrado_dag(), kg,
                             min_confidence = 0.7)

# 5. Estimate the direct effect with BART on br_cerrado
causal_estimate_effect(
  br_cerrado, g_aug,
  exposure = \"ndvi\", outcome = \"soc\",
  estimator = \"bart\",
  bart_kwargs = list(ndpost = 500, nskip = 200)
)

Six-pillar status (unchanged since 0.3.0)

Nº Pillar Status
1 Causal AI implemented (deepened)
2 Physics-Informed ML implemented
3 4D Pedometry implemented
4 Foundation Models scaffold
5 Autonomous Active Learning implemented
6 Quantum ML scaffold

Citation

@software{Rodrigues_edaphos_2026,
  author    = {Rodrigues, Hugo},
  title     = {edaphos: Disruptive Algorithms for Digital Soil Mapping},
  year      = {2026},
  version   = {0.4.0},
  publisher = {Zenodo},
  doi       = {10.5281/zenodo.19683708},
  url       = {https://github.com/HugoMachadoRodrigues/edaphos}
}

Road ahead

Next releases (in the agreed depth-over-breadth ordering):

  • v0.5.0 — promote Pillar 4 from SimCLR scaffold to a MoCo v2
    pipeline with momentum encoder and a larger backbone on torch.
  • v0.6.0 — bridge Pillar 6 to real NISQ hardware via a
    reticulate + Qiskit Aer backend, adding a toy Variational
    Quantum Eigensolver for a simplified organo-mineral Hamiltonian.