-
-
Notifications
You must be signed in to change notification settings - Fork 53
[mccall_model] JAX conversion of the Job Search Model I #619
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
base: main
Are you sure you want to change the base?
Conversation
Many thanks @longye-tian! I thought @shlff self-assigned this lecture in the issue here: QuantEcon/meta#173. Just CCing @shlff here so we are not working on the same lecture separately : ) |
Thank you for your notice @HumphreyYang . So Sorry @shlff . I forgot to check this list... |
📖 Netlify Preview Ready! Preview URL: https://pr-619--sunny-cactus-210e3e.netlify.app (e860f3d) 📚 Changed Lecture Pages: back_prop, bayes_nonconj, divergence_measures, imp_sample, likelihood_ratio_process, likelihood_ratio_process_2, likelihood_var, mccall_model, mle, newton_method, qr_decomp |
📖 Netlify Preview Ready! Preview URL: https://pr-619--sunny-cactus-210e3e.netlify.app (6f9619b) 📚 Changed Lecture Pages: mccall_model |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many thanks @longye-tian! Nice changes!!
Just some minor suggestions in the review.
Three minor general suggestions:
- There are some comments like this in the code:
# == Now compute the reservation wage == #
It would be nice to convert them to more standard comments like
# Now compute the reservation wage
- We used
jax.random
many times. It might be a good idea to give it an alias in the import:
import jax.random as jr
and then use
jr.method_name()
- There are a few more lines that are longer than the box in the preview. It would be nice if you could follow the pattern in the review comment and cut them to fewer than 80 characters so they fit into the code cell in the preview nicely!
Co-authored-by: Humphrey Yang <[email protected]>
Co-authored-by: Humphrey Yang <[email protected]>
Co-authored-by: Humphrey Yang <[email protected]>
Co-authored-by: Humphrey Yang <[email protected]>
Co-authored-by: Humphrey Yang <[email protected]>
Co-authored-by: Humphrey Yang <[email protected]>
Hi @HumphreyYang , Thank you for your detailed review. I've updated the lecture accordingly. Best, |
📖 Netlify Preview Ready! Preview URL: https://pr-619--sunny-cactus-210e3e.netlify.app (a1c0a5e) 📚 Changed Lecture Pages: mccall_model |
📖 Netlify Preview Ready! Preview URL: https://pr-619--sunny-cactus-210e3e.netlify.app (94d2339) 📚 Changed Lecture Pages: mccall_model |
📖 Netlify Preview Ready! Preview URL: https://pr-619--sunny-cactus-210e3e.netlify.app (01c5e80) 📚 Changed Lecture Pages: mccall_model |
📖 Netlify Preview Ready! Preview URL: https://pr-619--sunny-cactus-210e3e.netlify.app (3711f5b) 📚 Changed Lecture Pages: mccall_model |
📖 Netlify Preview Ready! Preview URL: https://pr-619--sunny-cactus-210e3e.netlify.app (1a748dc) 📚 Changed Lecture Pages: mccall_model |
📖 Netlify Preview Ready! Preview URL: https://pr-619--sunny-cactus-210e3e.netlify.app (f66be67) 📚 Changed Lecture Pages: mccall_model |
📖 Netlify Preview Ready! Preview URL: https://pr-619--sunny-cactus-210e3e.netlify.app (db5a05f) 📚 Changed Lecture Pages: mccall_model |
📖 Netlify Preview Ready! Preview URL: https://pr-619--sunny-cactus-210e3e.netlify.app (75dc290) 📚 Changed Lecture Pages: mccall_model |
I've updated the Job Search Model I, align with the change we've had before on Job Search Model II and III.
Overview
Converted
lectures/mccall_model.md
from NumPy/Numba to JAX implementation, following the patterns established inmccall_model_with_separation.md
andmccall_fitted_vfi.md
.Key Changes
1. Library Updates
numpy
→jax.numpy
(jnp)numba.jit
→jax.jit
numba.experimental.jitclass
jax
,jax.numpy
,typing.NamedTuple
2. Data Structure Changes
@jitclass
for the McCall model classNamedTuple
for immutable model structure, compatible with JAX's functional paradigm3. Array Operations
.at[].set()
)4. Loop Transformations
jax.lax.while_loop
with condition and body functions5. Random Number Generation
np.random.seed()
)jax.random.PRNGKey
)6. Vectorization
jax.vmap
for automatic vectorization