boat_ms.fo_ol
Submodules
boat_ms.fo_ol.meso
- class boat_ms.fo_ol.meso.MESO(ll_objective, lower_loop, ul_model, ul_objective, ll_model, ll_var, ul_var, solver_config)[source]
Bases:
DynamicalSystemImplements the optimization procedure of Moreau Envelope based Single-loop Method (MESO) [1].
- Parameters:
ll_objective (Callable) – The lower-level objective of the BLO problem.
ul_objective (Callable) – The upper-level objective of the BLO problem.
ll_model (mindspore.nn.Cell) – The lower-level model of the BLO problem.
ul_model (mindspore.nn.Cell) – The upper-level model of the BLO problem.
ll_var (List[mindspore.Tensor]) – The list of lower-level variables of the BLO problem.
ul_var (List[mindspore.Tensor]) – The list of upper-level variables of the BLO problem.
lower_loop (int) – Number of iterations for lower-level optimization.
solver_config (Dict[str, Any]) –
A dictionary containing solver configurations. Expected keys include:
”lower_level_opt”: The optimizer for the lower-level model.
- ”MESO” (Dict): A dictionary containing the following keys:
”eta”: Learning rate for the MESO optimization procedure.
”gamma_1”: Regularization parameter for the MESO algorithm.
”c0”: Initial constant for the update steps.
”y_hat_lr”: Learning rate for optimizing the surrogate variable y_hat.
References
[1] Liu R, Liu Z, Yao W, et al. “Moreau Envelope for Nonconvex Bi-Level Optimization: A Single-loop and Hessian-free Solution Strategy,” ICML, 2024.
- optimize(ll_feed_dict, ul_feed_dict, current_iter)[source]
Execute the optimization procedure with the data from feed_dict.
- Parameters:
ll_feed_dict (Dict) – Dictionary containing the lower-level data used for optimization. It typically includes training data, targets, and other information required to compute the LL objective.
ul_feed_dict (Dict) – Dictionary containing the upper-level data used for optimization. It typically includes validation data, targets, and other information required to compute the UL objective.
current_iter (int) – The current iteration number of the optimization process.
- Return type:
The upper-level loss.
boat_ms.fo_ol.pgdo
- class boat_ms.fo_ol.pgdo.PGDO(ll_objective, lower_loop, ul_model, ul_objective, ll_model, ll_var, ul_var, solver_config)[source]
Bases:
DynamicalSystemImplements the optimization procedure of Penalty-based Gradient Descent Method (PGDO) [1].
- Parameters:
ll_objective (Callable) – The lower-level objective of the BLO problem.
ul_objective (Callable) – The upper-level objective of the BLO problem.
ll_model (mindspore.nn.Cell) – The lower-level model of the BLO problem.
ul_model (mindspore.nn.Cell) – The upper-level model of the BLO problem.
ll_var (List[mindspore.Tensor]) – The list of lower-level variables of the BLO problem.
ul_var (List[mindspore.Tensor]) – The list of upper-level variables of the BLO problem.
lower_loop (int) – Number of iterations for lower-level optimization.
solver_config (Dict[str, Any]) –
A dictionary containing solver configurations. Expected keys include:
”lower_level_opt”: The optimizer for the lower-level model.
- ”PGDO” (Dict): A dictionary containing the following keys:
”y_hat_lr”: Learning rate for optimizing the surrogate variable y_hat.
”gamma_init”: Initial value of the hyperparameter gamma.
”gamma_max”: Maximum value of the hyperparameter gamma.
”gamma_argmax_step”: Step size of the hyperparameter gamma.
References
[1] Shen H, Chen T. “On penalty-based bilevel gradient descent method,” in ICML, 2023.
- optimize(ll_feed_dict, ul_feed_dict, current_iter)[source]
Execute the optimization procedure with the data from feed_dict.
- Parameters:
ll_feed_dict (Dict) – Dictionary containing the lower-level data used for optimization. It typically includes training data, targets, and other information required to compute the LL objective.
ul_feed_dict (Dict) – Dictionary containing the upper-level data used for optimization. It typically includes validation data, targets, and other information required to compute the UL objective.
current_iter (int) – The current iteration number of the optimization process.
- Return type:
The upper-level loss.
boat_ms.fo_ol.vfo
- class boat_ms.fo_ol.vfo.VFO(ll_objective, lower_loop, ul_model, ul_objective, ll_model, ll_var, ul_var, solver_config)[source]
Bases:
DynamicalSystemImplements the optimization procedure of Value-function based First-Order Method (VFO) [1].
- Parameters:
ll_objective (Callable) – The lower-level objective function of the BLO problem.
ul_objective (Callable) – The upper-level objective function of the BLO problem.
ll_model (mindspore.nn.Cell) – The lower-level model of the BLO problem.
ul_model (mindspore.nn.Cell) – The upper-level model of the BLO problem.
ll_var (List[mindspore.Tensor]) – A list of lower-level variables of the BLO problem.
ul_var (List[mindspore.Tensor]) – A list of upper-level variables of the BLO problem.
lower_loop (int) – The number of iterations for lower-level optimization.
solver_config (Dict[str, Any]) –
A dictionary containing configurations for the solver. Expected keys include:
”lower_level_opt” (mindspore.nn.optim.Optimizer): Optimizer for the lower-level model.
- ”VFO” (Dict): Configuration for the VFO algorithm:
”y_hat_lr” (float): Learning rate for optimizing the surrogate variable y_hat.
”eta” (float): Step size for value-function updates.
”u1” (float): Hyperparameter controlling the penalty in the value function.
”device” (str): Device on which computations are performed, e.g., “cpu” or “cuda”.
References
[1] R. Liu, X. Liu, X. Yuan, S. Zeng and J. Zhang, “A Value-Function-based Interior-point Method for Non-convex Bi-level Optimization,” in ICML, 2021.
- optimize(ll_feed_dict, ul_feed_dict, current_iter)[source]
Execute the optimization procedure with the data from feed_dict.
- Parameters:
ll_feed_dict (Dict) – Dictionary containing the lower-level data used for optimization. It typically includes training data, targets, and other information required to compute the LL objective.
ul_feed_dict (Dict) – Dictionary containing the upper-level data used for optimization. It typically includes validation data, targets, and other information required to compute the UL objective.
current_iter (int) – The current iteration number of the optimization process.
- Return type:
The upper-level loss.
boat_ms.fo_ol.vso
- class boat_ms.fo_ol.vso.VSO(ll_objective, lower_loop, ul_model, ul_objective, ll_model, ll_var, ul_var, solver_config)[source]
Bases:
DynamicalSystemValue-function based Sequential Method (VSO) [Liu et al., NeurIPS 2022]