Repository navigation
improve workflow stability - #22
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #22 +/- ##
==========================================
+ Coverage 96.84% 98.38% +1.54%
==========================================
Files 4 4
Lines 317 621 +304
==========================================
+ Hits 307 611 +304
Misses 10 10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical and moderate findings affect statistical correctness, JAX backend behavior, and public API compatibility.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This pull request improves workflow stability by reworking PTED around batched permutation testing, containment diagnostics, backend support, and CI stabilization.
Changes:
- Adds landmark allocation, batching, reproducible RNG, and subgroup enumeration.
- Adds directional containment tests and lattice-aware PIT bands.
- Expands tests and documentation while stabilizing plotting and optional Torch CI.
File summaries
| File | Reviewed changes and final findings |
|---|---|
tests/test_utils.py |
Tests utility, batching, PIT, and enumeration behavior. |
tests/test_pted.py |
Tests public APIs, backends, calibration, and containment. |
tests/conftest.py |
Configures headless plotting. |
src/pted/utils.py |
Core implementation. Critical (3 votes): diagnostic curves omit tied y-points at lines 822/899. Critical (1 vote): JAX seed exceeds the uint32 PRNGKey range at line 461. Moderate (1 vote): lattice subsampling can invalidate exact band coverage at line 1217. Moderate (1 vote): exported utility names and chunk_size compatibility were removed at line 95. |
src/pted/tests.py |
Stabilizes package smoke tests. |
src/pted/pted.py |
Public PTED and containment APIs. Moderate (2 votes): chunk_size and pted_chunk compatibility was removed without an alias or deprecation path at line 25. |
src/pted/__init__.py |
Exports containment testing. |
README.md |
Documents updated APIs and methods. |
pyproject.toml |
Separates optional Torch dependencies. |
.github/workflows/ci.yml |
Updates CI matrix and plotting stability configuration. |
Review details
Suppressed comments (3)
src/pted/utils.py:902
- This cumulative count only includes y points that sort before the x point. For equal depths, however, the p-value definition uses
>=, so all tied y points must count; when all pooled points coincide, an x point can be assigned1/(n_y + 1)and the valid identical-distribution null can be rejected. Please make the rank/count tie-inclusive here and keep the plot helper consistent.
order = (-depth).argsort(0)
ranked_x = _take_along0(Xs.T, order, backend)
ranked_y = _take_along0((1.0 - Xs).T, order, backend)
p = (1.0 + ranked_y.cumsum(0)) / (prep["n_y"] + 1.0)
src/pted/utils.py:99
- This removes the previously exported
ptedandpted_chunkutility entry points, while the public wrappers also drop thechunk_sizekeyword. Existing callers importing these names or passing that keyword will now fail without a compatibility or deprecation path. Please retain forwarding aliases/keyword compatibility, or explicitly version and document this breaking API change.
__all__ = (
"is_torch_tensor",
"is_jax_array",
"permutation_energy_test",
"PermutationResolutionWarning",
src/pted/utils.py:1221
- When
lattice > max_points(for example, 1001 points from the default 1000 permutations), this keeps only 512 evaluation points, but_band_accept_probabilitycalibrates coverage only at those selected points. The ECDF can jump at an omitted lattice value and leave the displayed band before returning inside at the next selected point, so the claimed simultaneous confidence andachievedlevel are not guaranteed. Calibrate over every attainable point, or construct a conservative envelope that covers the omitted points before reporting this as exact.
k = (
np.arange(1, lattice + 1)
if lattice <= max_points
else np.unique(np.round(np.linspace(1, lattice, max_points)).astype(int))
)
- Files reviewed: 10/10 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| return U | ||
|
|
||
| elif backend == "jax": | ||
| key = jax.random.PRNGKey(int(rng.integers(0, 2**62))) |
| order = (-depth).argsort(0) | ||
| ranked_x = _to_numpy(_take_along0(Xs.T, order, backend), backend) | ||
| ranked_y = _to_numpy(_take_along0((1.0 - Xs).T, order, backend), backend) | ||
|
|
||
| n_y, rows = int(prep["n_y"]), ranked_x.shape[1] | ||
| # y points at least as peripheral as each ranked point; this is the count | ||
| # that turns into p = (1 + count) / (n_y + 1). | ||
| above = ranked_y.cumsum(0).astype(np.int64) |
| permutations: int = 1000, | ||
| return_all: bool = False, | ||
| chunk_size: Optional[int] = None, | ||
| n_landmarks: Optional[int] = None, |
No description provided.