Improve horseshoe prior demo: pedagogical visualizations, bug fix, Python 3.12 + CUDA 12 environment - #3
Merged
Conversation
…quirements Agent-Logs-Url: https://github.com/MacroMagic/bayesian_feature_selection/sessions/e481922c-8872-4ba6-bd1e-7164d0cf9bb3 Co-authored-by: MacroMagic <162652138+MacroMagic@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
MacroMagic
April 19, 2026 01:45
View session
MacroMagic
approved these changes
Apr 19, 2026
MacroMagic
marked this pull request as ready for review
April 19, 2026 11:22
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
This PR improves the horseshoe prior MCMC demo for learners new to Bayesian methods, fixes a code bug in
visualization.py, and documents the correct environment setup for Python 3.12 and CUDA 12.Bug Fixes
visualization.py—KeyErroroninclusion_probcolumnThe
plot_feature_importancefunction referencedtop_features["inclusion_prob"]butget_feature_importance()never produces a column with that name. The column is calledbeta_inclusion_prob,lambda_inclusion_prob, orcombined_inclusion_probdepending on themethodargument. Fix: add amethodparameter toplot_feature_importanceand select the correct column.Environment / Dependency Fixes
pyproject.tomljax>=0.7.0,jaxlib>=0.7.0,numpyro>=0.15.0.Root cause: JAX 0.10.0 removed
jax.extend.core.primitives.xla_pmap_p, which NumPyro ≤ 0.20.1 still imports. JAX 0.7–0.9.x is the correct range for the current NumPyro release.jax[cuda12_pip]→jax[cuda12].README.rstAdded an "Environment Setup (Python 3.12 + CUDA 12)" section with step-by-step install commands and a version compatibility note.
Notebook Improvements (
demo/horseshoe_mcmc_feature_selection_demo.ipynb)Six new sections added to make the demo a self-contained lesson:
scale_global(τ₀) over[0.02, 0.05, 0.1, 0.2, 0.5, 1.0], plots precision/recall/F1 and # selected features vs τ₀ on a log scale with the rule-of-thumb reference lineTest Results