quara.minimization_algorithm.projected_gradient_descent_backtracking module¶
- class ProjectedGradientDescentBacktracking(func_proj=None)[source]¶
Bases:
quara.minimization_algorithm.minimization_algorithm.MinimizationAlgorithmConstructor
- Parameters
func_proj (Callable[[np.ndarray], np.ndarray], optional) – function of projection, by default None
- property func_proj: Callable[[numpy.ndarray], numpy.ndarray]¶
returns function of projection.
- Returns
function of projection.
- Return type
Callable[[np.ndarray], np.ndarray]
- is_loss_and_option_sufficient()[source]¶
returns whether the loss and the option are sufficient.
- Returns
whether the loss and the option are sufficient.
- Return type
bool
- is_loss_sufficient()[source]¶
returns whether the loss is sufficient.
- Returns
whether the loss is sufficient.
- Return type
bool
- is_option_sufficient()[source]¶
returns whether the option is sufficient.
- Returns
whether the option is sufficient.
- Return type
bool
- optimize(loss_function, loss_function_option, algorithm_option, on_iteration_history=False)[source]¶
optimizes using specified parameters.
- Parameters
loss_function (LossFunction) – Loss Function
loss_function_option (LossFunctionOption) – Loss Function Option
algorithm_option (ProjectedGradientDescentBaseOption) – Projected Gradient Descent Base Algorithm Option
on_iteration_history (bool, optional) – whether to return iteration history, by default False
- Returns
the result of the optimization.
- Return type
ProjectedGradientDescentBaseResult
- Raises
ValueError – when
on_valueofloss_functionis False.ValueError – when
on_gradientofloss_functionis False.
- set_constraint_from_standard_qt_and_option(qt, option)[source]¶
sets constraint from StandardQTomography and Algorithm Option.
- Parameters
qt (StandardQTomography) – StandardQTomography to set constraint.
option (ProjectedGradientDescentBacktrackingOption) – Algorithm Option.
- Return type
None
- class ProjectedGradientDescentBacktrackingOption(on_algo_eq_constraint=True, on_algo_ineq_constraint=True, var_start=None, mu=None, gamma=0.3, mode_stopping_criterion_gradient_descent='single_difference_loss', num_history_stopping_criterion_gradient_descent=1, mode_proj_order='eq_ineq', eps=None)[source]¶
Bases:
quara.minimization_algorithm.minimization_algorithm.MinimizationAlgorithmOptionConstructor
- Parameters
on_algo_eq_constraint (bool, optional) – whether this algorithm needs on algorithm equality constraint, by default True
on_algo_ineq_constraint (bool, optional) – whether this algorithm needs on algorithm inequality constraint, by default True
var_start (np.ndarray, optional) – initial variable for the algorithm, by default None
mu (float, optional) – algorithm option
mu, by default Nonegamma (float, optional) – algorithm option
gamma, by default 0.3mode_stopping_criterion_gradient_descent (str, optional) – mode of stopping criterion for gradient descent, by default “single_difference_loss”
num_history_stopping_criterion_gradient_descent (int, optional) – number of history to be used stopping criterion for gradient descent, by default 1 this must be a integer and greater than or equal to 1.
mode_proj_order (str, optional) – the order in which the projections are performed, by default “eq_ineq”.
eps (float, optional) – algorithm option
epsilon, by default None
- property eps: float¶
returns algorithm option
eps.- Returns
algorithm option
eps.- Return type
float
- property gamma: float¶
returns algorithm option
gamma.- Returns
algorithm option
gamma.- Return type
float
- property mode_proj_order: str¶
returns the order in which the projections are performed.
- Returns
the order in which the projections are performed.
- Return type
str
- property mode_stopping_criterion_gradient_descent: str¶
returns mode of stopping criterion for gradient descent.
- Returns
mode of stopping criterion for gradient descent.
- Return type
str
- property mu: float¶
returns algorithm option
mu.- Returns
algorithm option
mu.- Return type
float
- property num_history_stopping_criterion_gradient_descent: int¶
returns number of history to be used stopping criterion for gradient descent.
- Returns
number of history to be used stopping criterion for gradient descent.
- Return type
int
- class ProjectedGradientDescentBacktrackingResult(value, computation_time=None, k=None, fx=None, x=None, y=None, alpha=None, error_values=None)[source]¶
Bases:
quara.minimization_algorithm.minimization_algorithm.MinimizationResultConstructor
- Parameters
value (np.ndarray) – the result of the minimization.
computation_time (float, optional) – computation time for the minimization, by default None
k (int) –
fx (List[numpy.ndarray]) –
x (List[numpy.ndarray]) –
y (List[numpy.ndarray]) –
alpha (List[float]) –
error_values (List[float]) –
- property alpha: List[numpy.ndarray]¶
return the alpha per iteration.
- Returns
the alpha per iteration.
- Return type
List[np.ndarray]
- property error_values: List[numpy.ndarray]¶
return the error_values per iteration.
- Returns
the error_values per iteration.
- Return type
List[np.ndarray]
- property fx: List[numpy.ndarray]¶
return the value of f(x) per iteration.
- Returns
the value of f(x) per iteration.
- Return type
List[np.ndarray]
- property k: int¶
returns the number of iterations.
- Returns
the number of iterations.
- Return type
int
- property x: List[numpy.ndarray]¶
return the x per iteration.
- Returns
the x per iteration.
- Return type
List[np.ndarray]
- property y: List[numpy.ndarray]¶
return the y per iteration.
- Returns
the y per iteration.
- Return type
List[np.ndarray]