seisflows.plugins.line_search
Submodules
Package Contents
Classes
[line_search.bracket] The bracketing line search identifies two points |
|
[line_search.backtrack] Backtracking line search assumes the |
- class seisflows.plugins.line_search.Bracket(step_count_max, step_len_max, path=None)
[line_search.bracket] The bracketing line search identifies two points between which the minimum misfit lies between.
- Parameters
step_count_max (int) – maximum number of step counts before changing line search behavior. set by PAR.STEP_COUNT_MAX
step_len_max (int) – maximum length of the step, defaults to infinity, that is unbounded step length. set by PAR.STEP_LEN_MAX
- update_search_history(func_val, step_len, gtg=None, gtp=None)
Update the internal list of search history attributes. Lists like func_vals get appended to, while values like step_count are overwritten. Allowed to increment func_val and step_len by themselves
- clear_search_history()
Clears internal line search history for a new line search attempt
- check_search_history()
Since the line search is just a wrapper for list of numbers, check that search history hasn’t been muddled up by ensuring that internal lists are the correct length for the given evaluation
- get_search_history(sort=True)
A convenience function, collects information based on the current evaluation of the line search, needed to determine search status and calculate step length. From the full collection of the search history, only returns values relevant to the current line search.
- Parameters
sort (bool) – sort the search history by step length
- Rtype x
np.array
- Return x
list of step lenths from current line search
- Rtype f
np.array
- Return f
correpsonding list of function values
- Rtype gtg
list
- Return gtg
dot product dot product of gradient with itself
- Rtype gtp
list
- Return gtp
dot product of gradient and search direction
- Rtype i
int
- Return i
step_count
- Rtype j
int
- Return j
number of iterations corresponding to 0 step length, i.e., the update count
- _print_stats(x, f)
Print out misfit values and step lengths to the logger
- calculate_step_length()
Determines step length (alpha) and search status (status) using a bracketing line search. Evaluates Wolfe conditions to determine if a step length is acceptable.
- Return type
tuple (float, str)
- Returns
(alpha==calculated step length, status==how to treat the next step count evaluation)
- class seisflows.plugins.line_search.Backtrack(step_count_max, step_len_max, path=None)
Bases:
seisflows.plugins.line_search.bracket.Bracket
[line_search.backtrack] Backtracking line search assumes the gradient is well scaled from the L-BFGS optimization algorithm, such that a unit step length (1) will provide a decrease in misfit. If misfit does not decrease, the backtracking step count follows a parabolic backtrack from 1 -> 0 in search of a decreased misfit. If the backtracked value becomes too small the backtracking line search defaults to a Bracketing line search.
- Variables Descriptions:
x: list of step lenths from current line search f: correpsonding list of function values m: number of step lengths in current line search n: number of model updates in optimization problem gtg: dot product of gradient with itself gtp: dot product of gradient and search direction
- Status codes
status == 1 : PASS, line search finished status == 0 : TRY/RETRY, attempt line search w/ new step length status == -1 : FAIL, line search exceeds internal criteria
- calculate_step_length()
Determines step length and search status. Defaults to ‘Bracket’ing line search during the first evaluation (waiting for the L-BFGS to scale properly).
Note
Search history variable descriptions: x: list of step lenths from current line search f: correpsonding list of function values m: number of step lengths in current line search n: number of model updates in optimization problem gtg: dot product of gradient with itself gtp: dot product of gradient and search direction
- Return type
tuple (float, str)
- Returns
(alpha==calculated step length, status==how to treat the next step count evaluation)