smooth¶
Module: smooth
¶
Inheritance diagram for regreg.smooth
:
Classes¶
affine_smooth
¶
-
class
regreg.smooth.
affine_smooth
(smooth_atom, atransform, store_grad=True, diag=False)¶ Bases:
regreg.smooth.smooth_atom
Composition of a smooth objective with an affine transform.
-
__init__
(smooth_atom, atransform, store_grad=True, diag=False)¶ - Parameters
smooth_atom : regreg.smooth.smooth_atom
A smooth atom.
atransform : regreg.affine.affine_transform
An affine transformation, or cast to one using regreg.affine.linear_transform
store_grad : bool
If True, when computing the gradient, store a reference to the gradient of smooth_atom in the attribute grad.
diag : bool
Indicates if atransform acts diagonally, i.e. a rescaling. Passed to regreg.affine.linear_transform.
-
classmethod
affine
(linear_operator, offset, coef=1, diag=False, quadratic=None, **kws)¶ Keywords given in kws are passed to cls constructor along with other arguments
-
apply_offset
(x)¶ If self.offset is not None, return x-self.offset, else return x.
-
property
coef
¶
-
property
conjugate
¶
-
property
dual
¶
-
force_reshape
= True¶
-
get_conjugate
()¶
-
get_lipschitz
()¶
-
get_offset
()¶
-
get_quadratic
()¶ Get the quadratic part of the composite.
-
latexify
(var=None, idx='')¶
-
classmethod
linear
(linear_operator, coef=1, diag=False, offset=None, quadratic=None, **kws)¶ Keywords given in kws are passed to cls constructor along with other arguments
-
property
lipschitz
¶
-
nonsmooth_objective
(x, check_feasibility=False)¶
-
objective
(x, check_feasibility=False)¶
-
objective_template
= 'f(%(var)s)'¶
-
objective_vars
= {'linear': 'X'}¶
-
property
offset
¶
-
proximal
(quadratic)¶
-
proximal_optimum
(quadratic)¶
-
proximal_step
(quadratic, prox_control=None)¶ Compute the proximal optimization
- Parameters
prox_control: [None, dict]
If not None, then a dictionary of parameters for the prox procedure
-
property
quadratic
¶ Quadratic part of the object, instance of regreg.identity_quadratic.identity_quadratic.
-
scale
(obj, copy=False)¶
-
set_lipschitz
(value)¶
-
set_offset
(value)¶
-
set_quadratic
(quadratic)¶ Set the quadratic part of the composite.
-
classmethod
shift
(offset, coef=1, quadratic=None, **kws)¶ Keywords given in kws are passed to cls constructor along with other arguments
-
smooth_objective
(arg, mode='both', check_feasibility=False)¶ Compute the smooth objective at the point self.transform.affine_map(arg).
- Parameters
arg : ndarray
The current parameter values.
mode : str
One of [‘func’, ‘grad’, ‘both’].
check_feasibility : bool
If True, return np.inf when point is not feasible, i.e. when beta is not in the domain.
- Returns
If mode is ‘func’ returns just the objective value
at self.transform(arg), else if mode is ‘grad’ returns the gradient
else returns both.
-
smoothed
(smoothing_quadratic)¶ Add quadratic smoothing term
-
solve
(quadratic=None, return_optimum=False, **fit_args)¶
-
smooth_atom
¶
-
class
regreg.smooth.
smooth_atom
(shape, coef=1, offset=None, quadratic=None, initial=None)¶ Bases:
regreg.problems.composite.smooth
A class for representing a smooth function and its gradient
- Parameters
shape : tuple
Shape of argument to smooth_objective
coef : float (optional)
Scalar multiple to be applied (must be nonnegative)
offset : ndarray (optional)
Vector to be subtracted before evaluating smooth_objective.
quadratic : identity_quadratic (optional)
Instance of identity_quadratic to be added to overall objective.
initial : ndarray (optional)
Initial value for coefficients.
-
__init__
(shape, coef=1, offset=None, quadratic=None, initial=None)¶ Initialize self. See help(type(self)) for accurate signature.
-
classmethod
affine
(linear_operator, offset, coef=1, diag=False, quadratic=None, **kws)¶ Keywords given in kws are passed to cls constructor along with other arguments
-
apply_offset
(x)¶ If self.offset is not None, return x-self.offset, else return x.
-
property
conjugate
¶
-
get_conjugate
()¶
-
get_lipschitz
()¶
-
get_offset
()¶
-
get_quadratic
()¶ Get the quadratic part of the composite.
-
latexify
(var=None, idx='')¶
-
classmethod
linear
(linear_operator, coef=1, diag=False, offset=None, quadratic=None, **kws)¶ Keywords given in kws are passed to cls constructor along with other arguments
-
property
lipschitz
¶
-
nonsmooth_objective
(x, check_feasibility=False)¶
-
objective
(x, check_feasibility=False)¶
-
objective_template
= 'f(%(var)s)'¶
-
objective_vars
= {'coef': 'C', 'offset': '\\alpha+', 'shape': 'p', 'var': '\\beta'}¶
-
property
offset
¶
-
proximal
(quadratic)¶
-
proximal_optimum
(quadratic)¶
-
proximal_step
(quadratic, prox_control=None)¶ Compute the proximal optimization
- Parameters
prox_control: [None, dict]
If not None, then a dictionary of parameters for the prox procedure
-
property
quadratic
¶ Quadratic part of the object, instance of regreg.identity_quadratic.identity_quadratic.
-
scale
(obj, copy=False)¶
-
set_lipschitz
(value)¶
-
set_offset
(value)¶
-
set_quadratic
(quadratic)¶ Set the quadratic part of the composite.
-
classmethod
shift
(offset, coef=1, quadratic=None, **kws)¶ Keywords given in kws are passed to cls constructor along with other arguments
-
smooth_objective
(arg, mode='both', check_feasibility=False)¶ - Parameters
arg : ndarray
The current parameter values.
mode : str
One of [‘func’, ‘grad’, ‘both’].
check_feasibility : bool
If True, return np.inf when point is not feasible, i.e. when beta is not in the domain.
- Returns
If mode is ‘func’ returns just the objective value
at beta, else if mode is ‘grad’ returns the gradient
else returns both.
-
smoothed
(smoothing_quadratic)¶ Add quadratic smoothing term
-
solve
(quadratic=None, return_optimum=False, **fit_args)¶
sum
¶
-
class
regreg.smooth.
sum
(atoms, weights=None)¶ Bases:
regreg.smooth.smooth_atom
A simple way to combine smooth objectives
-
__init__
(atoms, weights=None)¶ - Parameters
atoms : sequence
A sequence of regreg.smooth.smooth_atom that will be summed to make a new atom.
weights : ndarray (optional)
If provided, these weights will appear as coefficients in front of each atom.
-
classmethod
affine
(linear_operator, offset, coef=1, diag=False, quadratic=None, **kws)¶ Keywords given in kws are passed to cls constructor along with other arguments
-
apply_offset
(x)¶ If self.offset is not None, return x-self.offset, else return x.
-
property
conjugate
¶
-
get_conjugate
()¶
-
get_lipschitz
()¶
-
get_offset
()¶
-
get_quadratic
()¶ Get the quadratic part of the composite.
-
latexify
(var=None, idx='')¶
-
classmethod
linear
(linear_operator, coef=1, diag=False, offset=None, quadratic=None, **kws)¶ Keywords given in kws are passed to cls constructor along with other arguments
-
property
lipschitz
¶
-
nonsmooth_objective
(x, check_feasibility=False)¶
-
objective
(x, check_feasibility=False)¶
-
objective_template
= 'f(%(var)s)'¶
-
objective_vars
= {'coef': 'C', 'offset': '\\alpha+', 'shape': 'p', 'var': '\\beta'}¶
-
property
offset
¶
-
proximal
(quadratic)¶
-
proximal_optimum
(quadratic)¶
-
proximal_step
(quadratic, prox_control=None)¶ Compute the proximal optimization
- Parameters
prox_control: [None, dict]
If not None, then a dictionary of parameters for the prox procedure
-
property
quadratic
¶ Quadratic part of the object, instance of regreg.identity_quadratic.identity_quadratic.
-
scale
(obj, copy=False)¶
-
set_lipschitz
(value)¶
-
set_offset
(value)¶
-
set_quadratic
(quadratic)¶ Set the quadratic part of the composite.
-
classmethod
shift
(offset, coef=1, quadratic=None, **kws)¶ Keywords given in kws are passed to cls constructor along with other arguments
-
smooth_objective
(x, mode='both', check_feasibility=False)¶ Compute the smooth objective at the point self.transform.affine_map(arg), which is the sum of each atom’s objective with its respective weight.
- Parameters
arg : ndarray
The current parameter values.
mode : str
One of [‘func’, ‘grad’, ‘both’].
check_feasibility : bool
If True, return np.inf when point is not feasible, i.e. when beta is not in the domain.
- Returns
If mode is ‘func’ returns just the objective value
at self.transform(arg), else if mode is ‘grad’ returns the gradient
else returns both.
-
smoothed
(smoothing_quadratic)¶ Add quadratic smoothing term
-
solve
(quadratic=None, return_optimum=False, **fit_args)¶
-
zero
¶
-
class
regreg.smooth.
zero
(shape, coef=1, offset=None, quadratic=None, initial=None)¶ Bases:
regreg.smooth.smooth_atom
The zero function.
-
__init__
(shape, coef=1, offset=None, quadratic=None, initial=None)¶ Initialize self. See help(type(self)) for accurate signature.
-
classmethod
affine
(linear_operator, offset, coef=1, diag=False, quadratic=None, **kws)¶ Keywords given in kws are passed to cls constructor along with other arguments
-
apply_offset
(x)¶ If self.offset is not None, return x-self.offset, else return x.
-
property
conjugate
¶
-
get_conjugate
()¶
-
get_lipschitz
()¶
-
get_offset
()¶
-
get_quadratic
()¶ Get the quadratic part of the composite.
-
latexify
(var=None, idx='')¶
-
classmethod
linear
(linear_operator, coef=1, diag=False, offset=None, quadratic=None, **kws)¶ Keywords given in kws are passed to cls constructor along with other arguments
-
property
lipschitz
¶
-
nonsmooth_objective
(x, check_feasibility=False)¶
-
objective
(x, check_feasibility=False)¶
-
objective_template
= 'f(%(var)s)'¶
-
objective_vars
= {'coef': 'C', 'offset': '\\alpha+', 'shape': 'p', 'var': '\\beta'}¶
-
property
offset
¶
-
proximal
(quadratic)¶
-
proximal_optimum
(quadratic)¶
-
proximal_step
(quadratic, prox_control=None)¶ Compute the proximal optimization
- Parameters
prox_control: [None, dict]
If not None, then a dictionary of parameters for the prox procedure
-
property
quadratic
¶ Quadratic part of the object, instance of regreg.identity_quadratic.identity_quadratic.
-
scale
(obj, copy=False)¶
-
set_lipschitz
(value)¶
-
set_offset
(value)¶
-
set_quadratic
(quadratic)¶ Set the quadratic part of the composite.
-
classmethod
shift
(offset, coef=1, quadratic=None, **kws)¶ Keywords given in kws are passed to cls constructor along with other arguments
-
smooth_objective
(x, mode='both', check_feasibility=False)¶ - Parameters
arg : ndarray
The current parameter values.
mode : str
One of [‘func’, ‘grad’, ‘both’].
check_feasibility : bool
If True, return np.inf when point is not feasible, i.e. when beta is not in the domain.
- Returns
If mode is ‘func’ returns just the objective value
at beta, else if mode is ‘grad’ returns the gradient
else returns both.
-
smoothed
(smoothing_quadratic)¶ Add quadratic smoothing term
-
solve
(quadratic=None, return_optimum=False, **fit_args)¶
-