Skip to content

Conversation

slilonfe5
Copy link
Member

@slilonfe5 slilonfe5 commented Mar 24, 2025

Fixes # .

Summary/Motivation:

Currently, the Parmest SSE objective does not support measurements in different units. This work adds new capabilities to Parmest, including weighted SSE to handle measurements in different units, and more robust covariance matrix calculation methods for more accurate uncertainty quantification. This work also enables the calculation of the covariance matrix using a user-supplied measurement error standard deviation.

Changes proposed in this PR:

  • Added a weighted SSE objective
  • Added two covariance matrix calculation methods for both the SSE and weighted SSE objectives
  • Enabled calculation of the covariance matrix using a user-supplied measurement error standard deviation
  • Added a separate function for the covariance matrix estimation

Legal Acknowledgement

By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the BSD license.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

@slilonfe5
Copy link
Member Author

@adowling2 @djlaky

@adowling2
Copy link
Member

@slilonfe5 Here is some quick feedback

compute_jacobian function

  • Make this a private method by adding _ to the function name
  • Add as an argument to the function relative_perturbation
  • In the document string, explain this is using forward (?) finite difference
  • Add as an argument the solver object. You can make the default Ipopt.

Feedback on the compute_FIM method:

  • Add relative_tolerance and solver as arguments
  • Also add a check that error_list must be the same length as y_hat_list
  • Add a debugging step for the linear algebra error, compute the condition number of the Jacobian matrix and print it out
  • Why would you ever get a linear algebra error for just matrix multiplication? Is this check even needed?

@slilonfe5
Copy link
Member Author

slilonfe5 commented Apr 19, 2025

@adowling2 @djlaky I also updated the calculation for the normal SSE such that we can use the user-supplied measurement error if defined; otherwise, we calculate the measurement error as usual.

Copy link
Member

@adowling2 adowling2 left a comment

Choose a reason for hiding this comment

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

Nice progress. I think it is time to start writing tests for the new capabilities.

@adowling2
Copy link
Member

@slilonfe5 Once you have the tests ready, tag us for feedback. Also, I think you can skip adding this to the depreciated class.

Copy link
Member

@adowling2 adowling2 left a comment

Choose a reason for hiding this comment

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

Here is more feedback as you work on getting this ready for the Pyomo team to review.

@slilonfe5
Copy link
Member Author

@adowling2 @djlaky I have created a separate method (cov_est) for computing the covariance matrix, supporting three calculation methods (jacobian, kaug, and reduced_hessian). I implemented these covariance calculation methods for both the SSE and SSE_weighted objectives. Lastly, as you suggested, I did not add the new capability to the deprecated interface.

I tested these with three examples (2 steady state and 1 dynamic), and all work well. I'm yet to write the test file for these.

@slilonfe5
Copy link
Member Author

slilonfe5 commented Aug 27, 2025

@mrmundt I can attempt to solve the testing issues with the structure John recommended, and you can review it afterwards

@mrmundt
Copy link
Contributor

mrmundt commented Aug 27, 2025

@mrmundt I can attempt to solve the testing issues with the structure John recommended, and you can review it afterwards

Should be fine now. I had to update some docs.

@slilonfe5
Copy link
Member Author

slilonfe5 commented Aug 27, 2025

@mrmundt I can attempt to solve the testing issues with the structure John recommended, and you can review it afterwards

Should be fine now. I had to update some docs.

With the current updates to the doc files, we shouldn't have a deprecation warning because we are using the string obj_function input and also not passing a calc_cov argument to theta_est()

@mrmundt
Copy link
Contributor

mrmundt commented Aug 27, 2025

@mrmundt I can attempt to solve the testing issues with the structure John recommended, and you can review it afterwards

Should be fine now. I had to update some docs.

With the current updates to the doc files, we shouldn't have a deprecation warning because we are using the string obj_function input and also not passing a calc_cov argument to theta_est()

Are you able to address the comments today, ASAP? We really do need to cut the release.

@slilonfe5
Copy link
Member Author

@mrmundt I can attempt to solve the testing issues with the structure John recommended, and you can review it afterwards

Should be fine now. I had to update some docs.

With the current updates to the doc files, we shouldn't have a deprecation warning because we are using the string obj_function input and also not passing a calc_cov argument to theta_est()

Are you able to address the comments today, ASAP? We really do need to cut the release.

Yes. I can do that. Thanks

@mrmundt
Copy link
Contributor

mrmundt commented Aug 27, 2025

@mrmundt I can attempt to solve the testing issues with the structure John recommended, and you can review it afterwards

Should be fine now. I had to update some docs.

With the current updates to the doc files, we shouldn't have a deprecation warning because we are using the string obj_function input and also not passing a calc_cov argument to theta_est()

Are you able to address the comments today, ASAP? We really do need to cut the release.

Yes. I can do that. Thanks

Okay, so, the error that you have now is the same one we were hitting, which is why we added the second deprecation warning. What's your preferred path forward?

@slilonfe5
Copy link
Member Author

slilonfe5 commented Aug 27, 2025

@mrmundt I can attempt to solve the testing issues with the structure John recommended, and you can review it afterwards

Should be fine now. I had to update some docs.

With the current updates to the doc files, we shouldn't have a deprecation warning because we are using the string obj_function input and also not passing a calc_cov argument to theta_est()

Are you able to address the comments today, ASAP? We really do need to cut the release.

Yes. I can do that. Thanks

Okay, so, the error that you have now is the same one we were hitting, which is why we added the second deprecation warning. What's your preferred path forward?

I have figured it out. I missed something. Everything should work now

@slilonfe5
Copy link
Member Author

@mrmundt, we may need to re-run the one test that failed on the Python packages installation

@mrmundt
Copy link
Contributor

mrmundt commented Aug 27, 2025

@mrmundt, we may need to re-run the one test that failed on the Python packages installation

Yup, will do. I have to wait for all the other tests to finish first.

@slilonfe5
Copy link
Member Author

@mrmundt, we may need to re-run the one test that failed on the Python packages installation

Yup, will do. I have to wait for all the other tests to finish first.

Thank you for all your help. Hopefully, we get to connect during the PSE Summit next week

@mrmundt
Copy link
Contributor

mrmundt commented Aug 27, 2025

@mrmundt, we may need to re-run the one test that failed on the Python packages installation

Yup, will do. I have to wait for all the other tests to finish first.

Thank you for all your help. Hopefully, we get to connect during the PSE Summit next week

Oooop. Hate to disappoint, but I won't be there! John will be, though. (If you make whatever discussion a Zoom meeting, I'm happy to call in virtually, FWIW.)

@mrmundt mrmundt requested review from djlaky, adowling2 and lxhowl August 27, 2025 23:05
@mrmundt mrmundt dismissed blnicho’s stale review August 27, 2025 23:06

Already resolved.

@mrmundt mrmundt merged commit 6edb983 into Pyomo:main Aug 27, 2025
34 of 35 checks passed
@github-project-automation github-project-automation bot moved this from Review In Progress to Done in Pyomo 6.9.4 Release Aug 27, 2025
@github-project-automation github-project-automation bot moved this from Ready for final review to Done in ParmEst & Pyomo.DoE Development Aug 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

8 participants