-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/lasso partb compat #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ript - Updated `run_lasso_behavioral_prediction.py` to change default missing control policy to "error" and added a new argument for lambda range delta. - Implemented `run_lasso_full_sweep.py` to facilitate comprehensive LASSO sweeps, including baseline, ablations, and focus mode per condition. - Expanded tests in `test_lasso_behavioral_prediction.py` to cover new control subtraction policies and added fixtures for extended testing scenarios. - Added tests in `test_lasso_focus_mode.py` to ensure reproducibility and integrity of focus mode runs.
- Implement `run_stability_and_metrics.py` to compute stability scores and standardized metrics. - Update documentation to include usage instructions for the new stability layer. - Create unit tests for stability metrics, ensuring determinism and schema validation.
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThis PR adds comprehensive diagnostics and analysis infrastructure for LASSO-based behavioral prediction. It introduces new diagnostic scripts for auditing model pipelines and computing stability metrics, updates existing analysis scripts to support control-subtraction (ΔPER) runs with configurable missing-control policies, extends the core behavioral prediction module with helper utilities for ablation and feature restriction, adds documentation explaining LASSO collapse and drift hypotheses, introduces tests validating determinism and schema correctness, and updates .gitignore to track diagnostic outputs. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant AuditScript as run_postA_postB_audit.py
participant Predictor as LassoBehavioralPredictor
participant Models as LASSO/Ridge/ElasticNet
participant Metrics as Metrics Engine
participant Output as CSV/JSON/Markdown
User->>AuditScript: CLI args (conditions, lambdas, modes)
AuditScript->>Predictor: Initialize with DoOR cache & behavior data
loop For each condition & mode
AuditScript->>Predictor: Build valid odorants (with control-subtraction)
Predictor-->>AuditScript: Features (X), targets (y), receptor names
loop For each model class (LASSO/Ridge/ElasticNet)
AuditScript->>Models: Fit with lambda grid & cross-validation
Models-->>AuditScript: CV MSE, coefficients, predictions
AuditScript->>Metrics: Compute NMSE, MAE, intercept-only baseline
Metrics-->>AuditScript: RunResult (metrics & diagnostics)
end
end
AuditScript->>Output: Write audit_metrics.csv
AuditScript->>Output: Write audit_artifacts.json
AuditScript->>Output: Generate AUDIT_SUMMARY.md (reproducibility checks)
AuditScript->>User: Report (reproducibility, mutations, collapses)
sequenceDiagram
participant User
participant StabilityScript as run_stability_and_metrics.py
participant Predictor as LassoBehavioralPredictor
participant Models as LASSO/Ridge/ElasticNet
participant Stability as Stability Analyzer
participant Output as CSV/Markdown
User->>StabilityScript: CLI args (conditions, modes, CV settings)
StabilityScript->>Predictor: Initialize from cache & behavior data
loop For each condition & prediction mode
StabilityScript->>Predictor: Extract features (X, receptor names)
Predictor-->>StabilityScript: Feature matrix & target vector
alt Raw mode
StabilityScript->>Models: Fit LASSO/Ridge/ElasticNet on lambda grid
else Delta (ΔPER) mode
StabilityScript->>Predictor: Subtract control from features
StabilityScript->>Models: Fit models on control-adjusted data
end
Models-->>StabilityScript: ModelFit (coefficients, cv_mse, n_selected)
StabilityScript->>Stability: Compute per-receptor selection frequency & sign consistency
Stability-->>StabilityScript: Stability metrics row
end
StabilityScript->>Output: Write model_metrics.csv
StabilityScript->>Output: Write stability_per_condition.csv
StabilityScript->>Output: Generate SUMMARY.md (confidence flags & recommendations)
StabilityScript->>User: Stability analysis complete
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Poem
✨ Finishing touches
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (15)
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 |
This pull request introduces support for ΔPER (opto-control subtraction) analysis, improves CLI flexibility, and adds robust handling for missing controls in the
scripts/lasso_with_ablations.pypipeline. It also updates documentation to clarify ΔPER logic, introduces new diagnostics and planning documents, and enhances reproducibility and interpretability for LASSO behavioral prediction analyses.Key changes include:
ΔPER (opto-control subtraction) support and CLI improvements
--subtract_control,--control_condition, and--missing_control_policyflags to the CLI, enabling ΔPER analysis and flexible control dataset handling. The CLI now supports multiple conditions via repeated or comma-separated--conditionflags, and logs debug stats with--debug_stats. [1] [2] [3]_build_valid_odorantsto align and subtract opto/control responses according to the chosen missing control policy (skip,zero, orerror), with robust error handling and logging.run_baselineandrun_ablationto support ΔPER mode and propagate debug logging and control policy options. [1] [2] [3] [4]Documentation and diagnostics enhancements
docs/BEHAVIORAL_PREDICTION_ANALYSIS.mdto document ΔPER logic, missing control handling, and new stability layer usage. [1] [2]Usability and reproducibility
These changes collectively enable robust, transparent, and reproducible ΔPER analyses and lay the groundwork for further stability and metrics reporting in behavioral prediction workflows.
Summary by CodeRabbit
Release Notes
New Features
Documentation
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.