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

Fix type of initial_scale in reset_search_direction! #1089

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

odow
Copy link
Contributor

@odow odow commented Mar 28, 2024

Copy link

codecov bot commented Mar 28, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 85.26%. Comparing base (77501f4) to head (588d95b).

Files with missing lines Patch % Lines
src/utilities/perform_linesearch.jl 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1089   +/-   ##
=======================================
  Coverage   85.26%   85.26%           
=======================================
  Files          45       45           
  Lines        3502     3502           
=======================================
  Hits         2986     2986           
  Misses        516      516           

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

@devmotion
Copy link
Contributor

devmotion commented Mar 28, 2024

I think it might be more consistent to apply the pattern in

initial_scale = T(method.initial_stepnorm) * inv(norm(gradient(obj), Inf))
to
initial_scale = method.initial_stepnorm * inv(norm(gradient(d), Inf))
.

Generally, isn't the error caused by an incorrectly typed initial_stepnorm provided by the user? If you deal with Float32 data, you can avoid the problem by specifying also initial_stepnorm as a Float32. That being said, I guess

initial_scale = T(method.initial_stepnorm) * inv(norm(gradient(obj), Inf))
makes it a bit more convenient for users.

@pkofod
Copy link
Member

pkofod commented Apr 17, 2024

I think it might be more consistent to apply the pattern in

I agree

@pkofod
Copy link
Member

pkofod commented Apr 17, 2024

Generally, isn't the error caused by an incorrectly typed initial_stepnorm provided by the user? If you deal with Float32 data, you can avoid the problem by specifying also initial_stepnorm as a Float32. That being said, I guess

Sure, but usually I think it should be enough to supply x0 as the type you want even if there might be some cases where it's harder to prepare for that.. but I think we can apply the "correct" pattern here for the user..

@pkofod
Copy link
Member

pkofod commented Oct 29, 2024

@odow would you like to update this PR? Or would you rather not do more here. I think @devmotion 's assessment is correct here.

@odow odow force-pushed the patch-2 branch 2 times, most recently from f18e254 to 765ffc2 Compare October 30, 2024 22:31
@odow odow changed the title Fix _init_identity_matrix in bfgs.jl Fix type of initial_scale in reset_search_direction! Oct 30, 2024
@odow
Copy link
Contributor Author

odow commented Oct 30, 2024

Updated. I don't have a test or a reproducible example; I was just following the stack trace from the discourse post.

@pkofod
Copy link
Member

pkofod commented Oct 31, 2024

Updated. I don't have a test or a reproducible example; I was just following the stack trace from the discourse post.

okay, thanks. Yes it can be a bit hard here to have a user-facing example (from the top level call to optimize) because you need it to hit a reset... I will have a look again, maybe I can write a test than artificially calls internals as if it had iterated and had to reset

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