-
-
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 |
HumphreyYang
left a comment
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.randommany times. It might be a good idea to give it an alias in the import:
import jax.random as jrand 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 <39026988+HumphreyYang@users.noreply.github.com>
Co-authored-by: Humphrey Yang <39026988+HumphreyYang@users.noreply.github.com>
Co-authored-by: Humphrey Yang <39026988+HumphreyYang@users.noreply.github.com>
Co-authored-by: Humphrey Yang <39026988+HumphreyYang@users.noreply.github.com>
Co-authored-by: Humphrey Yang <39026988+HumphreyYang@users.noreply.github.com>
Co-authored-by: Humphrey Yang <39026988+HumphreyYang@users.noreply.github.com>
|
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 |
|
📖 Netlify Preview Ready! Preview URL: https://pr-619--sunny-cactus-210e3e.netlify.app (d9cae86) 📚 Changed Lecture Pages: mccall_model |
|
Hi @mmcky , I've updated the lecture and revised according to very good suggestions from @HumphreyYang and @shlff . What do you think? Best, |
|
@mmcky FYI, I'm getting a 404 on the netlify link above. I'll probably push some changes now, which might generate a fresh link that works. @longye-tian @HumphreyYang Actually I disagree with I'll revert the change now and review the lecture. |
|
📖 Netlify Preview Ready! Preview URL: https://pr-619--sunny-cactus-210e3e.netlify.app (e75d48a) 📚 Changed Lecture Pages: mccall_model |
Many thanks @jstac, I think there is an entry in the style guide that suggests us to use I have opened a PR on this in the style sheet: |
All links working again after my last push. Do they go stale after a while?
Ah, thanks for letting me know @HumphreyYang I have opened a PR on this in the style sheet: Nice work. |
|
Please hold off on any edits to this PR. |
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.mdfrom NumPy/Numba to JAX implementation, following the patterns established inmccall_model_with_separation.mdandmccall_fitted_vfi.md.Key Changes
1. Library Updates
numpy→jax.numpy(jnp)numba.jit→jax.jitnumba.experimental.jitclassjax,jax.numpy,typing.NamedTuple2. Data Structure Changes
@jitclassfor the McCall model classNamedTuplefor immutable model structure, compatible with JAX's functional paradigm3. Array Operations
.at[].set())4. Loop Transformations
jax.lax.while_loopwith condition and body functions5. Random Number Generation
np.random.seed())jax.random.PRNGKey)6. Vectorization
jax.vmapfor automatic vectorization