Skip to content

[chang_ramsey] Fix Runtime and Deprecation warnings #204

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

Merged
merged 3 commits into from
May 28, 2025
Merged

[chang_ramsey] Fix Runtime and Deprecation warnings #204

merged 3 commits into from
May 28, 2025

Conversation

kp992
Copy link
Collaborator

@kp992 kp992 commented May 21, 2025

Fix Runtime and Deprecation warnings

  • Avoid invalid inputs by checking and clipping the limits.
  • Fix API deprecation warnings by using new API formats.

Fixes #201

@kp992 kp992 requested a review from mmcky May 21, 2025 02:59
@github-actions github-actions bot temporarily deployed to commit May 21, 2025 03:15 Inactive
@github-actions github-actions bot temporarily deployed to commit May 21, 2025 03:42 Inactive
@mmcky
Copy link
Contributor

mmcky commented May 22, 2025

nice work! Thanks @kp992 -- I'll review this afternoon and merge.

@mmcky
Copy link
Contributor

mmcky commented May 22, 2025

@kp992 should we install cvxopt in this environment?

Screenshot 2025-05-22 at 12 19 34 pm

@mmcky
Copy link
Contributor

mmcky commented May 22, 2025

@kp992 it looks like we have introduced some new Runtime Warnings. Would you mind to take a look?

Screenshot 2025-05-22 at 12 22 28 pm

@kp992
Copy link
Collaborator Author

kp992 commented May 22, 2025

Thanks @mmcky. The first one is not really a warning but that could be fix by installing cvxopt. I was reading more about the second one and looks like its coming from the internals of scipy and it's something I think not in our hand.

@github-actions github-actions bot temporarily deployed to commit May 22, 2025 04:05 Inactive
@mmcky
Copy link
Contributor

mmcky commented May 22, 2025

thanks @kp992 -- here is what Gemini had to say about it :-)

The "Values in x were outside bounds during a minimize step, clipping to bounds" warning in scipy.optimize arises when the optimization algorithm attempts to evaluate the objective function at a point outside the defined bounds. To resolve this, consider the following:

Initial Guess:
Ensure the initial guess x0 lies within the specified bounds. If not, the algorithm might struggle to find a feasible solution.

Bounds Definition:
Verify the bounds are correctly defined, especially for multiple variables. Use (min, max) tuples for each variable.

Algorithm Choice:
Some algorithms handle bounds more effectively than others. If using an algorithm like L-BFGS-B, which explicitly supports bounds, the issue might stem from other factors. Consider trying different algorithms.

Objective Function:
Check if the objective function itself might be causing the issue. For instance, numerical instability or undefined behavior outside the bounds could trigger the warning.

SciPy Version:
In some cases, this warning has been linked to specific SciPy versions. Upgrading or downgrading SciPy could potentially resolve the issue.

If the warning persists despite these checks, it might be benign and not affect the final result, especially if the clipping occurs only during intermediate steps. However, it's crucial to ensure the solution remains within the bounds and that the warning doesn't indicate a more serious problem with the optimization process.

Not bad advise :-)

@kp992
Copy link
Collaborator Author

kp992 commented May 23, 2025

Thanks @mmcky, I already tried different algo like L-BFGS-B but they don't support constraints which will lead to new set of warnings.

@mmcky mmcky merged commit 37cff82 into main May 28, 2025
6 checks passed
@mmcky mmcky deleted the i-201 branch May 28, 2025 02:29
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.

[change_ramsey] Updates to Code Required
2 participants