Update the README example to the 0.5 optimizer interface - #237
Closed
benedict-96 wants to merge 2 commits into
Closed
Update the README example to the 0.5 optimizer interface#237benedict-96 wants to merge 2 commits into
benedict-96 wants to merge 2 commits into
Conversation
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>
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
Member
|
Superseded by #241, which carries both of this PR's substantive fixes — The plotting hunk here was overtaken by #238, which converted the README to CairoMakie on Closing as superseded, not rejected. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The example in the README predates the move of the optimizer machinery to GeometricOptimizers and no longer runs against
main.Changes
Optimizer(AdamOptimizer(), g_nn)Optimizer(Adam(type), g_nn; step_size = 1e-3)Iterate_Sympnet(g_nn, ics; n_points = ...)iterate(g_nn, ics; n_points = ...)Adamis constructed with the element type of the parameters, so it reuses thetypebinding 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 anUndefVarErroras written.iterateis 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
Adamno longer being a GML type is otherwise unexplained.Verification
Ran the changed calls against the package on Julia 1.12 with a synthetic
q/pdataset —Optimizer(Adam(Float32), nn; step_size = 1e-3)constructs (method::Adam{Float32},step_size = 0.001), a 3-epoch training run completes, anditerate(nn, ics; n_points = 200)returns(1, 200)trajectories. Confirmed in the same run thatIterate_Sympnet,default_optimizerandBFGSOptimizerare all undefined and thatAdamOptimizersurvives as an alias.The CUDA and
Plotslines 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