Skip to content

Split natural-gradients maths into a new Getting-started notebook - #765

Open
thomaspinder wants to merge 1 commit into
v1.0from
docs/natural-gradients-restructure
Open

Split natural-gradients maths into a new Getting-started notebook#765
thomaspinder wants to merge 1 commit into
v1.0from
docs/natural-gradients-restructure

Conversation

@thomaspinder

Copy link
Copy Markdown
Owner

Checklist

  • I've formatted the new code by running uv run poe format before committing.
  • I've added tests for new code.
  • I've added docstrings for the new code.

Description

docs/examples/natgrads.py and docs/examples/dual_svgp.py mixed heavy mathematical derivation with GPJax API demonstration, which made them hard to use as a pure "how do I call this" reference despite being genuinely excellent as standalone maths writeups.

This PR splits them:

  • New: docs/examples/natural_gradients.py (Getting started, after poisson) — the full maths: the exponential-family view of q(u), the Fisher-information-is-a-Jacobian identity, mirror descent, the "one step is enough" conjugate theorem (demonstrated once for both the moment-storage and dual/site-storage branches on a shared toy problem), the dual/site-parameterisation derivation (EP connection, tied update, the two silent storage-convention traps), cone-safety proofs for both branches, and the dual_elbo-vs-elbo M-step claims table.
  • docs/examples/natgrads.py (Accelerating Gaussian processes, unchanged position) — trimmed from 1152 to 966 lines. Keeps both worked demos in full (the conjugate 1-step-vs-Adam race, the non-conjugate mini-batched banana benchmark) and the failure-mode/backoff demo, now assuming the reader has read natural_gradients.py instead of re-deriving the theory inline.
  • docs/examples/dual_svgp.py — trimmed from 1576 to 1093 lines, same treatment: keeps its conjugate demo, the ρ=γ equivalence check, the 3-way banana benchmark, and the M-step-in-practice VEM loop, assuming the new notebook for the derivations.
  • docs/index.md — new toctree entry for examples/natural_gradients under "Getting started".

All three notebooks were executed end-to-end during this work; every printed numeric claim in the prose is a real number from an actual run, not carried over from the old notebooks. One real bug was caught and fixed in the process (a missing jitter kwarg in dual_svgp.py's ported conjugate-model setup that was throwing its Titsias-optimum comparison off by several orders of magnitude), and one previously-dangling cross-reference (a numerical demo two notebooks each pointed at the other to find) was restored into natural_gradients.py.

Issue Number: N/A

natgrads.py and dual_svgp.py mixed heavy derivation with GPJax API
demonstration, which made them hard to use as a pure usage reference.
docs/examples/natural_gradients.py now carries the full maths (exponential-
family view, Fisher = Jacobian, mirror descent, the dual/site derivation,
both cone-safety proofs, the M-step claims table); the two existing
notebooks keep their worked demos and plots in full but assume that
notebook read first instead of re-deriving it inline.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UmdHyjMN5UdYLMD2JzE6s
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

📖 Docs preview: https://pr-765--endearing-crepe-c2d5fe.netlify.app

Smoke render — the expensive notebooks run with reduced budgets, so
figures are not publication fidelity. /render-mode.txt says smoke.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant