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 line search to avoid non-finite gradients #3309

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Commits on Aug 5, 2024

  1. Fix line search to avoid non-finite gradients

    Related to stan-dev#3306
    
    Modify the `WolfeLineSearch` function in `src/stan/optimization/bfgs_linesearch.hpp` to handle non-finite gradients.
    
    * Check if the function value `func_val` is finite.
    * Check if the gradient `gradx1` is finite.
    * If either the function value or the gradient is non-finite, restart the line search with a smaller step size.
    
    ---
    
    For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/stan-dev/stan/issues/3306?shareId=XXXX-XXXX-XXXX-XXXX).
    cpfiffer committed Aug 5, 2024
    Configuration menu
    Copy the full SHA
    801093b View commit details
    Browse the repository at this point in the history
  2. Add test for handling non-finite gradients in WolfeLineSearch

    * Add `linesearch_testfunc_nonfinite` class to simulate non-finite gradients
    * Add `wolfeLineSearch_nonfinite_gradient` test to verify that the optimization process can handle non-finite gradients
    * Ensure the test checks that the line search algorithm avoids returning points with finite log density but infinite gradient
    
    ---
    
    For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/stan-dev/stan/issues/3306?shareId=XXXX-XXXX-XXXX-XXXX).
    cpfiffer committed Aug 5, 2024
    Configuration menu
    Copy the full SHA
    7066ec4 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    407b737 View commit details
    Browse the repository at this point in the history