PSLmodels / tax-microdata-benchmarking

A project to develop a benchmarked general-purpose dataset for tax reform impact analysis.
https://pslmodels.github.io/tax-microdata-benchmarking/
2 stars 6 forks source link

Any value of OPTIMIZE_IPRINT other than 0 shows every iteration, when it should show every OPTIMIZE_IPRINT iteration #222

Closed donboyd5 closed 2 months ago

donboyd5 commented 2 months ago

Currently, any value of OPTIMIZE_IPRINT other than 0 shows every iteration. Instead, it should show every OPTIMIZE_IPRINT iteration (e.g., every 20th iteration when OPTIMIZE_IPRINT=20) for values <99 (and more generally follow the behavior for minimize option iprint).

The solution is to delete line 476 in create_area_weights, "disp": OPTIMIZE_IPRINT != 0,, shown below. I'll prepare a pull request to fix it.

Note that test for https://github.com/PSLmodels/tax-microdata-benchmarking/pull/223 fails, apparently due to a credentials issue. I will try to figure out how to fix that but can't attend to it until I am back from vacation. @martinholmer, if you're ok with the PR perhaps you can do what is needed to merge it, or else wait until I am back. There's certainly no rush on this.

image


For details, see below.

Here's the minimize code:

image

Here is the scipy minimize documentation for disp:

image

disp expects None or int, overriding iprint when disp is int. However, we always give disp a True or False, which apparently always resolves to 1 or 0. Therefore when OPTIMIZE_IPRINT != 0, we are giving disp 1, and it prints every iteration.

Here is the documentation for iprint:

image

The solution is to delete line 476, thereby always keeping disp at the default of None. This keeps the current behavior of printing only one line at the last iteration when OPTIMIZE_IPRINT = 0, and will generally show every OPTIMIZE_IPRINT iterations for larger values < 99.