Commit 0d564d4
Fix JAX compatibility issues in Job Search III lecture (#687)
* Fix JAX compatibility issues in Job Search III lecture
Updated mccall_model_with_sep_markov.md to fix several JAX-related issues:
- Refactored vfi() to return only v_final instead of tuple, making it more consistent with VFI pattern
- Removed separate successive_approx() function and integrated iteration logic directly into vfi()
- Fixed JAX decorators: changed @jit to @jax.jit and @partial(jit, ...) to @partial(jax.jit, ...)
- Rewrote get_reservation_wage() to use jnp.argmax() instead of jnp.where() to avoid JAX concretization errors in JIT compilation
- Updated all vfi() call sites to explicitly compute policy with get_greedy(v_star, model)
- Removed @jit decorators from T() and get_greedy() functions (not needed)
Also improved wording in mccall_model_with_separation.md for clarity.
Tested: Converted to Python and ran successfully without errors.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Standardize continuation value notation in Job Search II lecture
Updated the McCall model with separation to use h = u(c) + β * sum_w v_u(w) q(w)
as the continuation value, matching the notation from the basic McCall model lecture.
This makes the progression between lectures more intuitive for readers:
- Basic model: h = c + β * sum_w v*(w) q(w)
- Separation model: h = u(c) + β * sum_w v_u(w) q(w)
Key changes:
- Replaced scalar d with h throughout mathematical derivations
- Updated closed-form expression for v_e(w) to use h
- Modified iteration algorithm to solve for h instead of d
- Simplified Bellman equations using h notation
- Updated all code functions (compute_v_e, update_h, solve_model)
- Changed plots and comments to reference h
This improves consistency across the job search lecture series and makes
the mathematical structure clearer by explicitly showing the continuation
value includes both current utility and discounted future value.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Remove JAX from pip install in Job Search II lecture
The JAX library is already included in the base environment and doesn't need
to be explicitly installed, which was causing build failures.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Remove JAX from pip install in Job Search III lecture
The JAX library is already included in the base environment and doesn't need
to be explicitly installed, which was causing build failures.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Update PyTorch installation to use cu121
* Update CI workflow to install only PyTorch packages
Removed 'torchaudio' from the installation command for PyTorch.
* fix: JAX version pinning
* install new CUDANN binaries
* remove pytorch
* misc
* Update mccall_model_with_separation: Change utility parameter from sigma to gamma and use glue for figures
Updated the McCall model with separation lecture with the following changes:
Key changes:
- Changed utility function parameter from σ (sigma) to γ (gamma)
- Moved γ default value from utility function to Model class (γ: float = 2.0)
- Updated all functions (compute_v_e, update_h, solve_model) to pass γ parameter
- Simplified model unpacking to use tuple unpacking directly (e.g., α, β, γ, c, w, q = model)
- Replaced static PNG figures with myst-nb glue functionality
- Added glue import and glue() calls in exercise solutions
- Converted {figure} directives to {glue:figure} directives for dynamic figure generation
Benefits:
- More consistent parameter naming (gamma is standard for CRRA utility)
- Better code organization with parameter defaults in Model class
- Cleaner unpacking syntax
- Dynamic figure generation eliminates need for static PNG files
- Figures automatically stay in sync with code
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Remove redundant PNG files for mccall_model_with_separation
Removed static PNG files that are now dynamically generated using myst-nb glue:
- mccall_resw_alpha.png
- mccall_resw_beta.png
- mccall_resw_c.png
These figures are now generated from the exercise solution code and displayed via glue:figure directives, eliminating the need for static files and ensuring figures always match the code.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* misc
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: mmcky <mamckay@gmail.com>1 parent b61b30e commit 0d564d4
File tree
6 files changed
+214
-184
lines changed- .github/workflows
- lectures
- _static/lecture_specific/mccall_model_with_separation
6 files changed
+214
-184
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | | - | |
36 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
Binary file not shown.
Binary file not shown.
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | | - | |
10 | 9 | | |
11 | 10 | | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
| 141 | + | |
178 | 142 | | |
179 | 143 | | |
180 | 144 | | |
181 | 145 | | |
182 | | - | |
183 | 146 | | |
184 | 147 | | |
185 | 148 | | |
| |||
215 | 178 | | |
216 | 179 | | |
217 | 180 | | |
218 | | - | |
219 | 181 | | |
220 | 182 | | |
221 | 183 | | |
| |||
229 | 191 | | |
230 | 192 | | |
231 | 193 | | |
232 | | - | |
233 | 194 | | |
234 | 195 | | |
235 | 196 | | |
| |||
247 | 208 | | |
248 | 209 | | |
249 | 210 | | |
250 | | - | |
251 | | - | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
252 | 218 | | |
253 | | - | |
254 | | - | |
255 | | - | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
256 | 234 | | |
| 235 | + | |
257 | 236 | | |
| 237 | + | |
| 238 | + | |
258 | 239 | | |
259 | 240 | | |
260 | 241 | | |
| |||
268 | 249 | | |
269 | 250 | | |
270 | 251 | | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
276 | 255 | | |
277 | | - | |
278 | | - | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
279 | 259 | | |
280 | 260 | | |
281 | | - | |
282 | 261 | | |
283 | 262 | | |
284 | 263 | | |
285 | 264 | | |
286 | 265 | | |
287 | 266 | | |
288 | 267 | | |
289 | | - | |
| 268 | + | |
| 269 | + | |
290 | 270 | | |
291 | 271 | | |
292 | 272 | | |
| |||
312 | 292 | | |
313 | 293 | | |
314 | 294 | | |
315 | | - | |
316 | 295 | | |
317 | 296 | | |
318 | 297 | | |
319 | 298 | | |
320 | | - | |
321 | 299 | | |
322 | 300 | | |
323 | 301 | | |
324 | 302 | | |
325 | 303 | | |
326 | 304 | | |
327 | | - | |
| 305 | + | |
| 306 | + | |
328 | 307 | | |
329 | 308 | | |
330 | 309 | | |
| |||
356 | 335 | | |
357 | 336 | | |
358 | 337 | | |
359 | | - | |
360 | 338 | | |
361 | | - | |
| 339 | + | |
362 | 340 | | |
363 | 341 | | |
364 | 342 | | |
| |||
439 | 417 | | |
440 | 418 | | |
441 | 419 | | |
442 | | - | |
| 420 | + | |
| 421 | + | |
443 | 422 | | |
444 | 423 | | |
445 | 424 | | |
| |||
486 | 465 | | |
487 | 466 | | |
488 | 467 | | |
489 | | - | |
490 | 468 | | |
491 | 469 | | |
492 | 470 | | |
| |||
531 | 509 | | |
532 | 510 | | |
533 | 511 | | |
534 | | - | |
| 512 | + | |
535 | 513 | | |
536 | 514 | | |
537 | 515 | | |
| |||
568 | 546 | | |
569 | 547 | | |
570 | 548 | | |
571 | | - | |
| 549 | + | |
572 | 550 | | |
573 | 551 | | |
574 | 552 | | |
| |||
627 | 605 | | |
628 | 606 | | |
629 | 607 | | |
630 | | - | |
| 608 | + | |
| 609 | + | |
631 | 610 | | |
632 | 611 | | |
633 | 612 | | |
| |||
655 | 634 | | |
656 | 635 | | |
657 | 636 | | |
658 | | - | |
| 637 | + | |
| 638 | + | |
659 | 639 | | |
660 | 640 | | |
661 | 641 | | |
| |||
681 | 661 | | |
682 | 662 | | |
683 | 663 | | |
684 | | - | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
685 | 670 | | |
686 | 671 | | |
687 | 672 | | |
| |||
697 | 682 | | |
698 | 683 | | |
699 | 684 | | |
| 685 | + | |
| 686 | + | |
700 | 687 | | |
701 | 688 | | |
702 | 689 | | |
703 | 690 | | |
704 | 691 | | |
705 | 692 | | |
706 | | - | |
| 693 | + | |
707 | 694 | | |
708 | | - | |
| 695 | + | |
709 | 696 | | |
710 | 697 | | |
711 | 698 | | |
712 | 699 | | |
713 | 700 | | |
714 | 701 | | |
| 702 | + | |
715 | 703 | | |
716 | 704 | | |
717 | 705 | | |
718 | 706 | | |
719 | 707 | | |
720 | 708 | | |
721 | | - | |
| 709 | + | |
722 | 710 | | |
723 | 711 | | |
724 | 712 | | |
| |||
751 | 739 | | |
752 | 740 | | |
753 | 741 | | |
754 | | - | |
0 commit comments