Skip to content

Conversation

@YigitElma
Copy link
Collaborator

@YigitElma YigitElma commented Dec 16, 2025

  • Adds Adam and RMSProp optimizers
  • Unifies all the SGD type optimizers, developers only need to implement the update rule
  • x_scale is now used with SGD methods too

@YigitElma YigitElma self-assigned this Dec 16, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 16, 2025

Memory benchmark result

|               Test Name                |      %Δ      |    Master (MB)     |      PR (MB)       |    Δ (MB)    |    Time PR (s)     |  Time Master (s)   |
| -------------------------------------- | ------------ | ------------------ | ------------------ | ------------ | ------------------ | ------------------ |
  test_objective_jac_w7x                 |    2.08 %    |     3.952e+03      |     4.034e+03      |    82.14     |       47.33        |       43.93        |
  test_proximal_jac_w7x_with_eq_update   |    1.70 %    |     6.613e+03      |     6.726e+03      |    112.66    |       198.04       |       198.83       |
  test_proximal_freeb_jac                |   -0.08 %    |     1.323e+04      |     1.322e+04      |    -10.12    |       106.29       |       106.91       |
  test_proximal_freeb_jac_blocked        |   -0.06 %    |     7.550e+03      |     7.545e+03      |    -4.70     |       93.96        |       94.68        |
  test_proximal_freeb_jac_batched        |    0.17 %    |     7.561e+03      |     7.575e+03      |    13.02     |       93.96        |       94.27        |
  test_proximal_jac_ripple               |   -0.27 %    |     3.579e+03      |     3.570e+03      |    -9.60     |       71.90        |       73.01        |
  test_proximal_jac_ripple_bounce1d      |   -2.68 %    |     3.765e+03      |     3.664e+03      |   -101.03    |       84.17        |       85.57        |
  test_eq_solve                          |   -0.09 %    |     2.028e+03      |     2.026e+03      |    -1.75     |       101.17       |       101.58       |

For the memory plots, go to the summary of Memory Benchmarks workflow and download the artifact.

@codecov
Copy link

codecov bot commented Dec 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.76%. Comparing base (087e2ab) to head (53dccec).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2041   +/-   ##
=======================================
  Coverage   95.75%   95.76%           
=======================================
  Files         102      102           
  Lines       28344    28374   +30     
=======================================
+ Hits        27142    27171   +29     
- Misses       1202     1203    +1     
Files with missing lines Coverage Δ
desc/optimize/__init__.py 100.00% <100.00%> (ø)
desc/optimize/_desc_wrappers.py 91.04% <100.00%> (ø)
desc/optimize/stochastic.py 98.96% <100.00%> (+1.95%) ⬆️
desc/particles.py 92.49% <ø> (ø)

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@YigitElma YigitElma marked this pull request as ready for review December 18, 2025 01:42
@YigitElma YigitElma requested review from a team, ddudt, dpanici, f0uriest, rahulgaur104 and unalmis and removed request for a team December 18, 2025 01:42
@YigitElma YigitElma changed the title Add ADAM optimizer Add ADAM and RMSProp optimizers Dec 18, 2025
Update rule for 'rmsprop':
v_{k} = beta*v_{k-1} + (1-beta)*grad(x_{k})^2
x_{k+1} = x_{k} - alpha * grad(x_{k}) / (sqrt(v_{k}) + epsilon)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Some literature uses different Greek letters for alpha and beta, but I used these to make api slightly more compact.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry for the unrelated change, noticed this while fixing the doc errors

ValueError,
"x_scale should be one of 'auto' or array-like, got {}".format(x_scale),
)
if isinstance(x_scale, str):
Copy link
Collaborator

Choose a reason for hiding this comment

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

should say in docstring that 'x_scale="auto"' is essentially just means no scaling as we just set xscale to 1 in that case.

Copy link
Collaborator

@dpanici dpanici left a comment

Choose a reason for hiding this comment

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

just the small docstring fix, should be explitict that x_scale='"auto"` does no scaling here

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.

3 participants