salvus.opt.methods.lbfgs
L-BFGS approximation of Hessian and inverse Hessian
Functions
apply_inverse_hessian()
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.
modelsalvus.opt.models.base_model.BaseModel — Model to apply the inverse LBFGS Hessian to.lbfgs_dataDict — L-BFGS data containing the sorted diffs of models and gradients.
apply_inverse_hessian_part1()
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.
modelsalvus.opt.models.base_model.BaseModel — Model to apply the inverse LBFGS Hessian to.lbfgs_dataDict — L-BFGS data containing the sorted diffs of models and gradients.
apply_inverse_hessian_part2()
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.
preconditioned_modelsalvus.opt.models.base_model.BaseModel — Preconditioned model from part 1.lbfgs_dataDict — L-BFGS data containing the sorted diffs of models and gradients.
apply_lbfgs_hessian()
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.
modelsalvus.opt.models.base_model.BaseModel — Model to apply the LBFGS Hessian to.lbfgs_dataDict[str, Any] — L-BFGS data containing the sorted diffs of models and gradients.n_memoryOptional[int] — Optional length of the L-BFGS history to only consider a subset of lbfgs_data.
setup_lbfgs_data()
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.
modelsList[salvus.opt.models.base_model.BaseModel] — List of previous models.gradientsList[salvus.opt.models.base_model.BaseModel] — List of previous gradients.