Add (1-W) weight masking to TROP global method#195
Conversation
…ISTA acceleration The soft-thresholding threshold for the L matrix was λ_nn/max(δ) when the correct value is λ_nn/(2·max(δ)), derived from the Lipschitz constant L_f = 2·max(δ) of the quadratic gradient. This over-shrinking caused singular values to be reduced too aggressively. Fix applied to all four code paths: Python joint, Python twostep, Rust joint, Rust twostep. Also adds FISTA/Nesterov acceleration to the twostep inner solver for faster L convergence (O(1/k²) vs O(1/k)). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ghts The proximal threshold was hardcoded as λ/(2) which is only correct when W_max=1. Changed to λ/(2·W_max) to match the joint solver and Rust backend. Added test with non-uniform weights and updated REGISTRY.md algorithm docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…rings - Add conditional threshold when W_max==0 to prevent ZeroDivisionError, matching Rust backend behavior (trop.rs:665) - Update Python and Rust docstrings to reflect correct FISTA/Nesterov acceleration formulas (L_f = 2·max(W), η = 1/(2·max(W))) - Add regression test for all-zero weights edge case Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Align the TROP global method with the paper's Eq. 2 by adding (1-W) masking so the model is fit on control data only, then extracting treatment effects post-hoc as residuals (tau_it = Y - mu - alpha - beta - L). Key changes: - Apply (1-W) masking in _compute_joint_weights, zeroing treated cells - Remove tau from the joint solvers (no longer identifiable under masking) - Extract per-observation treatment effects post-hoc; ATT = mean(tau_it) - Add FISTA/Nesterov acceleration to the nuclear norm solver (O(1/k²)) - Rename method='joint' to method='global' with FutureWarning deprecation - Extract _solve_joint_model and _extract_posthoc_tau helpers to reduce duplication - Mirror all changes in Rust backend Monte Carlo validation (20 reps × 5 configs) shows: - No-lowrank configs: exact match with CVXPY reference (|Δτ| = 0) - Low-rank configs: mean |Δτ| = 0.0004 (λ_nn=0.1), 0.026 (λ_nn=0.01) - 100% of comparisons within 0.10 of reference Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
/ai-review |
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall Assessment Executive Summary
Methodology
Code Quality
Performance
Maintainability
Tech Debt
Security
Documentation/Tests
Static review only. I could not run numpy-based reproductions in this shell because |
…isoning - Add final re-solve after outer loop convergence in _solve_joint_with_lowrank to ensure mu/alpha/beta are consistent with converged L (matches Rust) - Filter NaN ATT draws in bootstrap fallback with np.isfinite check - Clarify global method docs as adaptation of Eq. 2 masking principle, not paper-exact Algorithm 2 - Update FISTA documentation to reflect both solvers now use acceleration Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
/ai-review |
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall Assessment Executive Summary
Methodology
Code Quality
Performance
Maintainability
Tech Debt
Security
Documentation/Tests
|
Address five failure modes observed after gpt-5.4 upgrade (PRs #192, #194, #195): documented deviations flagged as blockers, deferred work not accepted, moving goalposts on re-review, undefined approval criteria, and valid implementation choices treated as methodology errors. Changes to pr_review.md: - Exempt REGISTRY.md-documented deviations from P0/P1 (classify as P3) - Add implementation choice exception for valid numerical approaches - Add Deferred Work Acceptance section honoring TODO.md tracking - Add Assessment Criteria with objective verdicts and mitigation rules - Add Re-review Scope rules to prevent oscillation between rounds Changes to ai_pr_review.yml: - Add step to fetch previous AI review comment for re-review context - Inject prior review findings into compiled prompt on /ai-review reruns Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
/ai-review |
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall Assessment Executive Summary
Methodology
Code Quality
Performance Maintainability Tech Debt Security Documentation/Tests
Path to Approval
|
…bootstrap SE - Rust solve_joint_no_lowrank: check convergence across all params (mu, alpha, beta), not just mu — fixes premature termination and Rust/Python divergence - Global + twostep: use n_valid_treated (finite outcomes only) for df_trop and results.n_treated_obs; skip NaN Y in twostep loop to prevent NaN poisoning - Return np.nan (not 0.0) SE when <2 bootstrap draws succeed (all 3 paths) - Update API docs: method='joint' example → method='global' - Fix stale FISTA reference in REGISTRY.md global section - Add edge case docs for partial/all-NaN treated outcomes Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
/ai-review |
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall Assessment ✅ Looks good Executive Summary
Methodology No unmitigated P0/P1 findings.
Code Quality No material diff-specific findings. Performance No material diff-specific findings. Maintainability No material diff-specific findings. Tech Debt No material diff-specific findings. Security No material findings in the diff. Documentation/Tests
|
The test patches _fit_joint_with_fixed_lambda to force failures, but on CI with Rust available, the Rust bootstrap path runs instead of the Python fallback. Disable Rust backend in the test to exercise the Python return path. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Address five failure modes observed after gpt-5.4 upgrade (PRs #192, #194, #195): documented deviations flagged as blockers, deferred work not accepted, moving goalposts on re-review, undefined approval criteria, and valid implementation choices treated as methodology errors. Changes to pr_review.md: - Exempt REGISTRY.md-documented deviations from P0/P1 (classify as P3) - Add implementation choice exception for valid numerical approaches - Add Deferred Work Acceptance section honoring TODO.md tracking - Add Assessment Criteria with objective verdicts and mitigation rules - Add Re-review Scope rules to prevent oscillation between rounds Changes to ai_pr_review.yml: - Add step to fetch previous AI review comment for re-review context - Inject prior review findings into compiled prompt on /ai-review reruns Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
method='joint'tomethod='global'withFutureWarningdeprecation alias_solve_joint_modeland_extract_posthoc_tauhelpers to reduce duplicationMethodology references
(1-W)*deltaweightingmean(Y - mu - alpha - beta - L)over treated cells. This matches the paper's intent and produces less-biased ATT estimates.Validation
tests/test_trop.py— 5 new tests (test_global_*), 4 updated tests (test_method_in_get_params,test_method_in_set_params,test_method_set_params_joint_deprecated,test_joint_rejects_staggered_adoption)Security / privacy
Generated with Claude Code