Skip to content

[back_prop, stats_examples, endogenous_lake, multi_hyper] Fix four small errors - #1124

Open
officialasishkumar wants to merge 2 commits into
QuantEcon:mainfrom
officialasishkumar:fix-1111-back-prop-stats-lake-hyper
Open

officialasishkumar wants to merge 2 commits into
QuantEcon:mainfrom
officialasishkumar:fix-1111-back-prop-stats-lake-hyper

Conversation

@officialasishkumar

Copy link
Copy Markdown

Fixes #1111

Four small fixes from the review in #1111:

  • back_prop: train split key each epoch but drew the permutation from a fixed random.key(1), so the data came in the same order every epoch. It now draws from the fresh subkey.
  • stats_examples: the negative binomial mean and variance now use the parameter r instead of k: $\mathbb{E}(X) = r(1-p)/p$, $\mathbb{V}(X) = r(1-p)/p^2$.
  • endogenous_lake: the text accepts an offer when $w \geq \bar w$, but the code counted w_vec > w_bar, understating the job finding rate by $\gamma,p(\bar w)$. Changed to >= in the three places listed in the issue, and fixed the "paramters" typo in the printed message.
  • multi_hyper: count now takes its loop length from vec1.shape[0] instead of the global sample, which Numba freezes at compile time.

I did not rebuild the lectures locally (no JAX/Numba environment on the machine I used); the changes are one-line edits matching the descriptions in the issue.

…all errors

- back_prop: train() split the key each epoch but drew the permutation
  from a fixed random.key(1), so every epoch saw the data in the same
  order. Draw it from the fresh subkey instead.
- stats_examples: the negative binomial mean and variance used k (the
  value of X) where the parameter r belongs.
- endogenous_lake: the text accepts offers with w >= w_bar, but the code
  counted w > w_bar, which treats the reservation wage itself as
  rejected and understates the job finding rate. Use >= in the job
  finding rate and the employed-value mask, and fix a typo in the
  printed message.
- multi_hyper: count() took its loop length from the global sample
  array, which Numba freezes at compile time. Use vec1.shape[0].

Fixes QuantEcon#1111

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The targeted lecture corrections have no active review issues.

No open issues 🎉

What changed in this PR

Addresses issue #1111 with four targeted corrections to the quantitative economics lectures.

Changes:

  • Uses a fresh random key for each training epoch and derives counting length from the input array.
  • Corrects negative binomial mean and variance formulas.
  • Includes reservation-wage offers in employment calculations and fixes a printed typo.
File Description
lectures/​stats_examples.md Uses parameter r in mean and variance formulas.
lectures/​multi_hyper.md Derives loop length from vec1, not global sample.
lectures/​endogenous_lake.md Includes reservation-wage offers and corrects “parameters.”
lectures/​back_prop.md Uses a fresh subkey to shuffle each epoch.

Review effort: Balanced (adaptive)

@mmcky

mmcky commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

@officialasishkumar thanks for this. All four edits match #1111 and look right; we'll check the rebuilt lectures before merging.

Under our Code of AI Use (QEP-5), please:

  1. Add one line to the description: Assisted-by: <tool> (<model>), or Assisted-by: none.
  2. Reply to confirm that you chose this task, read the changes, and will answer review yourself.

Thanks for saying plainly that you didn't rebuild the lectures. That's exactly what the Code asks for.

@mmcky mmcky added the awaiting-response Waiting on the author or reporter to reply label Dec 3, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-response Waiting on the author or reporter to reply

Projects

None yet

Development

Successfully merging this pull request may close these issues.

back_prop, stats_examples, endogenous_lake, multi_hyper: four small fixes

3 participants