Skip to content

WIP: bugfixes for GST with penalties in objective functions #528

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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rileyjmurray
Copy link
Contributor

@coreyostrove reported bugs in fitting GST models where the objective function contains penalty terms. Quoting from an email:

The functionality in question is the ability to add in modifications to the objective functions in the form of a penalty function. The one relevant to this discussion which we were trying to test out for gauge regularization purposes is an existing one set using the 'errorgen_penalty_factor' option. This dies somewhere in customsolve, as I recall. For the sake of testing whether the issue was isolated to this particular penalty function we also tried the built-in 'cptp_penalty_factor' and 'spam_penalty_factor' which also both failed (though in different ways for each option).

Running a notebook that Corey sent me, I got the following error. The stacktrace isn't shown, but the error indeed happens when adding penalty terms to the Jacobian, inside simplerlm.py::simplish_leastsq and/or customlm.py::custom_lstsq.
image

I was able to correct the error above by adding input handling to vec_to_stdmx, casting non-numpy objects to ndarrays. (Currently the only change in this PR.) Of course, we really need to find the functions that are calling vec_to_stdmx with this invalid input. The full extent of such functions is unknown (to me) at time of opening this PR. It at least includes objectivefns.py::_spam_penalty_jac_fill.

Opening this PR at @coreyostrove's request. CC: @pcwysoc.

@rileyjmurray
Copy link
Contributor Author

@pcwysoc you sent an email asking where the penalty fix(es) are. Here's the WIP PR!

@sserita sserita added this to the 0.9.15 milestone Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants