Commit 19a1fbb
Improve integration with external samplers (#2203)
* init
* improvements
* update flowmc
* improvements
* type hints
* feedback 1
* missing fix
* cleanup
* docs
* rerun nb
* simplify
* rerun nb
* Address review: remove get_log_density_fn, inline via initialize_model
Per fehiepsi's review on PR #2203, drop the get_log_density_fn helper, its
LogDensityInfo return type, and the PositionDict alias; build the log
density inline by negating model_info.potential_fn (initialize_model
already returns a single-position potential_fn/postprocess_fn).
- numpyro/infer/util.py: remove get_log_density_fn + LogDensityInfo; narrow
w.message to Warning in find_valid_initial_params so util.py type-checks
under ty (newly added to [tool.ty.src]).
- numpyro/_typing.py, numpyro/infer/__init__.py, docs/source/utilities.rst:
drop the removed symbols.
- notebooks/source/other_samplers.ipynb: inline the pattern and re-execute.
- test/infer/test_external_helpers.py: inline the pattern; keep constrain_fn
and end-to-end MCMCKernel coverage.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* rerun nb
* docs: clarify log-density wording in notebook
Reword the markdown lead-in to the Pathfinder log-density cell to say we
build the log-density function by negating the potential energy, avoiding
the awkward doubled 'negated' phrasing.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* prune
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent 36dddd2 commit 19a1fbb
5 files changed
Lines changed: 2153 additions & 1217 deletions
File tree
- notebooks/source
- numpyro/infer
- test/infer
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
31 | 35 | | |
32 | 36 | | |
33 | 37 | | |
| |||
41 | 45 | | |
42 | 46 | | |
43 | 47 | | |
| 48 | + | |
44 | 49 | | |
45 | 50 | | |
46 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
194 | | - | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
195 | 202 | | |
196 | 203 | | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
202 | 219 | | |
203 | 220 | | |
204 | 221 | | |
205 | 222 | | |
206 | 223 | | |
207 | | - | |
| 224 | + | |
208 | 225 | | |
209 | 226 | | |
| 227 | + | |
| 228 | + | |
210 | 229 | | |
211 | 230 | | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
212 | 235 | | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
224 | 248 | | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
232 | 262 | | |
233 | 263 | | |
234 | 264 | | |
| |||
779 | 809 | | |
780 | 810 | | |
781 | 811 | | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
782 | 816 | | |
783 | 817 | | |
784 | 818 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
| 237 | + | |
237 | 238 | | |
238 | 239 | | |
239 | 240 | | |
| |||
0 commit comments