Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
gh-77188: Name-mangled private methods don't roundtrip when pickling#21480
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 ourterms of service andprivacy 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?
gh-77188: Name-mangled private methods don't roundtrip when pickling#21480
Conversation
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.
Makes sense, please fix the conflict for merge
@ZackerySpytz Are you gonna continue this task?@nanjekyejoannah You can see the editedPR for this issue. |
Yes, I will update this PR. |
In general, LGTM. But how much it affects the performance? Could you please run some microbenchmarks to measure the changes in the pickling time for non-private methods? If the difference is insignificant, it is good, but if it is large, it could be worth to optimize the code for non-private methods. |
…kling- Attempting to make use of multiprocessing.Pool while providing, e.g., Minimizer.least_squares a function for calculating the Jacobian did not work prior to the renaming of the method due to an issue related to pickling and unpickling of private methods. See the (currently) open issue (python/cpython#77188) and pull request (python/cpython#21480) for more information.
* Updated the Minimizer.least_squares method to wrap the Jacobian function- The Jacobian function provided by the user is now handled similarly to how it is handled in, e.g., Minimizer.leastsq.- If the Jacobian function is called 'Dfun' in the keyword arguments, then it is also accepted (Minimizer.scalar_minimize already does this).* Updated the Minimizer.__jacobian method signature to fix exception- The signature now matches the signature of Minimizer.__residual. This was changed because the following exception was being raised whenever the user provided a function for calculating the Jacobian: "TypeError: Minimizer.__jacobian() got an unexpected keyword argument 'apply_bounds_transformation'".* Updated the Minimizer.__jacobian method to use the new parameter- The updating of the parameter values is now similar to how it is done in Minimizer.__residual.* Updated test_least_squares_jacobian_types to handle the wrapped Jacobian function- The params argument of the jac_array function is now an actual Parameters object like it is in the f function, which means that the parameters can be accessed via string keys.* Updated the coerce_float64 function- Added explicit support for sparse matrices (e.g., Block Sparse Row) and LinearOperator objects. This change is needed because the updated test_least_squares_jacobian_types would otherwise fail. Similar to how these types are handled when calculating the Hessian matrix in Minimizer.least_squares.* Renamed the Minimizer.__jacobian method to avoid a bug related to pickling- Attempting to make use of multiprocessing.Pool while providing, e.g., Minimizer.least_squares a function for calculating the Jacobian did not work prior to the renaming of the method due to an issue related to pickling and unpickling of private methods. See the (currently) open issue (python/cpython#77188) and pull request (python/cpython#21480) for more information.* Added a test for when the "least_squares" method is provided a function for the Jacobian- Verifies that a) the fitted parameters have the expected values, b) the jac function is actually called, and c) that there are indeed fewer function evaluations as a result.* Updated the docstring of Minimizer._jacobian- The docstring is updated to include the parameters and return values.* Added tests for (un)pickling Minimizer when a Jacobian function is provided* Updated timeout value in test_jacobian_with_forkingpickler- Increased the timeout value so that slow runners can actually succeed instead of timing out. If no timeout was specified, then a failing test could end up hanging instead.* Added an example that demonstrates the benefits of providing a Jacobian function* Updated the list of contributors
Uh oh!
There was an error while loading.Please reload this page.
https://bugs.python.org/issue33007
#77188