Conversation
- Refactor random key handling to use fold_in instead of key threading - More idiomatic JAX pattern for indexed loops - Removes key from loop state for cleaner code - Deterministic randomness based on time step - Fix missing n_agents variable in _simulate_cross_section_compiled - Extract from initial_wage_indices using len() - Standardize separation rate across lectures - Set α = 0.05 in mccall_fitted_vfi to match mccall_model_with_sep_markov - All economic parameters now consistent between lectures 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Work SummaryThis PR modernizes the JAX code in two McCall job search lectures by improving random key handling patterns and ensuring parameter consistency. Key Improvements1. More Efficient Random Key Handling
2. Bug Fixes
3. Parameter Standardization
TestingBoth lectures verified by:
All economic parameters now consistent between lectures, improving the learning experience for students working through the sequence. |
|
@HumphreyYang can you please run your eyes over these lectures quickly, and this PR? If you're happy please flag it for @mmcky so he can merge it. |
|
Roger that @jstac, once it builds I will look into them! |
|
📖 Netlify Preview Ready! Preview URL: https://pr-715--sunny-cactus-210e3e.netlify.app (72ae11f) 📚 Changed Lecture Pages: mccall_fitted_vfi, mccall_model_with_sep_markov |
|
Hi @mmcky, I think this is ready to merge once it is built! |
|
📖 Netlify Preview Ready! Preview URL: https://pr-715--sunny-cactus-210e3e.netlify.app (f1ad9ff) 📚 Changed Lecture Pages: mccall_fitted_vfi, mccall_model_with_sep_markov |
|
thanks @HumphreyYang and @jstac. Merged and will make live. |
Summary
jax.random.fold_ininstead of threading keys through loop staten_agentswas undefined in_simulate_cross_section_compiledChanges
Key Handling Improvements
Both
mccall_model_with_sep_markov.mdandmccall_fitted_vfi.mdnow use the more idiomatic JAX pattern:splitthensplitagain) withfold_intBefore:
After:
Bug Fixes
NameErrorinmccall_model_with_sep_markov.mdwheren_agentswas undefinedn_agents = len(initial_wage_indices)to extract from input arraysParameter Consistency
mccall_fitted_vfi.mdfrom α = 0.1 to α = 0.05Testing
Both lectures tested with
jupytext --to pyand run successfully without errors.🤖 Generated with Claude Code