Conversation
Implements ablation analysis to measure the robustness of LASSO-identified receptor circuits by zeroing out selected receptor channels and refitting. New features: - scripts/lasso_with_ablations.py: CLI script for ablation analysis - Supports --ablate (comma-separated) and --ablate_file (one per line) - ablation_set_mode: single (each receptor individually) or all_in_one - missing_receptor_policy: error or skip - Outputs: baseline_model.json, ablation_summary.csv, per-ablation artifacts - Helper functions in behavioral_prediction.py: - resolve_receptor_names(): Case-insensitive receptor name matching - apply_receptor_ablation(): Zero out specified receptor columns - fit_lasso_with_fixed_scaler(): Refit LASSO with preserved baseline scaler Key design decisions: - Fit scaler on baseline X, reuse for ablation variants (apples-to-apples) - Case-insensitive exact matching only (no fuzzy matching) - Deterministic ordering and filenames Tests: 25 new tests in test_lasso_ablation.py covering: - Receptor name resolution - Ablation matrix operations - LASSO fitting with fixed scaler - Output file format validation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements focus mode analysis to measure how many receptors are needed for accurate behavioral prediction by restricting to top-N receptors from baseline and refitting LASSO. New features: - scripts/lasso_with_focus_mode.py: CLI script for focus mode analysis - --topn_list: comma-separated N values (e.g., "1,2,3,5,10,15,20") - --focus_receptors: explicit receptor list (overrides topn_list) - --baseline_select_by: ranking method (abs_weight default) - Outputs: baseline_model.json, focus_curve.csv, focus_curve.png - Helper functions in behavioral_prediction.py: - restrict_to_receptors(): Subset feature matrix to specified receptors - get_top_receptors_by_weight(): Rank receptors by |LASSO weight| Key design decisions: - For each N, fit scaler on restricted X (fair comparison within N) - Deterministic receptor ranking by absolute weight - Case-insensitive receptor name matching - Generates MSE vs N and R² vs N curves Tests: 24 new tests in test_lasso_focus_mode.py covering: - Feature matrix restriction - Top-N receptor selection (determinism verified) - Focus mode integration workflow - Output file format validation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…folder - Create dedicated ablations/ subfolder within condition output directory - Move ablation_summary.csv to ablations/ablation_summary.csv - Move ablation_comparison.png to ablations/ablation_comparison.png - Individual ablation results remain in separate ablate_* folders Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughIntroduces two new CLI scripts for robustness analysis of LASSO-identified receptor circuits: Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant CLI as lasso_with_ablations.py
participant Predictor as LassoBehavioralPredictor
participant FileIO as File I/O
participant Viz as Visualization
User->>CLI: Run with config + receptors
CLI->>CLI: Parse args & resolve receptor names
CLI->>Predictor: Build predictor
CLI->>Predictor: run_baseline (fit LASSO on full set)
Predictor-->>CLI: baseline_result (metrics, weights, scaler)
CLI->>CLI: Ablate receptors (zero columns)
CLI->>Predictor: fit_lasso_with_fixed_scaler (refit on ablated)
Predictor-->>CLI: ablation_result (delta metrics)
CLI->>FileIO: Save per-ablation artifacts
FileIO-->>CLI: Saved
CLI->>Viz: plot_ablation_comparison (baseline vs. ablations)
Viz-->>CLI: PNG generated
CLI->>FileIO: Save summary CSV
CLI->>User: Print summary + exit
sequenceDiagram
actor User
participant CLI as lasso_with_focus_mode.py
participant Predictor as LassoBehavioralPredictor
participant Ranker as Receptor Ranking
participant FileIO as File I/O
participant Viz as Visualization
User->>CLI: Run with config + focus targets
CLI->>CLI: Parse args
CLI->>Predictor: Build predictor
CLI->>Predictor: run_baseline (fit LASSO on full set)
Predictor-->>CLI: baseline (weights, R², MSE, scaler)
CLI->>Ranker: get_top_receptors_by_weight (rank by |weight|)
Ranker-->>CLI: Ranked receptor list
CLI->>CLI: Generate focus sets (explicit or top-N)
loop For each focus set
CLI->>CLI: restrict_to_receptors (subset features)
CLI->>Predictor: fit_lasso_with_fixed_scaler (refit on subset)
Predictor-->>CLI: focus_result (subset metrics)
end
CLI->>FileIO: Save baseline.json, focus JSONs, focus_curve.csv
FileIO-->>CLI: Saved
CLI->>Viz: plot_focus_curve (MSE & R² vs. N receptors)
Viz-->>CLI: PNG generated
CLI->>User: Print summary + exit
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
✨ Finishing touches
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (8)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com
Summary by CodeRabbit
Release Notes
New Features
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.