Reject inputs without CLR compositional variation - #1
Open
RonitBStudent wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a guard in fit() to reject inputs whose samples have no meaningful compositional variation after the CLR transform (i.e., samples differ only by total library size), preventing misleading near-zero projections and finite rho values caused by floating-point noise.
Changes:
- Add a numerical-tolerance check after CLR-centering to detect and reject “no compositional variation” inputs.
- Add a regression unit test covering scale-only sample matrices.
- Update the GitHub Actions verification workflow to run the unit test suite.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
clrcycle/__init__.py |
Adds tolerance-based detection and raises a clear ValueError when CLR-centered variation is effectively zero. |
tests/test_clrcycle.py |
Adds a regression test ensuring scale-only samples are rejected. |
.github/workflows/verify.yml |
Runs unittest discovery as part of CI verification. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Rows with identical feature proportions have no meaningful circular projection after CLR. Previously, floating-point noise could produce arbitrary near-zero coordinates and a misleading finite
rhovalue instead of surfacing that condition.Validation
python3 -m unittest discover -s tests -p 'test_*.py' -vPYTHONPATH=. python3 -m clrcycle tests/data/toy_cycle.csv --output-dir <tmp> --all-features --n-swaps 20