Skip to content

Commit 258fa88

Browse files
authored
Merge pull request #1191 from rhayes777/feature/search-remove-ultranest-pyswarms
Remove UltraNest and PySwarms, clean up search tests
2 parents 655b629 + cc9fd6d commit 258fa88

33 files changed

Lines changed: 136 additions & 1216 deletions

File tree

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ NUMBA_CACHE_DIR=/tmp/numba_cache MPLCONFIGDIR=/tmp/matplotlib python -m pytest t
2424

2525
## Key Architecture
2626

27-
- **Non-linear searches** (`non_linear/search/`): MCMC (emcee), nested sampling (dynesty, nautilus), MLE (LBFGS, pyswarms)
27+
- **Non-linear searches** (`non_linear/search/`): MCMC (emcee), nested sampling (dynesty, nautilus), MLE (LBFGS, BFGS, drawer)
2828
- **Model composition** (`mapper/`): `af.Model`, `af.Collection`, prior distributions
2929
- **Analysis** (`non_linear/analysis/`): base `af.Analysis` class with `log_likelihood_function`
3030
- **Aggregator** (`aggregator/`): results aggregation across runs

CLAUDE.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ Shared utilities (e.g. `test_mode`, `jax_wrapper`) belong in autoconf.
1818
- `autofit/` - Main package
1919
- `non_linear/` - Non-linear search algorithms
2020
- `search/mcmc/` - MCMC (emcee, zeus)
21-
- `search/mle/` - Maximum likelihood (LBFGS, pyswarms)
22-
- `search/nest/` - Nested sampling (dynesty, nautilus, ultranest)
21+
- `search/mle/` - Maximum likelihood (LBFGS, BFGS, drawer)
22+
- `search/nest/` - Nested sampling (dynesty, nautilus)
2323
- `samples/` - Posterior samples handling
2424
- `paths/` - Output path management
2525
- `analysis/` - Analysis base classes
@@ -39,11 +39,10 @@ Shared utilities (e.g. `test_mode`, `jax_wrapper`) belong in autoconf.
3939

4040
- `dynesty==2.1.4` - Nested sampling
4141
- `emcee>=3.1.6` - MCMC
42-
- `pyswarms==1.3.0` - Particle swarm optimisation
4342
- `scipy<=1.14.0` - Optimisation
4443
- `SQLAlchemy==2.0.32` - Database backend
4544
- `anesthetic==2.8.14` - Posterior analysis/plotting
46-
- Optional: `nautilus-sampler`, `ultranest`, `zeus-mcmc`, `getdist`
45+
- Optional: `nautilus-sampler`, `zeus-mcmc`, `getdist`
4746

4847
## Running Tests
4948

autofit/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,9 @@
8282
from .non_linear.search.nest.nautilus.search import Nautilus
8383
from .non_linear.search.nest.dynesty.search.dynamic import DynestyDynamic
8484
from .non_linear.search.nest.dynesty.search.static import DynestyStatic
85-
from .non_linear.search.nest.ultranest.search import UltraNest
8685
from .non_linear.search.mle.drawer.search import Drawer
8786
from .non_linear.search.mle.bfgs.search import BFGS
8887
from .non_linear.search.mle.bfgs.search import LBFGS
89-
from .non_linear.search.mle.pyswarms.search.globe import PySwarmsGlobal
90-
from .non_linear.search.mle.pyswarms.search.local import PySwarmsLocal
9188
from .non_linear.paths.abstract import AbstractPaths
9289
from .non_linear.paths import DirectoryPaths
9390
from .non_linear.paths import DatabasePaths

autofit/config/non_linear/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ Files
66

77
- ``mcmc.yaml``: Settings default behaviour of MCMC non-linear searches (e.g. Emcee).
88
- ``nest.yaml``: Settings default behaviour of nested sampler non-linear searches (e.g. Dynesty).
9-
- ``mle.yaml``: Settings default behaviour of maximum likelihood estimator (mle) searches (e.g. PySwarms).
9+
- ``mle.yaml``: Settings default behaviour of maximum likelihood estimator (mle) searches (e.g. BFGS).

autofit/config/non_linear/mle.yaml

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,9 @@
22

33
# **PyAutoFit** supports the following maximum likelihood estimator (MLE) algorithms:
44

5-
# - PySwarms: https://github.com/ljvmiranda921/pyswarms / https://pyswarms.readthedocs.io/en/latest/index.html
6-
7-
# Settings in the [search], [run] and [options] entries are specific to each nested algorithm and should be
5+
# Settings in the [search], [run] and [options] entries are specific to each algorithm and should be
86
# determined by consulting that method's own readthedocs.
97

