Skip to content

add argument line_search_kwargs to BFGS#1070

Open
rushabh-v wants to merge 1 commit into
tensorflow:mainfrom
rushabh-v:kwargs_LS
Open

add argument line_search_kwargs to BFGS#1070
rushabh-v wants to merge 1 commit into
tensorflow:mainfrom
rushabh-v:kwargs_LS

Conversation

@rushabh-v
Copy link
Copy Markdown
Contributor

Fixes: #1043

@googlebot googlebot added the cla: yes Declares that the user has signed CLA label Aug 30, 2020
max_line_search_iterations=50,
name=None):
name=None,
line_search_kwargs={}):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We have a pretty strong convention in TFP of letting the name argument be last.

Also please use None as a default value and explicitly set it to {} if None in the body, because {} is not safe as a default argument (see lint error on Travis).

current_state, value_and_gradients_function, actual_search_direction,
tolerance, f_relative_tolerance, x_tolerance, stopping_condition,
max_line_search_iterations)
max_line_search_iterations, **line_search_kwargs)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The purpose is for the user to be able to control the parameters of the actual line search algorithm, namely linesearch.hager_zhang. All of the parameters that line_search_step itself consumes are already being passed in explicitly. Please pass the dictionary through to that depth, and add a unit test that you can, indeed, affect the behavior of the algorithm by controlling at least one of those parameters (e.g., initial_step_size).

@brianwa84
Copy link
Copy Markdown
Contributor

@rushabh-v will you be following up on the test @axch requested?

@rushabh-v
Copy link
Copy Markdown
Contributor Author

I am sorry, I tried at that time but couldn't figure out a way to test that (I could not figure out changing which argument would make what change in the output, because I don't understand the math behind it). And currently, I am really low on time. Should I close this PR?

@hasan-malik
Copy link
Copy Markdown

hasan-malik commented May 19, 2026

FYI — I've opened #2023 that picks this up and addresses @axch's feedback (the argument ordering and the unit test).

Happy to defer if you'd prefer to revive this one.

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

Labels

cla: yes Declares that the user has signed CLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BFGS user should be able to pass parameters to the line search

5 participants