Mondaic
This API reference is not for the latest stable Salvus version.

salvus.opt.methods.lbfgs

L-BFGS approximation of Hessian and inverse Hessian

Functions

apply_inverse_hessian()

def apply_inverse_hessian(
    model: salvus.opt.models.base_model.BaseModel, lbfgs_data: Dict
) -> salvus.opt.models.base_model.BaseModel:
    ...

Apply LBFGS inverse Hessian approximation to model.

This method neither uses a custom initial Hessian nor a preconditioner. For either of those, se the two-stage procedure with apply_inverse_hessian_part1 and apply_inverse_hessian_part2 instead.

Parameters
  • model salvus.opt.models.base_model.BaseModel — Model to apply the inverse LBFGS Hessian to.
  • lbfgs_data Dict — L-BFGS data containing the sorted diffs of models and gradients.
Returns salvus.opt.models.base_model.BaseModel

apply_inverse_hessian_part1()

def apply_inverse_hessian_part1(
    model: salvus.opt.models.base_model.BaseModel, lbfgs_data: Dict
) -> salvus.opt.models.base_model.BaseModel:
    ...

Apply LBFGS inverse Hessian approximation to model.

This computes the first part until the application of the initial Hessian approximation.

Parameters
  • model salvus.opt.models.base_model.BaseModel — Model to apply the inverse LBFGS Hessian to.
  • lbfgs_data Dict — L-BFGS data containing the sorted diffs of models and gradients.
Returns salvus.opt.models.base_model.BaseModel — The unpreconditioned direction. The lbfgs data will be updated in place.

apply_inverse_hessian_part2()

def apply_inverse_hessian_part2(
    preconditioned_model: salvus.opt.models.base_model.BaseModel,
    lbfgs_data: Dict,
) -> salvus.opt.models.base_model.BaseModel:
    ...

Apply LBFGS inverse Hessian approximation to model.

This computes the second part, which returns the product of inverse Hessian approximation times the initially provided model.

Parameters
  • preconditioned_model salvus.opt.models.base_model.BaseModel — Preconditioned model from part 1.
  • lbfgs_data Dict — L-BFGS data containing the sorted diffs of models and gradients.
Returns salvus.opt.models.base_model.BaseModel

apply_lbfgs_hessian()

def apply_lbfgs_hessian(
    model: salvus.opt.models.base_model.BaseModel,
    lbfgs_data: Dict[str, Any],
    n_memory: Optional[int] = None,
) -> salvus.opt.models.base_model.BaseModel:
    ...

Apply LBFGS Hessian approximation to model.

Parameters
  • model salvus.opt.models.base_model.BaseModel — Model to apply the LBFGS Hessian to.
  • lbfgs_data Dict[str, Any] — L-BFGS data containing the sorted diffs of models and gradients.
  • n_memory Optional[int] — Optional length of the L-BFGS history to only consider a subset of lbfgs_data.
Returns salvus.opt.models.base_model.BaseModel

setup_lbfgs_data()

def setup_lbfgs_data(
    models: List[salvus.opt.models.base_model.BaseModel] = [],
    gradients: List[salvus.opt.models.base_model.BaseModel] = [],
) -> Dict:
    ...

Build LBFGS auxiliary data from history of models and gradients. The input lists must be ordered from oldest to newest model.

Parameters
  • models List[salvus.opt.models.base_model.BaseModel] — List of previous models.
  • gradients List[salvus.opt.models.base_model.BaseModel] — List of previous gradients.
Returns Dict