Skip to content

[Draft] Nested sampling implementation #755

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

Draft
wants to merge 181 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
181 commits
Select commit Hold shift + click to select a range
9f84393
First draft
williamjameshandley Jul 29, 2024
cc804c2
Added testing script
williamjameshandley Jul 29, 2024
70cb149
basic particle scan
yallup Jul 30, 2024
f8b54ec
refine carry
yallup Jul 30, 2024
34b594b
sketch of history
yallup Jul 30, 2024
2f20304
cleaner scan
yallup Jul 30, 2024
639b84a
Merge remote-tracking branch 'origin/ns_history' into elliptical
yallup Aug 11, 2024
ba67732
preliminary loop
yallup Aug 11, 2024
c651b09
reject from prior
yallup Aug 12, 2024
69e7770
correct contour
yallup Aug 12, 2024
80ade3e
check in progress
yallup Sep 9, 2024
d4d211e
working loop
yallup Sep 11, 2024
066f04b
cleanup
yallup Sep 12, 2024
1aec36e
example
yallup Sep 12, 2024
ab09868
document
yallup Sep 18, 2024
8ab00fc
Merge pull request #4 from handley-lab/elliptical
yallup Sep 18, 2024
bb13cd5
add basic slice code
yallup Sep 18, 2024
91b2b8a
Merge remote-tracking branch 'origin/nested_sampling' into slice
yallup Sep 18, 2024
f4cb098
examples
yallup Sep 18, 2024
de984e3
Merge pull request #7 from handley-lab/slice
yallup Sep 18, 2024
7b3aa02
add upper limit iter
yallup Sep 27, 2024
106781b
cleanup example
yallup Sep 30, 2024
012514b
Merge branch 'nested_sampling' of github.com:handley-lab/blackjax int…
yallup Sep 30, 2024
a6e318b
slice sampling nested sampling
yallup Oct 15, 2024
7aad4e2
vertical slicing draft
williamjameshandley Oct 15, 2024
ba01a2e
Updated with slice sampling loop
williamjameshandley Oct 16, 2024
fbea2ad
Fixed prior sign issue and other shape problems
williamjameshandley Oct 16, 2024
9dc4a7f
Tidying up
williamjameshandley Oct 16, 2024
f67e7a6
Working(ish)
williamjameshandley Oct 16, 2024
a1e6b4b
selection from live
yallup Oct 17, 2024
89fe002
remove duplicated normalization
yallup Oct 17, 2024
a7f59e3
attempt convergence criteria
yallup Oct 17, 2024
c91c233
remove double choice
yallup Oct 17, 2024
11e0638
Minor corrections to evidence accumulation
williamjameshandley Oct 18, 2024
982cc1e
Corrected direction choice
williamjameshandley Oct 18, 2024
78e8eb9
better accumulation
yallup Oct 18, 2024
0e2808a
better accuulation and diagnostics
yallup Oct 21, 2024
c713df1
remove old inner kernel code
yallup Oct 21, 2024
86cf581
remove spurious normalizaiton factor guess
yallup Oct 21, 2024
de62751
better accumulation
yallup Oct 22, 2024
5b33691
tweak stepping in test
yallup Oct 23, 2024
f6213a0
fix rng key passing and stop overstepping on stepping out
yallup Oct 24, 2024
94a38ba
remove unnecessary checks on steps
yallup Oct 29, 2024
a0b5164
Multiple deletion calculation (not currently working)
williamjameshandley Nov 1, 2024
03c3019
cleanup and refactor
yallup Nov 4, 2024
652fb05
Merge branch 'nested_sampling' of github.com:handley-lab/blackjax int…
yallup Nov 5, 2024
7fe4666
add example
yallup Nov 6, 2024
7bf2938
correct contour indexing
yallup Nov 6, 2024
88fb151
loosen prior bound
yallup Nov 7, 2024
5daa6c5
minor suggestions from after-lunch meeting 2024-11-07
williamjameshandley Nov 7, 2024
84b6849
cleanup and docstring
yallup Nov 11, 2024
c955f10
precommit on
yallup Nov 11, 2024
2021dbb
Merge branch 'blackjax-devs:main' into nested_sampling
yallup Nov 11, 2024
4251639
Updated evidence accumulation
williamjameshandley Nov 11, 2024
972894a
actually add files
yallup Nov 11, 2024
e69f0bb
Merge branch 'nested_sampling' of github.com:handley-lab/blackjax int…
yallup Nov 11, 2024
685e781
Merge branch 'nested_sampling' of github.com:handley-lab/blackjax int…
williamjameshandley Nov 11, 2024
70889e3
comments added on the example and fix commit hooks
yallup Nov 11, 2024
00d8a68
remove unused old slice code
yallup Nov 11, 2024
41a127a
track PID
yallup Nov 26, 2024
f6c2220
use state rather than hard code choice for delete
yallup Nov 26, 2024
3f4f793
updated utils
yallup Dec 6, 2024
438afbd
include ns in top level api import
yallup Dec 6, 2024
f5ed32a
Merge branch 'nested_sampling' into history
yallup Dec 6, 2024
3704c76
update proposal
yallup Dec 8, 2024
34d8cbb
deal with structured models
yallup Dec 8, 2024
a488910
use proper tree operations in slicing
yallup Dec 9, 2024
c6d34b4
fix stepping with proper tree adds
yallup Dec 9, 2024
3fd74e5
add proposal shaping
yallup Dec 10, 2024
8f3b50f
update tree maps to work properly with dictionary state spaces
yallup Dec 11, 2024
aefef79
constrained random walk
yallup Jan 5, 2025
fb9a648
fix case of weights from merged runs (and potential edge cases even w…
yallup Jan 14, 2025
4739d21
fix case of weights from merged runs (and potential edge cases even w…
yallup Jan 14, 2025
478f3b0
ess estimator for utils
yallup Jan 16, 2025
17070c9
fix ess
yallup Jan 26, 2025
ef766e1
use better log1mexp
yallup Jan 28, 2025
3735b09
Removed distrax
williamjameshandley Feb 28, 2025
3897613
Refactor NSS sampling to support configurable proposals and stepping
williamjameshandley Feb 28, 2025
ac7b95a
Refactor step function API and update horizontal slice proposal logic
williamjameshandley Mar 1, 2025
1464c58
Minor correction to evaluation
williamjameshandley Mar 2, 2025
9f5e522
Thursday refactor attempt
williamjameshandley Apr 3, 2025
6d22e3f
Now runs, but gets wrong answer
williamjameshandley Apr 3, 2025
8ce05c0
Moved hr_slice into mcmc
williamjameshandley Apr 3, 2025
bda35d0
Mid-refactor
williamjameshandley Apr 17, 2025
8da122f
Refactored the hr_slice out of nested sampling
williamjameshandley Apr 17, 2025
15e5d40
Refactored out nss from adaptive
williamjameshandley May 8, 2025
6d4e06c
refactored the constraint out of hr_slice
williamjameshandley May 8, 2025
81e75ff
Re-named mcmc_step_fn to mcmc_build_kernel
williamjameshandley May 8, 2025
35d49a4
Added a top level api for hr_slice
williamjameshandley May 8, 2025
ee24c78
Refactored hr_slice into generic slice sampling, with hrss as the def…
williamjameshandley May 8, 2025
e66d78b
Minor updates to names
williamjameshandley May 8, 2025
58efb66
Other minor tidy-ups
williamjameshandley May 8, 2025
892a66d
Debugged and now working for dictionary-based parameters
williamjameshandley May 9, 2025
af8fcd5
Removed ravel_fn
williamjameshandley May 10, 2025
25de7c8
Further refactoring into ss
williamjameshandley May 10, 2025
5498493
isort
williamjameshandley May 10, 2025
3d9a8cb
black
williamjameshandley May 10, 2025
5063c5e
Added prior to state
williamjameshandley May 10, 2025
492ff81
Minor adjustment to step_fn
williamjameshandley May 12, 2025
399a7c6
Further compression
williamjameshandley May 12, 2025
a018edf
logL -> loglikelihood
williamjameshandley May 12, 2025
9bbb615
0 -> _0
williamjameshandley May 12, 2025
796907f
alter nlive logic to match new style
yallup May 12, 2025
0d14ad6
Corrected utils for logL_birth nans
williamjameshandley May 12, 2025
4816813
Merge branch 'refactor_kernel' of github.com:handley-lab/blackjax int…
williamjameshandley May 12, 2025
f5124a0
Removed loglikelihood_star, which does nothing
williamjameshandley May 12, 2025
c6949f4
ss documented and updated
williamjameshandley May 13, 2025
cc731dd
AI documentation
williamjameshandley May 13, 2025
ec2d14a
docstring update
williamjameshandley May 13, 2025
a40fd5e
Removed notes
williamjameshandley May 13, 2025
1aaffee
working on delete function
yallup May 13, 2025
37ebb4c
merge resolve
yallup May 13, 2025
ecea8af
add new delete function to lib
yallup May 13, 2025
2cc8140
fix birth index update
yallup May 13, 2025
8f6c44d
add temp demo script
yallup May 13, 2025
c29e0aa
revert change to birth contour
yallup May 14, 2025
f0b6117
revert change to birth contour
yallup May 14, 2025
a2bec07
removed as_top_level_api
williamjameshandley May 14, 2025
f76e673
Merge branch 'refactor_kernel' into delete_fn
williamjameshandley May 14, 2025
9474507
Removed black/isort for now (will run later) and made ordering of par…
williamjameshandley May 14, 2025
da8f838
num_delete
williamjameshandley May 14, 2025
5a0176f
Debugged
williamjameshandley May 14, 2025
43d0222
moved repeating system outside into nss
williamjameshandley May 14, 2025
ef1d31c
Removed redundant parameter_update_fn
williamjameshandley May 14, 2025
4abdeac
Merge pull request #11 from handley-lab/delete_fn
williamjameshandley May 14, 2025
9bda56f
Moved logdensity back down to core nested sampling
williamjameshandley May 14, 2025
b29ff93
removing mcmc
williamjameshandley May 14, 2025
b87b2a2
Got rid of mcmc references
williamjameshandley May 14, 2025
f4824f1
Array trees etc
williamjameshandley May 14, 2025
118b443
Updated test script
williamjameshandley May 15, 2025
469b2e3
d=20 -> d=5 in example for consistency with other tests
williamjameshandley May 15, 2025
5e3b26a
run ty
yallup May 15, 2025
f288edc
merge
yallup May 15, 2025
d617fd1
trigger precommit
yallup May 15, 2025
b157f01
Post black cleanup
williamjameshandley May 15, 2025
ebc4de3
Pushed the constrained_fn further down
williamjameshandley May 15, 2025
86e81b6
Refactored so init_fn is defined outside
williamjameshandley May 15, 2025
6059990
Built a cute repeated_kernel function
williamjameshandley May 15, 2025
edc58fc
build_inner_kernel -> inner_kernel
williamjameshandley May 15, 2025
2b2b373
AI docstrings
williamjameshandley May 15, 2025
a445b83
Corrected AI errors
williamjameshandley May 15, 2025
e5244a9
Corrections to ai docstrings
williamjameshandley May 15, 2025
2309823
Revert "Corrections to ai docstrings"
yallup May 16, 2025
164512d
Revert "Corrected AI errors"
yallup May 16, 2025
aa94a7c
Revert "AI docstrings"
yallup May 16, 2025
0a57d13
roll back type changes
yallup May 16, 2025
29407ed
whitespace
yallup May 16, 2025
6d216b8
Removed StateWithParameterOverride
williamjameshandley May 16, 2025
6cec63c
Merge branch 'refactor_kernel' of github.com:handley-lab/blackjax int…
williamjameshandley May 16, 2025
029a3b2
Further simplifications
williamjameshandley May 16, 2025
1ce4c93
made a nss.build_kernel function for consistency
williamjameshandley May 17, 2025
12dbf34
Updated to have adaptive ns state
williamjameshandley May 17, 2025
438d882
removed inner_kernel_params from base
williamjameshandley May 18, 2025
18c7522
NSState -> AdaptiveNSState in nss docstrings
williamjameshandley May 19, 2025
f1920fa
Updated ns
williamjameshandley May 20, 2025
0900bba
typing
yallup May 20, 2025
196ac31
remove redundant forward props
yallup May 20, 2025
aa40e3b
Updated the utils function to include a help
williamjameshandley May 20, 2025
2391e84
refactored slice sampling to be better suited to gradient work
williamjameshandley May 22, 2025
5e0ad9d
Improved dictionary handling
williamjameshandley May 23, 2025
20846d2
Got it compiling in one step
williamjameshandley May 23, 2025
f9e5ced
moved logdensity function further in
williamjameshandley May 23, 2025
3a82f32
black
williamjameshandley May 23, 2025
e78b419
Improved the run-time calculations of log-evidence
williamjameshandley May 24, 2025
bd3d5ce
feat(mcmc.ss, ns): Introduce generic constraint handling in Slice Sam…
williamjameshandley May 26, 2025
c52ed60
black
williamjameshandley May 26, 2025
2868897
Code suggestions
williamjameshandley May 26, 2025
00ee71c
Plurals changed
williamjameshandley May 26, 2025
1b54ccc
feat(tests): Add comprehensive test suite for nested sampling and sli…
williamjameshandley May 26, 2025
c260a74
fix(tests): Correct incorrect nested sampling test assumptions
williamjameshandley May 26, 2025
a3240a1
fix: Resolve pre-commit issues in nested sampling and slice sampling
williamjameshandley May 27, 2025
227c3b3
feat(tests): Add rigorous statistical evidence validation for nested …
williamjameshandley May 27, 2025
7f23b8c
Removed NSSInnerState
williamjameshandley May 28, 2025
97c5527
Updated to NSInnerState
williamjameshandley May 28, 2025
a9d0f16
Refactor: Streamline SliceState and NS inner kernel initialization
williamjameshandley May 28, 2025
b4d71e7
refactor: Modernize nested sampling state management and naming
williamjameshandley May 28, 2025
ec20549
refactor: Remove unnecessary type ignore comments from NS and slice s…
williamjameshandley May 28, 2025
5263e54
fix: Correct vmap axes for nested sampling inner kernel
williamjameshandley May 28, 2025
3f7c0ed
adjust docstrings for partitioned state
yallup May 28, 2025
25d397e
Merge pull request #13 from handley-lab/chain
yallup May 28, 2025
41daed7
Merge pull request #9 from handley-lab/refactor_kernel
yallup May 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions blackjax/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@
from .mcmc import nuts as _nuts
from .mcmc import periodic_orbital, random_walk
from .mcmc import rmhmc as _rmhmc
from .mcmc import ss
from .mcmc.random_walk import additive_step_random_walk as _additive_step_random_walk
from .mcmc.random_walk import (
irmh_as_top_level_api,
normal_random_walk,
rmh_as_top_level_api,
)
from .ns import nss as _nss
from .optimizers import dual_averaging, lbfgs
from .sgmcmc import csgld as _csgld
from .sgmcmc import sghmc as _sghmc
Expand Down Expand Up @@ -109,6 +111,8 @@ def generate_top_level_api_from(module):

additive_step_random_walk.register_factory("normal_random_walk", normal_random_walk)

hrss = GenerateSamplingAPI(ss.hrss_as_top_level_api, ss.init, ss.build_kernel)

mclmc = generate_top_level_api_from(_mclmc)
elliptical_slice = generate_top_level_api_from(_elliptical_slice)
ghmc = generate_top_level_api_from(_ghmc)
Expand All @@ -122,6 +126,8 @@ def generate_top_level_api_from(module):
inner_kernel_tuning = generate_top_level_api_from(_inner_kernel_tuning)
partial_posteriors_smc = generate_top_level_api_from(_partial_posteriors_smc)

nss = generate_top_level_api_from(_nss)

smc_family = [tempered_smc, adaptive_tempered_smc, partial_posteriors_smc]
"Step_fn returning state has a .particles attribute"

Expand Down
Loading