10-
PySwarmsGlobal:
11-
run:
12-
iters: 2000
13-
search:
14-
cognitive: 0.5
15-
ftol: -.inf
16-
inertia: 0.9
17-
n_particles: 50
18-
social: 0.3
19-
initialize: # The method used to generate where walkers are initialized in parameter space {prior | ball}.
20-
method: ball # priors: samples are initialized by randomly drawing from each parameter's prior. ball: samples are initialized by randomly drawing unit values from a narrow uniform distribution.
21-
ball_lower_limit: 0.49 # The lower limit of the uniform distribution unit values are drawn from when initializing walkers using the ball method.
22-
ball_upper_limit: 0.51 # The upper limit of the uniform distribution unit values are drawn from when initializing walkers using the ball method.
23-
parallel:
24-
number_of_cores: 1 # The number of cores the search is parallelized over by default, using Python multiprocessing.
25-
printing:
26-
silence: false # If True, the default print output of the non-linear search is silcened and not printed by the Python interpreter.
27-
iterations_per_full_update: 500 # Non-linear search iterations between every full update, which outputs all visuals and result fits (e.g. model.result, search.summary), this exits the search and can be slow.
28-
iterations_per_quick_update: 500 # Non-linear search iterations between every quick update, which just displays the maximum likelihood model fit.
29-
remove_state_files_at_end: true # Whether to remove the savestate of the seach (e.g. the Emcee hdf5 file) at the end to save hard-disk space (results are still stored as PyAutoFit pickles and loadable).
30-
PySwarmsLocal:
31-
run:
32-
iters: 2000
33-
search:
34-
cognitive: 0.5
35-
ftol: -.inf
36-
inertia: 0.9
37-
minkowski_p_norm: 2
38-
n_particles: 50
39-
number_of_k_neighbors: 3
40-
social: 0.3
41-
initialize: # The method used to generate where walkers are initialized in parameter space {prior | ball}.
42-
method: ball # priors: samples are initialized by randomly drawing from each parameter's prior. ball: samples are initialized by randomly drawing unit values from a narrow uniform distribution.
43-
ball_lower_limit: 0.49 # The lower limit of the uniform distribution unit values are drawn from when initializing walkers using the ball method.
44-
ball_upper_limit: 0.51 # The upper limit of the uniform distribution unit values are drawn from when initializing walkers using the ball method.
45-
parallel:
46-
number_of_cores: 1 # The number of cores the search is parallelized over by default, using Python multiprocessing.
47-
printing:
48-
silence: false # If True, the default print output of the non-linear search is silcened and not printed by the Python interpreter.
49-
iterations_per_full_update: 500 # Non-linear search iterations between every full update, which outputs all visuals and result fits (e.g. model.result, search.summary), this exits the search and can be slow.
50-
iterations_per_quick_update: 500 # Non-linear search iterations between every quick update, which just displays the maximum likelihood model fit.
51-
remove_state_files_at_end: true # Whether to remove the savestate of the seach (e.g. the Emcee hdf5 file) at the end to save hard-disk space (results are still stored as PyAutoFit pickles and loadable).
528
BFGS:
539
search:
5410
tol: null

autofit/config/non_linear/nest.yaml

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
# - Dynesty: https://github.com/joshspeagle/dynesty / https://dynesty.readthedocs.io/en/latest/index.html
44
# - Nautilus https://https://github.com/johannesulf/nautilus / https://nautilus-sampler.readthedocs.io/en/stable/index.html
5-
# - UltraNest: https://github.com/JohannesBuchner/UltraNest / https://johannesbuchner.github.io/UltraNest/readme.html
65

76
# Settings in the [search] and [run] entries are specific to each nested algorithm and should be determined by
87
# consulting that MCMC method's own readthedocs.
@@ -87,47 +86,3 @@ Nautilus:
8786
force_x1_cpu: false # Force Dynesty to not use Python multiprocessing Pool, which can fix issues on certain operating systems.
8887
printing:
8988
silence: false # If True, the default print output of the non-linear search is silenced and not printed by the Python interpreter.
90-
UltraNest:
91-
search:
92-
draw_multiple: true
93-
ndraw_max: 65536
94-
ndraw_min: 128
95-
num_bootstraps: 30
96-
num_test_samples: 2
97-
resume: true
98-
run_num: null
99-
storage_backend: hdf5
100-
vectorized: false
101-
warmstart_max_tau: -1.0
102-
run:
103-
cluster_num_live_points: 40
104-
dkl: 0.5
105-
dlogz: 0.5
106-
frac_remain: 0.01
107-
insertion_test_window: 10
108-
insertion_test_zscore_threshold: 2
109-
lepsilon: 0.001
110-
log_interval: null
111-
max_iters: null
112-
max_ncalls: null
113-
max_num_improvement_loops: -1.0
114-
min_ess: 400
115-
min_num_live_points: 400
116-
show_status: true
117-
update_interval_ncall: null
118-
update_interval_volume_fraction: 0.8
119-
viz_callback: auto
120-
stepsampler:
121-
adaptive_nsteps: false
122-
log: false
123-
max_nsteps: 1000
124-
nsteps: 25
125-
region_filter: false
126-
scale: 1.0
127-
stepsampler_cls: null
128-
initialize: # The method used to generate where walkers are initialized in parameter space {prior}.
129-
method: prior # priors: samples are initialized by randomly drawing from each parameter's prior.
130-
parallel:
131-
number_of_cores: 1 # The number of cores the search is parallelized over by default, using Python multiprocessing.
132-
printing:
133-
silence: false # If True, the default print output of the non-linear search is silenced and not printed by the Python interpreter.

autofit/non_linear/samples/samples.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def __init__(
3939
individual sample by the `NonLinearSearch` and return information on the likelihoods, errors, etc.
4040
4141
This class stores samples of searches which provide maximum likelihood estimates of the model-fit (e.g.
42-
PySwarms, LBFGS).
42+
LBFGS).
4343
4444
Parameters
4545
----------

autofit/non_linear/search/mle/pyswarms/__init__.py

Whitespace-only changes.

autofit/non_linear/search/mle/pyswarms/search/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)