Repository navigation
Reaction-network oracles example notebook (#65) - #75
Merged
Merged
Conversation
Refs #65. examples/55_reaction_network_oracles.ipynb (scientific arc, executed outputs) checks estimators against ReactionNetworkBenchmark card oracles: - exact DMD on raw chain concentrations recovers exp(lambda dt) (~1e-7) and its rollout conserves mass (~1e-6); - DMD on the card's log features misses by up to ~0.13; - a 40-epoch koopman="graph" fit (koopman_filter_degree=2) is within ~0.004-0.16 of oracle eigenvalues but drifts ~0.6 in mass, which element_balance_violation flags; - late-window DMD recovers the Michaelis-Menten slow mode against the trajectory's own equilibrium linearization (7e-4 from step 48). Registered in the PR notebook smoke list and the full 27-55 shard, the tutorials table, and the guide honesty-lock test. Adds ReactionDataset.sequence(graph_encoding=) so hyperedge cards can feed DMDBaseline. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Carries the reviewed #69-#74 fixes up to #75 and clears its conflict. benchmark.py: keep the graph_encoding validation in ReactionDataset.sequence and use #74's _check_index helper. CHANGELOG: keep the notebook / graph_encoding entries and #74's eigenvalue_timescales and Cantera SHA-256 entry (updated for the optional zero_tolerance). The notebook re-executed on the merged code prints the same numbers as its committed outputs, so the outputs are left unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #65 once the stack merges. This is the last planned piece. Stacked on #74 (→ #73 → #72 → #71 → #70 → #69). Merge in order #69 → … → #74 → this one. Each PR retargets to
mainwhen the one below it merges, and CI starts then.Changes
examples/55_reaction_network_oracles.ipynbfollows the repo's scientific arc (Setup → … → Further reading), with outputs committed. It checks estimators against theReactionNetworkBenchmarkcard oracles, with every claim asserted in the notebook:reaction_chain_v1concentrations vs oracleexp(λΔt)logmakes the linear chain a nonlinear observableGraphKoopmanModel(koopman="graph", koopman_filter_degree=2)element_balance_violationon held-out rolloutsEach finding is spelled out in the notebook:
koopman="pernode"can't represent cross-species coupling, so the fit useskoopman="graph"(its spectrum needsedge_index).UserWarning).The notebook doesn't download data and doesn't need
[cantera].Registration
notebooks (smoke)list, and the full shard widens from27-54/5[0-4]to27-55/5[0-5].docs/source/tutorials.rst: new table row.tests/package/test_notebooks_v015_guides.py: honesty-lock entry pinning the title, the arc headings, and the needlesReactionNetworkBenchmark,element_balance_violation,not a production kinetics benchmark,linearization,own equilibrium, and no METR-LA download.Small API addition:
ReactionDataset.sequence(index, *, graph_encoding=None)overrides the card's encoding.DMDBaselinerejects hyperedge sequences, soreaction_michaelis_menten_v1(hyperedge card) needsgraph_encoding="species_influence". A test covers it.Verification (macOS arm64, Python 3.13)
OMP/MKL/OPENBLAS/TORCH_NUM_THREADS=1 pytest --nbmake examples/55_reaction_network_oracles.ipynb: passed in 17.7 s.ruff checkandruff format --checkonsrc/ tests/ scripts/pass.-m "not slow and not distributed and not ray" --cov-fail-under=90: 3516 passed, 26 skipped, 97.30%.sphinx-build -W --keep-goingpasses.main.🤖 Generated with Claude Code