Skip to content

Update the README example to the 0.5 optimizer interface - #237

Closed
benedict-96 wants to merge 2 commits into
mainfrom
update-readme-new-interface
Closed

Update the README example to the 0.5 optimizer interface#237
benedict-96 wants to merge 2 commits into
mainfrom
update-readme-new-interface

Conversation

@benedict-96

Copy link
Copy Markdown
Collaborator

The example in the README predates the move of the optimizer machinery to GeometricOptimizers and no longer runs against main.

Changes

line before after
optimizer Optimizer(AdamOptimizer(), g_nn) Optimizer(Adam(type), g_nn; step_size = 1e-3)
prediction Iterate_Sympnet(g_nn, ics; n_points = ...) iterate(g_nn, ics; n_points = ...)
  • The optimizer constructor. The method comes first and the learning rate is no longer part of the method, per the Changed (breaking) section of the changelog. Adam is constructed with the element type of the parameters, so it reuses the type binding already defined a few lines above — which also makes the point that the example is type-generic.
  • Iterate_Sympnet. Not defined in the package any more (isdefined(GeometricMachineLearning, :Iterate_Sympnet) == false); the line raised an UndefVarError as written. iterate is what the SympNet tutorial uses.

One paragraph of prose was added saying where the optimizer methods now come from, since the README is where a reader meets them first and Adam no longer being a GML type is otherwise unexplained.

Verification

Ran the changed calls against the package on Julia 1.12 with a synthetic q/p dataset — Optimizer(Adam(Float32), nn; step_size = 1e-3) constructs (method::Adam{Float32}, step_size = 0.001), a 3-epoch training run completes, and iterate(nn, ics; n_points = 200) returns (1, 200) trajectories. Confirmed in the same run that Iterate_Sympnet, default_optimizer and BFGSOptimizer are all undefined and that AdamOptimizer survives as an alias.

The CUDA and Plots lines are unchanged and were not exercised — no GPU here, and neither package is in the project environment.

Not addressed

The README has no installation section, so the Julia 1.10 floor is not stated anywhere in it. Worth a follow-up if you want it mentioned outside the changelog.


Authored by Claude Opus 5 (Claude Code) at @benedict-96's request. Documentation only — no change under src/.

🤖 Generated with Claude Code

The example in the README predates the move of the optimizer machinery to
GeometricOptimizers and no longer runs:

- `Optimizer(AdamOptimizer(), g_nn)` -> `Optimizer(Adam(type), g_nn; step_size = 1e-3)`.
  The method comes first and the learning rate is no longer part of the method.
  `Adam` is constructed with the element type of the parameters, so it reuses the
  `type` already defined a few lines above.
- `Iterate_Sympnet` -> `iterate`. `Iterate_Sympnet` is not defined in the package
  any more, so this line raised an `UndefVarError` as written.

Also note in the prose where the optimizer methods now come from, since the
README is where a reader first meets them.

Verified by running the changed calls against the package on Julia 1.12
(`Optimizer(Adam(Float32), nn; step_size = 1e-3)`, a short training run and
`iterate(nn, ics; n_points = 200)`) with a synthetic q/p dataset. The CUDA and
`Plots` lines of the example are unchanged and were not exercised.

Drafted by Claude Opus 5 (Claude Code) at benedict-96's request; the diff is
documentation only.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The docs and tutorials use CairoMakie throughout; the README example was
the last place still reaching for Plots.jl.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@benedict-96
benedict-96 requested a review from michakraus August 16, 2026 14:59
@codecov

codecov Bot commented Aug 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.66%. Comparing base (0608b85) to head (d753344).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #237   +/-   ##
=======================================
  Coverage   65.66%   65.66%           
=======================================
  Files         112      112           
  Lines        3906     3906           
=======================================
  Hits         2565     2565           
  Misses       1341     1341           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

@michakraus

Copy link
Copy Markdown
Member

Superseded by #241, which carries both of this PR's substantive fixes — Optimizer(Adam(type), g_nn; step_size = 1e-3) and iterate in place of the undefined Iterate_Sympnet — along with the paragraph on where the optimizer methods now come from.

The plotting hunk here was overtaken by #238, which converted the README to CairoMakie on main. The API fixes only make sense alongside the rest of 0.5.0, so they travel with that release rather than landing separately.

Closing as superseded, not rejected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants