Required
model| Type: | ModelType |
| Description: | Model to apply the inverse L-BFGS Hessian to. |
apply_inverse_hessian_part1 and apply_inverse_hessian_part2
instead.def apply_inverse_hessian(
model: ModelType,
current_iteration: Iteration[ModelType],
available_iterations: dict[int, Iteration[ModelType]],
max_lbfgs_history: int,
) -> ModelType: ...| Type: | ModelType |
| Description: | Model to apply the inverse L-BFGS Hessian to. |
| Type: | Iteration[ModelType] |
| Description: | The current iteration. |
| Type: | dict[int, Iteration[ModelType]] |
| Description: | History of iterations. |
| Type: | int |
| Description: | Maximum number of previous iterations to consider for the L-BFGS approximation. |
ModelTypedef apply_inverse_hessian_part1(
model: ModelType,
current_iteration: Iteration[ModelType],
available_iterations: dict[int, Iteration[ModelType]],
max_lbfgs_history: int,
) -> tuple[ModelType, float, list[LBFGSData]]: ...| Type: | ModelType |
| Description: | Model to precondition. |
| Type: | Iteration[ModelType] |
| Description: | The current iteration. |
| Type: | dict[int, Iteration[ModelType]] |
| Description: | History of iterations |
| Type: | int |
| Description: | Maximum number of previous iterations to consider for the L-BFGS approximation. |
tuple[ModelType, float, list[LBFGSData]]def apply_inverse_hessian_part2(
preconditioned_model: ModelType,
current_iteration: Iteration[ModelType],
available_iterations: dict[int, Iteration[ModelType]],
lbfgs_data: list[LBFGSData],
gamma: float,
) -> ModelType: ...| Type: | ModelType |
| Description: | Preconditioned model from part 1. |
| Type: | Iteration[ModelType] |
| Description: | The current iteration. |
| Type: | dict[int, Iteration[ModelType]] |
| Description: | Iterations available to the optimizer. |
| Type: | list[LBFGSData] |
| Description: | Precomputed quantities for iteration pairs in part 1, sorted from oldest to newest. |
| Type: | float |
| Description: | Scaling factor from part 1. |
ModelTypedef apply_lbfgs_hessian(
model: ModelType,
lbfgs_data: dict[str, typing.Any],
n_memory: int | None = None,
) -> ModelType: ...| Type: | ModelType |
| Description: | Model to apply the LBFGS Hessian to. |
| Type: | dict[str, typing.Any] |
| Description: | L-BFGS data containing the sorted diffs of models and gradients. |
| Type: | int | None |
| Default value: | None |
| Description: | Optional length of the L-BFGS history to only consider a subset of lbfgs_data. |
ModelTypedef setup_lbfgs_data(
models: list[ModelType] | None = None,
gradients: list[ModelType] | None = None,
) -> dict: ...| Type: | list[ModelType] | None |
| Default value: | None |
| Description: | List of previous models. |
| Type: | list[ModelType] | None |
| Default value: | None |
| Description: | List of previous gradients. |
dictclass LBFGSData(builtins.object):
def __init__(
self,
current_iteration_id: int,
previous_iteration_id: int,
rho: float,
alpha: float,
) -> None: ...| Type: | int |
| Description: | ID of the current iteration. |
| Type: | int |
| Description: | ID of the previous iteration. |
| Type: | float |
| Description: | Inverse dot product of model diff and gradient diff. |
| Type: | float |
| Description: | Scaling factor. |
def to_dict(self) -> dict: ...