-
-
Notifications
You must be signed in to change notification settings - Fork 73
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
Correct line search to search over gradient #354
Conversation
Previously, the line search operated directly over parameter space. This caused issues when there were different types for parameters vs gradients e.g. Lie Groups. This commit changes line searches to operate over gradient parameterization and incorporates gradient updates to parameters via ArgminScaledAdd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for this contribution! This is a case I didn't consider. I have only a minor request in the example you provided (which is actually my mistake).
Another thing that I would appreciate if you could do is to change P
in the definition of the LineSearch
trait to D
(here). This is obviously purely cosmetic but I think it would make it less tempting to use P
again.
Edit: I don't think that there is additional testing needed.
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #354 +/- ##
=======================================
Coverage 93.35% 93.35%
=======================================
Files 117 117
Lines 18803 18803
=======================================
Hits 17554 17554
Misses 1249 1249
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! There is only one minor comment. Once this is fixed this is ready to be squashed and merged :)
argmin/src/solver/linesearch/mod.rs
Outdated
/// // `P` is the type of the search direction, typically the same as the parameter vector | ||
/// search_direction: P, | ||
/// struct MyLineSearch<D, F> { | ||
/// // `D` is the type of the search direction, typically the same as the parameter vector |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for also fixing the docs. There is only one small suggestions:
/// // `D` is the type of the search direction, typically the same as the parameter vector | |
/// // `D` is the type of the search direction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be resolved now. I also squashed all the fixup commits.
ae7e1cd
to
b3e79c5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! :)
Previously, the line search operated directly over parameter space. This caused issues when there were different types for parameters vs gradients e.g. Lie Groups. This commit changes line searches to operate over gradient parameterization and incorporates gradient updates to parameters via ArgminScaledAdd.
I'm not sure sure what level of testing is needed for this but it passes all the unit tests with
cargo test
and I also ran the 3 line search examples and the steepest descent example