Add DRAGON cross-language parity test#406
Open
marouenbg wants to merge 2 commits into
Open
Conversation
Add a parity test asserting that netZooR's dragon() reproduces a fixed snapshot of lambdas, shrunken covariance, precision matrix, and partial correlation matrix. The same shared inputs (X1.csv, X2.csv) and gold values are byte-identical to netZooPy's tests/dragon_parity/ -- if both tests pass, the two implementations agree to 1e-5 (atol). The fixtures are generated by netZooPy's tests/dragon_parity/regenerate.py from simulate_dragon_data with seed=20250510. Kappa / p-values are not covered, since estimate_kappa_dragon and estimate_p_values_dragon are unimplemented stubs in netZooR. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 tasks
The DRAGON parity test runs alongside the rest of testthat, so it shares the same test-coverage and bioc-check jobs as everything else. Both have pre-existing problems on devel that this PR was hitting: - test-coverage was installing the reticulate R package but not Python itself, so reticulate::source_python() in pandaPy failed and broke the whole testthat run. Mirror bioc-check's Python setup (install numpy/scipy/pandas and export RETICULATE_PYTHON), Linux only since test-coverage runs on ubuntu-latest. - bioc-check on R devel couldn't resolve GOstats via pak, taking down the dependency install. Use pak directly for the devel matrix entry and pass "GOstats=?ignore" so the rest of the deps still resolve. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Author
|
@taraeicher if you accept this, we can rebase and fix #404 for free |
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.
Summary
Add a parity test that pins netZooR's
dragon()outputs to a fixed numeric snapshot. The same shared inputs and gold values are committed byte-identical in netZooPy (companion PR: netZoo/netZooPy#389). If both tests pass, the two implementations agree to 1e-5 absolute tolerance.What's covered
lambdas(penalty parameters)cov— shrunken covarianceprec— precision matrixggm— partial correlation matrixWhat's not covered
estimate_kappa_dragonandestimate_p_values_dragonin R/DRAGON.R have empty function bodies; the publicdragon()prints "not yet implemented in R; to estimate p-values, use netZooPy"). When R gains a κ/p-value implementation, this parity test should be extended to cover it.Fixtures
X1.csv(50×20),X2.csv(50×15) — generated deterministically in netZooPy viatests/dragon_parity/regenerate.pyfromsimulate_dragon_data(seed=20250510), then column-scaled.lambdas.txt,cov.csv,prec.csv,ggm.csv. Snapshot of netZooPy's pipeline at the time of generation.tests/dragon_parity/.Local results
R and Python agree two orders of magnitude tighter than the 1e-5 tolerance.
Companion PR
Test plan
Rscript -e 'library(testthat); library(netZooR); setwd("tests/testthat"); test_file("test-dragon-parity.R")'— 4 PASS / 0 FAIL locallytests/testthat/test-dragon.R🤖 Generated with Claude Code