Skip to content
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

Merged
merged 4 commits into from
May 15, 2023

Conversation

DevonMorris
Copy link
Contributor

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

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.
Copy link
Member

@stefan-k stefan-k left a 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.

argmin/examples/steepestdescent_manifold.rs Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (2457232) 93.35% compared to head (a801c6b) 93.35%.

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           
Impacted Files Coverage Δ
...gmin/src/solver/gradientdescent/steepestdescent.rs 95.04% <ø> (ø)
argmin/src/solver/linesearch/backtracking.rs 99.05% <100.00%> (ø)
argmin/src/solver/linesearch/hagerzhang.rs 73.89% <100.00%> (ø)
argmin/src/solver/linesearch/morethuente.rs 86.60% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@stefan-k stefan-k left a 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 :)

/// // `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
Copy link
Member

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:

Suggested change
/// // `D` is the type of the search direction, typically the same as the parameter vector
/// // `D` is the type of the search direction

Copy link
Contributor Author

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.

Copy link
Member

@stefan-k stefan-k left a comment

Choose a reason for hiding this comment

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

Thanks! :)

@stefan-k stefan-k merged commit 8388f38 into argmin-rs:main May 15, 2023
13 checks passed
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.

None yet

3 participants