Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #41 +/- ##
==========================================
+ Coverage 96.81% 97.19% +0.38%
==========================================
Files 36 39 +3
Lines 2226 2426 +200
==========================================
+ Hits 2155 2358 +203
+ Misses 71 68 -3 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
4 issues found across 11 files
Confidence score: 3/5
- Potential runtime errors in
src/tdhook/latent/probing/estimators.pywhenbias=Falseadds None to a tensor or when a dataset has a single class leading to divide-by-zero/NaNs. src/tdhook/latent/probing/context.pymay raise aTypeErrorduring hook registration if list types are passed intoMultiHookManagerwithout converting to tuples.- Score reflects multiple medium-severity issues that could cause failures or invalid outputs at runtime.
- Pay close attention to
src/tdhook/latent/probing/estimators.pyandsrc/tdhook/latent/probing/context.py- guard against runtime errors in edge cases and hook registration.
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/tdhook/latent/probing/context.py">
<violation number="1" location="src/tdhook/latent/probing/context.py:42">
P2: Convert `classes_to_hook`/`classes_to_skip` lists to tuples before passing them to `MultiHookManager`; otherwise passing a list will raise a `TypeError` in the `isinstance` checks during hook registration.</violation>
</file>
<file name="src/tdhook/latent/probing/estimators.py">
<violation number="1" location="src/tdhook/latent/probing/estimators.py:36">
P2: Guard against datasets with only one class; otherwise mean computation divides by zero and yields NaNs.</violation>
<violation number="2" location="src/tdhook/latent/probing/estimators.py:44">
P2: Avoid dividing by a zero coefficient norm; guard or skip normalization when the norm is zero.</violation>
<violation number="3" location="src/tdhook/latent/probing/estimators.py:172">
P2: Handle bias=False explicitly; adding None to a tensor raises a runtime error.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="docs/source/notebooks/tutorials/torchrl-ppo.ipynb">
<violation number="1" location="docs/source/notebooks/tutorials/torchrl-ppo.ipynb:267">
P2: The R² metric lambda uses predictions as the first argument, but `ProbeManager` passes `(predictions, labels)` and `r2_score` expects `y_true` first. This swaps `y_true`/`y_pred` and produces incorrect R² scores.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="tests/latent/test_probing.py">
<violation number="1" location="tests/latent/test_probing.py:197">
P2: This test codifies a crash for bias=False instead of asserting correct bias-free behavior. Consider adjusting the estimator to handle bias=None (e.g., add 0) and update the test to expect a valid output shape; otherwise the test will hide a real bug.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
What does this PR do?
Key insights about the PR.
Linked Issues
Checklist
Summary by cubic
Adds bilinear probing to train classifiers on paired layer representations and analyze cross-layer interactions. Refactors probing into a torch-first, modular API with ProbeManager/BilinearProbeManager, updates docs/notebooks, and expands tests; removes the sklearn manager.
New Features
Refactors
Written for commit d0477ae. Summary will update on new commits.