feat(wandb): WandB plot quality overhaul — deep HPO and XAI insights#36
Merged
Conversation
- shap_report: extend to LightGBM (gain), CatBoost, sklearn trees (RF/ET); compute_universal_feature_importance dispatches across all model types, normalizes and averages; log_universal_feature_importance replaces the XGBoost-only log_xgboost_shap_importance (removed) - wandb_diagnostics: wire feature_report.py per-era stability report to WandB (_log_feature_report: top by mean, top/worst by stability); add _log_era_stratified_importance from actual trained pipeline models; log_experiment_diagnostics gains log_feature_report and log_era_importance flags - wandb_utils: add log_importance_artifact (CSV Artifact for feature importance) - hpo_pipeline: add _run_best_trial_diagnostics — after HPO completes, retrain best config on 80% split, log full XAI diagnostics + Artifact to dedicated 'best-trial-diagnostics' WandB run in the same group - tests/test_xai.py: 11 tests covering XGBoost, LightGBM, CatBoost, RF, Ridge (empty), mixed pipelines, top_n, sort order, key filtering Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Fix prediction histogram: use np.histogram(bins=50) instead of per-row Table (50k+ rows → 50 rows) - Fix per-era line charts: add era_index numeric x-axis to prevent alphabetical string sort; add drawdown curve from peak cumulative corr - Add per-era correlation distribution histogram (shows negative era shape) - Add bar charts to: feature_exposure_top, feature_worst_stability, ensemble correlation matrix (A→B pair format) - Replace wide era×feature heatmap Table with wandb.plot.line_series (one line per feature over eras — shows temporal stability visually) - Fix feature_importance_model_type: move from wandb.log() (coerced to NaN) to wandb.run.summary - Expand HPO summary table from 18 → 30 columns: adds model_1/2/3_type (split for parallel coordinates), XGBoost/LightGBM hyperparams, feature selection, noise injection, augmentation flags - Add log_hpo_best_so_far(): logs trial and running-best corr_sharpe per step to a 'search-convergence' run; wired in _run_local after each trial - Remove duplicate metric/corr_sharpe from log_hpo_trial_metrics Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Owner
Author
Code reviewFound 1 issue:
To fix, persist the run ID across calls (e.g. via 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
…er-trial runs log_hpo_best_so_far created a new WandB run per trial (reinit=True + finish()), producing N independent 1-point runs rather than a single multi-step convergence curve. Replace with log_hpo_convergence() which opens one run after all trials complete and logs all steps sequentially — the same pattern as log_hpo_summary_table. Remove the per-trial call from _run_local and add a post-loop batch call. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…overhaul Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Previously init_wandb_run received only {config_path, seed, gpu}.
Now _build_wandb_config extracts the full ExperimentV1 schema:
- model_types, model_{i}_type + hyperparams (flat + nested params)
- is_multihead flag; model_{i}_input_group for MultiHeadPipeline heads
- model_{i}_local_preprocessor_{j}_type + params per head
- preprocessor_types, preprocessor_{i}_type + params (global)
- feature_group_{name}_n_features for each defined group
- ensemble_method, n_rounds, neutralization_proportion, primary_metric
Also adds architecture diagram (docs/assets/architecture.drawio.png)
and updates README with diagram, layer table, directory structure,
preprocessor list (Autoencoder, Compression, EraStable), and roadmap.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Owner
Author
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. Reviewed the 10 changed files (1,453 additions, 92 deletions):
🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
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
era_indexx-axis (fixes alphabetical string sort)line_serieschart for feature importance over erasfeature_importance_model_typemoved fromwandb.log()(silently coerced to NaN) towandb.run.summarymodel_1/2/3_type(split for WandB parallel coordinates), XGBoost/LightGBM hyperparams, feature selection, noise injection, augmentation flags; enables answering "which hyperparams drive performance?"log_hpo_best_so_far()logs trial and running-bestcorr_sharpeper step to asearch-convergencerun, showing whether the HPO search is improving over timemetric/corr_sharpededuplicated inlog_hpo_trial_metrics