atoms.cones¶
Module: atoms.cones¶
Inheritance diagram for regreg.atoms.cones:
Classes¶
affine_cone¶
- 
class regreg.atoms.cones.affine_cone(atom_obj, atransform)¶
- Bases: - regreg.atoms.affine_atom- 
__init__(atom_obj, atransform)¶
- Initialize self. See help(type(self)) for accurate signature. 
 - 
property dual¶
 - 
latexify(var=None, idx='')¶
- Return a LaTeX representation of an object. - >>> from regreg.api import l1norm >>> penalty = l1norm(10, lagrange=0.9) >>> penalty.latexify(var=r'\gamma') '\\lambda_{} \\|\\gamma\\|_1' - Parameters
- var : string - Argument of the functions - idx : string - Optional subscript index. 
- Returns
- L : string - A LaTeX representation of the atom. 
 
 - 
nonsmooth_objective(arg, check_feasibility=False)¶
- Return self.atom.seminorm(self.linear_transform.linear_map(x)) 
 - 
objective_vars= {'linear': 'X'}¶
 - 
smoothed(smoothing_quadratic)¶
- Add quadratic smoothing term 
 
- 
cone¶
- 
class regreg.atoms.cones.cone(shape, offset=None, quadratic=None, initial=None)¶
- Bases: - regreg.atoms.atom- A class that defines the API for cone constraints. - 
__init__(shape, offset=None, quadratic=None, initial=None)¶
- Initialize self. See help(type(self)) for accurate signature. 
 - 
classmethod affine(linear_operator, offset, diag=False, quadratic=None)¶
 - 
apply_offset(x)¶
- If self.offset is not None, return x-self.offset, else return x. 
 - 
static check_subgradient(atom, prox_center)¶
- For a given seminorm, verify the KKT condition for the problem for the proximal problem \[\text{minimize}_u \frac{1}{2} \|u-z\|^2_2 + h(z)\]- where \(z\) is the prox_center and \(h\) is atom. - This should return two values that are 0, one is the inner product of the minimizer and the residual, the other is just 0. - Parameters
- atom : cone - A cone instance with a proximal method. - prox_center : np.ndarray(np.float) - Center for the proximal map. 
- Returns
- v1, v2 : float - Two values that should be equal if the proximal map is correct. 
 
 - 
cone_prox(x)¶
- Return (unique) minimizer \[\beta^{\lambda}(u) = \text{argmin}_{\beta \in \mathbb{R}^p} \frac{1}{2} \|\beta-u\|^2_2 + \|\beta\|\]
 - 
property conjugate¶
 - 
constraint(x)¶
- The constraint \[\|\beta\|\]
 - 
property dual¶
 - 
get_conjugate()¶
- Return the conjugate of an given atom. - >>> import regreg.api as rr >>> penalty = rr.nonnegative((30,)) >>> penalty.get_conjugate() nonpositive((30,), offset=None) 
 - 
get_dual()¶
- Return the dual of an atom. This dual is formed by making the substitution \(v=Ax\) where \(A\) is the self.linear_transform. - >>> import regreg.api as rr >>> penalty = rr.nonnegative((30,)) >>> penalty nonnegative((30,), offset=None) >>> penalty.dual (<regreg.affine.identity object at 0x...>, nonpositive((30,), offset=None)) - If there is a linear part to the penalty, the linear_transform may not be identity: - >>> D = (np.identity(4) + np.diag(-np.ones(3),1))[:-1] >>> D array([[ 1., -1., 0., 0.], [ 0., 1., -1., 0.], [ 0., 0., 1., -1.]]) >>> linear_atom = rr.nonnegative.linear(D) >>> linear_atom affine_cone(nonnegative((3,), offset=None), array([[ 1., -1., 0., 0.], [ 0., 1., -1., 0.], [ 0., 0., 1., -1.]])) >>> linear_atom.dual (<regreg.affine.linear_transform object at 0x...>, nonpositive((3,), offset=None)) 
 - 
get_offset()¶
 - 
get_quadratic()¶
- Get the quadratic part of the composite. 
 - 
latexify(var=None, idx='')¶
 - 
classmethod linear(linear_operator, diag=False, offset=None, quadratic=None)¶
 - 
property linear_transform¶
- The linear transform applied before a penalty is computed. Defaults to regreg.affine.identity - >>> from regreg.api import l1norm >>> penalty = l1norm(30, lagrange=3.4) >>> type(penalty.linear_transform) <class 'regreg.affine.identity'> 
 - 
nonsmooth_objective(x, check_feasibility=False)¶
- >>> import regreg.api as rr >>> cone = rr.nonnegative(4) >>> cone.nonsmooth_objective([3, 4, 5, 9]) 0.0 
 - 
objective(x, check_feasibility=False)¶
 - 
objective_template= '\\|%(var)s\\|'¶
 - 
objective_vars= {'coneklass': 'nonnegative', 'dualconeklass': 'nonpositive', 'initargs': '(30,)', 'linear': 'D', 'offset': '\\alpha', 'shape': 'p', 'var': '\\beta'}¶
 - 
property offset¶
 - 
proximal(quadratic, prox_control=None)¶
- The proximal operator. \[v^{\lambda}(x) = \text{argmin}_{v \in \mathbb{R}^{p}} \frac{L}{2} \|x-\alpha - v\|^2_2 + \|\beta\| + \langle v, \eta \rangle\]- where \(\alpha\) is self.offset, \(\eta\) is quadratic.linear_term. - >>> import regreg.api as rr >>> cone = rr.nonnegative((4,)) >>> Q = rr.identity_quadratic(1.5, [3, -4, -1, 1], 0, 0) >>> np.allclose(cone.proximal(Q), [3, 0, 0, 1]) True - Parameters
- quadratic : regreg.identity_quadratic.identity_quadratic - A quadratic added to the atom before minimizing. - prox_control : [None, dict] - This argument is ignored for seminorms, but otherwise is passed to regreg.algorithms.FISTA if the atom needs to be solved iteratively. 
- Returns
- Z : np.ndarray(np.float) - The proximal map of the implied center of 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. 
 - 
set_offset(value)¶
 - 
set_quadratic(quadratic)¶
- Set the quadratic part of the composite. 
 - 
smooth_objective(x, mode='both', check_feasibility=False)¶
- The zero function. 
 - 
smoothed(smoothing_quadratic)¶
- Add quadratic smoothing term 
 - 
solve(quadratic=None, return_optimum=False, **fit_args)¶
 - 
tol= 1e-05¶
 
- 
l1_epigraph¶
- 
class regreg.atoms.cones.l1_epigraph(shape, offset=None, quadratic=None, initial=None)¶
- Bases: - regreg.atoms.cones.cone- The l1_epigraph constraint. - 
__init__(shape, offset=None, quadratic=None, initial=None)¶
- Initialize self. See help(type(self)) for accurate signature. 
 - 
classmethod affine(linear_operator, offset, diag=False, quadratic=None)¶
 - 
apply_offset(x)¶
- If self.offset is not None, return x-self.offset, else return x. 
 - 
static check_subgradient(atom, prox_center)¶
- For a given seminorm, verify the KKT condition for the problem for the proximal problem \[\text{minimize}_u \frac{1}{2} \|u-z\|^2_2 + h(z)\]- where \(z\) is the prox_center and \(h\) is atom. - This should return two values that are 0, one is the inner product of the minimizer and the residual, the other is just 0. - Parameters
- atom : cone - A cone instance with a proximal method. - prox_center : np.ndarray(np.float) - Center for the proximal map. 
- Returns
- v1, v2 : float - Two values that should be equal if the proximal map is correct. 
 
 - 
cone_prox(x)¶
- Return (unique) minimizer \[\beta^{\lambda}(u) = \text{argmin}_{\beta \in \mathbb{R}^p} \frac{1}{2} \|\beta-u\|^2_2 + I^{\infty}(\|\beta[:-1]\|_1 \leq \beta[-1])\]
 - 
property conjugate¶
 - 
constraint(x)¶
- The constraint \[I^{\infty}(\|\beta[:-1]\|_1 \leq \beta[-1])\]
 - 
property dual¶
 - 
get_conjugate()¶
- Return the conjugate of an given atom. - >>> import regreg.api as rr >>> penalty = rr.l1_epigraph_polar((30,)) >>> penalty.get_conjugate() l1_epigraph((30,), offset=None) 
 - 
get_dual()¶
- Return the dual of an atom. This dual is formed by making the substitution \(v=Ax\) where \(A\) is the self.linear_transform. - >>> import regreg.api as rr >>> penalty = rr.l1_epigraph_polar((30,)) >>> penalty l1_epigraph_polar((30,), offset=None) >>> penalty.dual (<regreg.affine.identity object at 0x...>, l1_epigraph((30,), offset=None)) - If there is a linear part to the penalty, the linear_transform may not be identity: - >>> D = (np.identity(4) + np.diag(-np.ones(3),1))[:-1] >>> D array([[ 1., -1., 0., 0.], [ 0., 1., -1., 0.], [ 0., 0., 1., -1.]]) >>> linear_atom = rr.nonnegative.linear(D) >>> linear_atom affine_cone(nonnegative((3,), offset=None), array([[ 1., -1., 0., 0.], [ 0., 1., -1., 0.], [ 0., 0., 1., -1.]])) >>> linear_atom.dual (<regreg.affine.linear_transform object at 0x...>, nonpositive((3,), offset=None)) 
 - 
get_offset()¶
 - 
get_quadratic()¶
- Get the quadratic part of the composite. 
 - 
latexify(var=None, idx='')¶
 - 
classmethod linear(linear_operator, diag=False, offset=None, quadratic=None)¶
 - 
property linear_transform¶
- The linear transform applied before a penalty is computed. Defaults to regreg.affine.identity - >>> from regreg.api import l1norm >>> penalty = l1norm(30, lagrange=3.4) >>> type(penalty.linear_transform) <class 'regreg.affine.identity'> 
 - 
nonsmooth_objective(x, check_feasibility=False)¶
- >>> import regreg.api as rr >>> cone = rr.nonnegative(4) >>> cone.nonsmooth_objective([3, 4, 5, 9]) 0.0 
 - 
objective(x, check_feasibility=False)¶
 - 
objective_template= 'I^{\\infty}(\\|%(var)s[:-1]\\|_1 \\leq %(var)s[-1])'¶
 - 
objective_vars= {'coneklass': 'l1_epigraph_polar', 'dualconeklass': 'l1_epigraph', 'initargs': '(30,)', 'linear': 'D', 'offset': '\\alpha', 'shape': 'p', 'var': '\\beta'}¶
 - 
property offset¶
 - 
proximal(quadratic, prox_control=None)¶
- The proximal operator. \[v^{\lambda}(x) = \text{argmin}_{v \in \mathbb{R}^{p}} \frac{L}{2} \|x-\alpha - v\|^2_2 + I^{\infty}(\|\beta[:-1]\|_1 \leq \beta[-1]) + \langle v, \eta \rangle\]- where \(\alpha\) is self.offset, \(\eta\) is quadratic.linear_term. - >>> import regreg.api as rr >>> cone = rr.nonnegative((4,)) >>> Q = rr.identity_quadratic(1.5, [3, -4, -1, 1], 0, 0) >>> np.allclose(cone.proximal(Q), [3, 0, 0, 1]) True - Parameters
- quadratic : regreg.identity_quadratic.identity_quadratic - A quadratic added to the atom before minimizing. - prox_control : [None, dict] - This argument is ignored for seminorms, but otherwise is passed to regreg.algorithms.FISTA if the atom needs to be solved iteratively. 
- Returns
- Z : np.ndarray(np.float) - The proximal map of the implied center of 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. 
 - 
set_offset(value)¶
 - 
set_quadratic(quadratic)¶
- Set the quadratic part of the composite. 
 - 
smooth_objective(x, mode='both', check_feasibility=False)¶
- The zero function. 
 - 
smoothed(smoothing_quadratic)¶
- Add quadratic smoothing term 
 - 
solve(quadratic=None, return_optimum=False, **fit_args)¶
 - 
tol= 1e-05¶
 
- 
l1_epigraph_polar¶
- 
class regreg.atoms.cones.l1_epigraph_polar(shape, offset=None, quadratic=None, initial=None)¶
- Bases: - regreg.atoms.cones.cone- The polar l1_epigraph constraint. - 
__init__(shape, offset=None, quadratic=None, initial=None)¶
- Initialize self. See help(type(self)) for accurate signature. 
 - 
classmethod affine(linear_operator, offset, diag=False, quadratic=None)¶
 - 
apply_offset(x)¶
- If self.offset is not None, return x-self.offset, else return x. 
 - 
static check_subgradient(atom, prox_center)¶
- For a given seminorm, verify the KKT condition for the problem for the proximal problem \[\text{minimize}_u \frac{1}{2} \|u-z\|^2_2 + h(z)\]- where \(z\) is the prox_center and \(h\) is atom. - This should return two values that are 0, one is the inner product of the minimizer and the residual, the other is just 0. - Parameters
- atom : cone - A cone instance with a proximal method. - prox_center : np.ndarray(np.float) - Center for the proximal map. 
- Returns
- v1, v2 : float - Two values that should be equal if the proximal map is correct. 
 
 - 
cone_prox(arg)¶
- Return (unique) minimizer \[\beta^{\lambda}(u) = \text{argmin}_{\beta \in \mathbb{R}^p} \frac{1}{2} \|\beta-u\|^2_2 + I^{\infty}(\|\beta[:-1]\|_{\infty} \leq - \beta[-1])\]
 - 
property conjugate¶
 - 
constraint(x)¶
- The constraint \[I^{\infty}(\|\beta[:-1]\|_{\infty} \leq - \beta[-1])\]
 - 
property dual¶
 - 
get_conjugate()¶
- Return the conjugate of an given atom. - >>> import regreg.api as rr >>> penalty = rr.l1_epigraph_polar((30,)) >>> penalty.get_conjugate() l1_epigraph((30,), offset=None) 
 - 
get_dual()¶
- Return the dual of an atom. This dual is formed by making the substitution \(v=Ax\) where \(A\) is the self.linear_transform. - >>> import regreg.api as rr >>> penalty = rr.l1_epigraph_polar((30,)) >>> penalty l1_epigraph_polar((30,), offset=None) >>> penalty.dual (<regreg.affine.identity object at 0x...>, l1_epigraph((30,), offset=None)) - If there is a linear part to the penalty, the linear_transform may not be identity: - >>> D = (np.identity(4) + np.diag(-np.ones(3),1))[:-1] >>> D array([[ 1., -1., 0., 0.], [ 0., 1., -1., 0.], [ 0., 0., 1., -1.]]) >>> linear_atom = rr.nonnegative.linear(D) >>> linear_atom affine_cone(nonnegative((3,), offset=None), array([[ 1., -1., 0., 0.], [ 0., 1., -1., 0.], [ 0., 0., 1., -1.]])) >>> linear_atom.dual (<regreg.affine.linear_transform object at 0x...>, nonpositive((3,), offset=None)) 
 - 
get_offset()¶
 - 
get_quadratic()¶
- Get the quadratic part of the composite. 
 - 
latexify(var=None, idx='')¶
 - 
classmethod linear(linear_operator, diag=False, offset=None, quadratic=None)¶
 - 
property linear_transform¶
- The linear transform applied before a penalty is computed. Defaults to regreg.affine.identity - >>> from regreg.api import l1norm >>> penalty = l1norm(30, lagrange=3.4) >>> type(penalty.linear_transform) <class 'regreg.affine.identity'> 
 - 
nonsmooth_objective(x, check_feasibility=False)¶
- >>> import regreg.api as rr >>> cone = rr.nonnegative(4) >>> cone.nonsmooth_objective([3, 4, 5, 9]) 0.0 
 - 
objective(x, check_feasibility=False)¶
 - 
objective_template= 'I^{\\infty}(\\|%(var)s[:-1]\\|_{\\infty} \\leq - %(var)s[-1])'¶
 - 
objective_vars= {'coneklass': 'l1_epigraph_polar', 'dualconeklass': 'l1_epigraph', 'initargs': '(30,)', 'linear': 'D', 'offset': '\\alpha', 'shape': 'p', 'var': '\\beta'}¶
 - 
property offset¶
 - 
proximal(quadratic, prox_control=None)¶
- The proximal operator. \[v^{\lambda}(x) = \text{argmin}_{v \in \mathbb{R}^{p}} \frac{L}{2} \|x-\alpha - v\|^2_2 + I^{\infty}(\|\beta[:-1]\|_{\infty} \leq - \beta[-1]) + \langle v, \eta \rangle\]- where \(\alpha\) is self.offset, \(\eta\) is quadratic.linear_term. - >>> import regreg.api as rr >>> cone = rr.nonnegative((4,)) >>> Q = rr.identity_quadratic(1.5, [3, -4, -1, 1], 0, 0) >>> np.allclose(cone.proximal(Q), [3, 0, 0, 1]) True - Parameters
- quadratic : regreg.identity_quadratic.identity_quadratic - A quadratic added to the atom before minimizing. - prox_control : [None, dict] - This argument is ignored for seminorms, but otherwise is passed to regreg.algorithms.FISTA if the atom needs to be solved iteratively. 
- Returns
- Z : np.ndarray(np.float) - The proximal map of the implied center of 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. 
 - 
set_offset(value)¶
 - 
set_quadratic(quadratic)¶
- Set the quadratic part of the composite. 
 - 
smooth_objective(x, mode='both', check_feasibility=False)¶
- The zero function. 
 - 
smoothed(smoothing_quadratic)¶
- Add quadratic smoothing term 
 - 
solve(quadratic=None, return_optimum=False, **fit_args)¶
 - 
tol= 1e-05¶
 
- 
l2_epigraph¶
- 
class regreg.atoms.cones.l2_epigraph(shape, offset=None, quadratic=None, initial=None)¶
- Bases: - regreg.atoms.cones.cone- The l2_epigraph constraint. - 
__init__(shape, offset=None, quadratic=None, initial=None)¶
- Initialize self. See help(type(self)) for accurate signature. 
 - 
classmethod affine(linear_operator, offset, diag=False, quadratic=None)¶
 - 
apply_offset(x)¶
- If self.offset is not None, return x-self.offset, else return x. 
 - 
static check_subgradient(atom, prox_center)¶
- For a given seminorm, verify the KKT condition for the problem for the proximal problem \[\text{minimize}_u \frac{1}{2} \|u-z\|^2_2 + h(z)\]- where \(z\) is the prox_center and \(h\) is atom. - This should return two values that are 0, one is the inner product of the minimizer and the residual, the other is just 0. - Parameters
- atom : cone - A cone instance with a proximal method. - prox_center : np.ndarray(np.float) - Center for the proximal map. 
- Returns
- v1, v2 : float - Two values that should be equal if the proximal map is correct. 
 
 - 
cone_prox(x)¶
- Return (unique) minimizer \[\beta^{\lambda}(u) = \text{argmin}_{\beta \in \mathbb{R}^p} \frac{1}{2} \|\beta-u\|^2_2 + I^{\infty}(\|\beta[:-1]\|_2 \leq \beta[-1])\]
 - 
property conjugate¶
 - 
constraint(x)¶
- The constraint \[I^{\infty}(\|\beta[:-1]\|_2 \leq \beta[-1])\]
 - 
property dual¶
 - 
get_conjugate()¶
- Return the conjugate of an given atom. - >>> import regreg.api as rr >>> penalty = rr.l2_epigraph((30,)) >>> penalty.get_conjugate() l2_epigraph_polar((30,), offset=None) 
 - 
get_dual()¶
- Return the dual of an atom. This dual is formed by making the substitution \(v=Ax\) where \(A\) is the self.linear_transform. - >>> import regreg.api as rr >>> penalty = rr.l2_epigraph((30,)) >>> penalty l2_epigraph((30,), offset=None) >>> penalty.dual (<regreg.affine.identity object at 0x...>, l2_epigraph_polar((30,), offset=None)) - If there is a linear part to the penalty, the linear_transform may not be identity: - >>> D = (np.identity(4) + np.diag(-np.ones(3),1))[:-1] >>> D array([[ 1., -1., 0., 0.], [ 0., 1., -1., 0.], [ 0., 0., 1., -1.]]) >>> linear_atom = rr.nonnegative.linear(D) >>> linear_atom affine_cone(nonnegative((3,), offset=None), array([[ 1., -1., 0., 0.], [ 0., 1., -1., 0.], [ 0., 0., 1., -1.]])) >>> linear_atom.dual (<regreg.affine.linear_transform object at 0x...>, nonpositive((3,), offset=None)) 
 - 
get_offset()¶
 - 
get_quadratic()¶
- Get the quadratic part of the composite. 
 - 
latexify(var=None, idx='')¶
 - 
classmethod linear(linear_operator, diag=False, offset=None, quadratic=None)¶
 - 
property linear_transform¶
- The linear transform applied before a penalty is computed. Defaults to regreg.affine.identity - >>> from regreg.api import l1norm >>> penalty = l1norm(30, lagrange=3.4) >>> type(penalty.linear_transform) <class 'regreg.affine.identity'> 
 - 
nonsmooth_objective(x, check_feasibility=False)¶
- >>> import regreg.api as rr >>> cone = rr.nonnegative(4) >>> cone.nonsmooth_objective([3, 4, 5, 9]) 0.0 
 - 
objective(x, check_feasibility=False)¶
 - 
objective_template= 'I^{\\infty}(\\|%(var)s[:-1]\\|_2 \\leq %(var)s[-1])'¶
 - 
objective_vars= {'coneklass': 'l2_epigraph', 'dualconeklass': 'l2_epigraph_polar', 'initargs': '(30,)', 'linear': 'D', 'offset': '\\alpha', 'shape': 'p', 'var': '\\beta'}¶
 - 
property offset¶
 - 
proximal(quadratic, prox_control=None)¶
- The proximal operator. \[v^{\lambda}(x) = \text{argmin}_{v \in \mathbb{R}^{p}} \frac{L}{2} \|x-\alpha - v\|^2_2 + I^{\infty}(\|\beta[:-1]\|_2 \leq \beta[-1]) + \langle v, \eta \rangle\]- where \(\alpha\) is self.offset, \(\eta\) is quadratic.linear_term. - >>> import regreg.api as rr >>> cone = rr.nonnegative((4,)) >>> Q = rr.identity_quadratic(1.5, [3, -4, -1, 1], 0, 0) >>> np.allclose(cone.proximal(Q), [3, 0, 0, 1]) True - Parameters
- quadratic : regreg.identity_quadratic.identity_quadratic - A quadratic added to the atom before minimizing. - prox_control : [None, dict] - This argument is ignored for seminorms, but otherwise is passed to regreg.algorithms.FISTA if the atom needs to be solved iteratively. 
- Returns
- Z : np.ndarray(np.float) - The proximal map of the implied center of 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. 
 - 
set_offset(value)¶
 - 
set_quadratic(quadratic)¶
- Set the quadratic part of the composite. 
 - 
smooth_objective(x, mode='both', check_feasibility=False)¶
- The zero function. 
 - 
smoothed(smoothing_quadratic)¶
- Add quadratic smoothing term 
 - 
solve(quadratic=None, return_optimum=False, **fit_args)¶
 - 
tol= 1e-05¶
 
- 
l2_epigraph_polar¶
- 
class regreg.atoms.cones.l2_epigraph_polar(shape, offset=None, quadratic=None, initial=None)¶
- Bases: - regreg.atoms.cones.cone- The polar of the l2_epigraph constraint, which is the negative of the l2 epigraph.. - 
__init__(shape, offset=None, quadratic=None, initial=None)¶
- Initialize self. See help(type(self)) for accurate signature. 
 - 
classmethod affine(linear_operator, offset, diag=False, quadratic=None)¶
 - 
apply_offset(x)¶
- If self.offset is not None, return x-self.offset, else return x. 
 - 
static check_subgradient(atom, prox_center)¶
- For a given seminorm, verify the KKT condition for the problem for the proximal problem \[\text{minimize}_u \frac{1}{2} \|u-z\|^2_2 + h(z)\]- where \(z\) is the prox_center and \(h\) is atom. - This should return two values that are 0, one is the inner product of the minimizer and the residual, the other is just 0. - Parameters
- atom : cone - A cone instance with a proximal method. - prox_center : np.ndarray(np.float) - Center for the proximal map. 
- Returns
- v1, v2 : float - Two values that should be equal if the proximal map is correct. 
 
 - 
cone_prox(arg)¶
- Return (unique) minimizer \[\beta^{\lambda}(u) = \text{argmin}_{\beta \in \mathbb{R}^p} \frac{1}{2} \|\beta-u\|^2_2 + I^{\infty}(\|\beta[:-1]\|_2 \in -\beta[-1])\]
 - 
property conjugate¶
 - 
constraint(x)¶
- The constraint \[I^{\infty}(\|\beta[:-1]\|_2 \in -\beta[-1])\]
 - 
property dual¶
 - 
get_conjugate()¶
- Return the conjugate of an given atom. - >>> import regreg.api as rr >>> penalty = rr.l2_epigraph_polar((30,)) >>> penalty.get_conjugate() l2_epigraph((30,), offset=None) 
 - 
get_dual()¶
- Return the dual of an atom. This dual is formed by making the substitution \(v=Ax\) where \(A\) is the self.linear_transform. - >>> import regreg.api as rr >>> penalty = rr.l2_epigraph_polar((30,)) >>> penalty l2_epigraph_polar((30,), offset=None) >>> penalty.dual (<regreg.affine.identity object at 0x...>, l2_epigraph((30,), offset=None)) - If there is a linear part to the penalty, the linear_transform may not be identity: - >>> D = (np.identity(4) + np.diag(-np.ones(3),1))[:-1] >>> D array([[ 1., -1., 0., 0.], [ 0., 1., -1., 0.], [ 0., 0., 1., -1.]]) >>> linear_atom = rr.nonnegative.linear(D) >>> linear_atom affine_cone(nonnegative((3,), offset=None), array([[ 1., -1., 0., 0.], [ 0., 1., -1., 0.], [ 0., 0., 1., -1.]])) >>> linear_atom.dual (<regreg.affine.linear_transform object at 0x...>, nonpositive((3,), offset=None)) 
 - 
get_offset()¶
 - 
get_quadratic()¶
- Get the quadratic part of the composite. 
 - 
latexify(var=None, idx='')¶
 - 
classmethod linear(linear_operator, diag=False, offset=None, quadratic=None)¶
 - 
property linear_transform¶
- The linear transform applied before a penalty is computed. Defaults to regreg.affine.identity - >>> from regreg.api import l1norm >>> penalty = l1norm(30, lagrange=3.4) >>> type(penalty.linear_transform) <class 'regreg.affine.identity'> 
 - 
nonsmooth_objective(x, check_feasibility=False)¶
- >>> import regreg.api as rr >>> cone = rr.nonnegative(4) >>> cone.nonsmooth_objective([3, 4, 5, 9]) 0.0 
 - 
objective(x, check_feasibility=False)¶
 - 
objective_template= 'I^{\\infty}(\\|%(var)s[:-1]\\|_2 \\in -%(var)s[-1])'¶
 - 
objective_vars= {'coneklass': 'l2_epigraph_polar', 'dualconeklass': 'l2_epigraph', 'initargs': '(30,)', 'linear': 'D', 'offset': '\\alpha', 'shape': 'p', 'var': '\\beta'}¶
 - 
property offset¶
 - 
proximal(quadratic, prox_control=None)¶
- The proximal operator. \[v^{\lambda}(x) = \text{argmin}_{v \in \mathbb{R}^{p}} \frac{L}{2} \|x-\alpha - v\|^2_2 + I^{\infty}(\|\beta[:-1]\|_2 \in -\beta[-1]) + \langle v, \eta \rangle\]- where \(\alpha\) is self.offset, \(\eta\) is quadratic.linear_term. - >>> import regreg.api as rr >>> cone = rr.nonnegative((4,)) >>> Q = rr.identity_quadratic(1.5, [3, -4, -1, 1], 0, 0) >>> np.allclose(cone.proximal(Q), [3, 0, 0, 1]) True - Parameters
- quadratic : regreg.identity_quadratic.identity_quadratic - A quadratic added to the atom before minimizing. - prox_control : [None, dict] - This argument is ignored for seminorms, but otherwise is passed to regreg.algorithms.FISTA if the atom needs to be solved iteratively. 
- Returns
- Z : np.ndarray(np.float) - The proximal map of the implied center of 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. 
 - 
set_offset(value)¶
 - 
set_quadratic(quadratic)¶
- Set the quadratic part of the composite. 
 - 
smooth_objective(x, mode='both', check_feasibility=False)¶
- The zero function. 
 - 
smoothed(smoothing_quadratic)¶
- Add quadratic smoothing term 
 - 
solve(quadratic=None, return_optimum=False, **fit_args)¶
 - 
tol= 1e-05¶
 
- 
linf_epigraph¶
- 
class regreg.atoms.cones.linf_epigraph(shape, offset=None, quadratic=None, initial=None)¶
- Bases: - regreg.atoms.cones.cone- The :math:`ell_{ - fty}` epigraph constraint. - 
__init__(shape, offset=None, quadratic=None, initial=None)¶
- Initialize self. See help(type(self)) for accurate signature. 
 - 
classmethod affine(linear_operator, offset, diag=False, quadratic=None)¶
 - 
apply_offset(x)¶
- If self.offset is not None, return x-self.offset, else return x. 
 - 
static check_subgradient(atom, prox_center)¶
- For a given seminorm, verify the KKT condition for the problem for the proximal problem \[\text{minimize}_u \frac{1}{2} \|u-z\|^2_2 + h(z)\]- where \(z\) is the prox_center and \(h\) is atom. - This should return two values that are 0, one is the inner product of the minimizer and the residual, the other is just 0. - Parameters
- atom : cone - A cone instance with a proximal method. - prox_center : np.ndarray(np.float) - Center for the proximal map. 
- Returns
- v1, v2 : float - Two values that should be equal if the proximal map is correct. 
 
 - 
cone_prox(arg)¶
- Return (unique) minimizer \[\beta^{\lambda}(u) = \text{argmin}_{\beta \in \mathbb{R}^p} \frac{1}{2} \|\beta-u\|^2_2 + I^{\infty}(\|\beta[:-1]\|_{\infty} \leq \beta[-1])\]
 - 
property conjugate¶
 - 
constraint(x)¶
- The constraint \[I^{\infty}(\|\beta[:-1]\|_{\infty} \leq \beta[-1])\]
 - 
property dual¶
 - 
get_conjugate()¶
- Return the conjugate of an given atom. - >>> import regreg.api as rr >>> penalty = rr.linf_epigraph((30,)) >>> penalty.get_conjugate() linf_epigraph_polar((30,), offset=None) 
 - 
get_dual()¶
- Return the dual of an atom. This dual is formed by making the substitution \(v=Ax\) where \(A\) is the self.linear_transform. - >>> import regreg.api as rr >>> penalty = rr.linf_epigraph((30,)) >>> penalty linf_epigraph((30,), offset=None) >>> penalty.dual (<regreg.affine.identity object at 0x...>, linf_epigraph_polar((30,), offset=None)) - If there is a linear part to the penalty, the linear_transform may not be identity: - >>> D = (np.identity(4) + np.diag(-np.ones(3),1))[:-1] >>> D array([[ 1., -1., 0., 0.], [ 0., 1., -1., 0.], [ 0., 0., 1., -1.]]) >>> linear_atom = rr.nonnegative.linear(D) >>> linear_atom affine_cone(nonnegative((3,), offset=None), array([[ 1., -1., 0., 0.], [ 0., 1., -1., 0.], [ 0., 0., 1., -1.]])) >>> linear_atom.dual (<regreg.affine.linear_transform object at 0x...>, nonpositive((3,), offset=None)) 
 - 
get_offset()¶
 - 
get_quadratic()¶
- Get the quadratic part of the composite. 
 - 
latexify(var=None, idx='')¶
 - 
classmethod linear(linear_operator, diag=False, offset=None, quadratic=None)¶
 - 
property linear_transform¶
- The linear transform applied before a penalty is computed. Defaults to regreg.affine.identity - >>> from regreg.api import l1norm >>> penalty = l1norm(30, lagrange=3.4) >>> type(penalty.linear_transform) <class 'regreg.affine.identity'> 
 - 
nonsmooth_objective(x, check_feasibility=False)¶
- >>> import regreg.api as rr >>> cone = rr.nonnegative(4) >>> cone.nonsmooth_objective([3, 4, 5, 9]) 0.0 
 - 
objective(x, check_feasibility=False)¶
 - 
objective_template= 'I^{\\infty}(\\|%(var)s[:-1]\\|_{\\infty} \\leq %(var)s[-1])'¶
 - 
objective_vars= {'coneklass': 'linf_epigraph', 'dualconeklass': 'linf_epigraph_polar', 'initargs': '(30,)', 'linear': 'D', 'offset': '\\alpha', 'shape': 'p', 'var': '\\beta'}¶
 - 
property offset¶
 - 
proximal(quadratic, prox_control=None)¶
- The proximal operator. \[v^{\lambda}(x) = \text{argmin}_{v \in \mathbb{R}^{p}} \frac{L}{2} \|x-\alpha - v\|^2_2 + I^{\infty}(\|\beta[:-1]\|_{\infty} \leq \beta[-1]) + \langle v, \eta \rangle\]- where \(\alpha\) is self.offset, \(\eta\) is quadratic.linear_term. - >>> import regreg.api as rr >>> cone = rr.nonnegative((4,)) >>> Q = rr.identity_quadratic(1.5, [3, -4, -1, 1], 0, 0) >>> np.allclose(cone.proximal(Q), [3, 0, 0, 1]) True - Parameters
- quadratic : regreg.identity_quadratic.identity_quadratic - A quadratic added to the atom before minimizing. - prox_control : [None, dict] - This argument is ignored for seminorms, but otherwise is passed to regreg.algorithms.FISTA if the atom needs to be solved iteratively. 
- Returns
- Z : np.ndarray(np.float) - The proximal map of the implied center of 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. 
 - 
set_offset(value)¶
 - 
set_quadratic(quadratic)¶
- Set the quadratic part of the composite. 
 - 
smooth_objective(x, mode='both', check_feasibility=False)¶
- The zero function. 
 - 
smoothed(smoothing_quadratic)¶
- Add quadratic smoothing term 
 - 
solve(quadratic=None, return_optimum=False, **fit_args)¶
 - 
tol= 1e-05¶
 
- 
linf_epigraph_polar¶
- 
class regreg.atoms.cones.linf_epigraph_polar(shape, offset=None, quadratic=None, initial=None)¶
- Bases: - regreg.atoms.cones.cone- The polar linf_epigraph constraint which is just the negative of the l1_epigraph. - 
__init__(shape, offset=None, quadratic=None, initial=None)¶
- Initialize self. See help(type(self)) for accurate signature. 
 - 
classmethod affine(linear_operator, offset, diag=False, quadratic=None)¶
 - 
apply_offset(x)¶
- If self.offset is not None, return x-self.offset, else return x. 
 - 
static check_subgradient(atom, prox_center)¶
- For a given seminorm, verify the KKT condition for the problem for the proximal problem \[\text{minimize}_u \frac{1}{2} \|u-z\|^2_2 + h(z)\]- where \(z\) is the prox_center and \(h\) is atom. - This should return two values that are 0, one is the inner product of the minimizer and the residual, the other is just 0. - Parameters
- atom : cone - A cone instance with a proximal method. - prox_center : np.ndarray(np.float) - Center for the proximal map. 
- Returns
- v1, v2 : float - Two values that should be equal if the proximal map is correct. 
 
 - 
cone_prox(arg)¶
- Return (unique) minimizer \[\beta^{\lambda}(u) = \text{argmin}_{\beta \in \mathbb{R}^p} \frac{1}{2} \|\beta-u\|^2_2 + I^{\infty}(\|\beta[:-1]\|_1 \leq -\beta[-1])\]
 - 
property conjugate¶
 - 
constraint(x)¶
- The constraint \[I^{\infty}(\|\beta[:-1]\|_1 \leq -\beta[-1])\]
 - 
property dual¶
 - 
get_conjugate()¶
- Return the conjugate of an given atom. - >>> import regreg.api as rr >>> penalty = rr.linf_epigraph_polar((30,)) >>> penalty.get_conjugate() linf_epigraph((30,), offset=None) 
 - 
get_dual()¶
- Return the dual of an atom. This dual is formed by making the substitution \(v=Ax\) where \(A\) is the self.linear_transform. - >>> import regreg.api as rr >>> penalty = rr.linf_epigraph_polar((30,)) >>> penalty linf_epigraph_polar((30,), offset=None) >>> penalty.dual (<regreg.affine.identity object at 0x...>, linf_epigraph((30,), offset=None)) - If there is a linear part to the penalty, the linear_transform may not be identity: - >>> D = (np.identity(4) + np.diag(-np.ones(3),1))[:-1] >>> D array([[ 1., -1., 0., 0.], [ 0., 1., -1., 0.], [ 0., 0., 1., -1.]]) >>> linear_atom = rr.nonnegative.linear(D) >>> linear_atom affine_cone(nonnegative((3,), offset=None), array([[ 1., -1., 0., 0.], [ 0., 1., -1., 0.], [ 0., 0., 1., -1.]])) >>> linear_atom.dual (<regreg.affine.linear_transform object at 0x...>, nonpositive((3,), offset=None)) 
 - 
get_offset()¶
 - 
get_quadratic()¶
- Get the quadratic part of the composite. 
 - 
latexify(var=None, idx='')¶
 - 
classmethod linear(linear_operator, diag=False, offset=None, quadratic=None)¶
 - 
property linear_transform¶
- The linear transform applied before a penalty is computed. Defaults to regreg.affine.identity - >>> from regreg.api import l1norm >>> penalty = l1norm(30, lagrange=3.4) >>> type(penalty.linear_transform) <class 'regreg.affine.identity'> 
 - 
nonsmooth_objective(x, check_feasibility=False)¶
- >>> import regreg.api as rr >>> cone = rr.nonnegative(4) >>> cone.nonsmooth_objective([3, 4, 5, 9]) 0.0 
 - 
objective(x, check_feasibility=False)¶
 - 
objective_template= 'I^{\\infty}(\\|%(var)s[:-1]\\|_1 \\leq -%(var)s[-1])'¶
 - 
objective_vars= {'coneklass': 'linf_epigraph_polar', 'dualconeklass': 'linf_epigraph', 'initargs': '(30,)', 'linear': 'D', 'offset': '\\alpha', 'shape': 'p', 'var': '\\beta'}¶
 - 
property offset¶
 - 
proximal(quadratic, prox_control=None)¶
- The proximal operator. \[v^{\lambda}(x) = \text{argmin}_{v \in \mathbb{R}^{p}} \frac{L}{2} \|x-\alpha - v\|^2_2 + I^{\infty}(\|\beta[:-1]\|_1 \leq -\beta[-1]) + \langle v, \eta \rangle\]- where \(\alpha\) is self.offset, \(\eta\) is quadratic.linear_term. - >>> import regreg.api as rr >>> cone = rr.nonnegative((4,)) >>> Q = rr.identity_quadratic(1.5, [3, -4, -1, 1], 0, 0) >>> np.allclose(cone.proximal(Q), [3, 0, 0, 1]) True - Parameters
- quadratic : regreg.identity_quadratic.identity_quadratic - A quadratic added to the atom before minimizing. - prox_control : [None, dict] - This argument is ignored for seminorms, but otherwise is passed to regreg.algorithms.FISTA if the atom needs to be solved iteratively. 
- Returns
- Z : np.ndarray(np.float) - The proximal map of the implied center of 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. 
 - 
set_offset(value)¶
 - 
set_quadratic(quadratic)¶
- Set the quadratic part of the composite. 
 - 
smooth_objective(x, mode='both', check_feasibility=False)¶
- The zero function. 
 - 
smoothed(smoothing_quadratic)¶
- Add quadratic smoothing term 
 - 
solve(quadratic=None, return_optimum=False, **fit_args)¶
 - 
tol= 1e-05¶
 
- 
nonnegative¶
- 
class regreg.atoms.cones.nonnegative(shape, offset=None, quadratic=None, initial=None)¶
- Bases: - regreg.atoms.cones.cone- The non-negative cone constraint (which is the support function of the non-positive cone constraint). - 
__init__(shape, offset=None, quadratic=None, initial=None)¶
- Initialize self. See help(type(self)) for accurate signature. 
 - 
classmethod affine(linear_operator, offset, diag=False, quadratic=None)¶
 - 
apply_offset(x)¶
- If self.offset is not None, return x-self.offset, else return x. 
 - 
static check_subgradient(atom, prox_center)¶
- For a given seminorm, verify the KKT condition for the problem for the proximal problem \[\text{minimize}_u \frac{1}{2} \|u-z\|^2_2 + h(z)\]- where \(z\) is the prox_center and \(h\) is atom. - This should return two values that are 0, one is the inner product of the minimizer and the residual, the other is just 0. - Parameters
- atom : cone - A cone instance with a proximal method. - prox_center : np.ndarray(np.float) - Center for the proximal map. 
- Returns
- v1, v2 : float - Two values that should be equal if the proximal map is correct. 
 
 - 
cone_prox(x)¶
- Return (unique) minimizer \[\beta^{\lambda}(u) = \text{argmin}_{\beta \in \mathbb{R}^p} \frac{1}{2} \|\beta-u\|^2_2 + I^{\infty}(\beta \succeq 0)\]
 - 
property conjugate¶
 - 
constraint(x)¶
- The constraint \[I^{\infty}(\beta \succeq 0)\]
 - 
property dual¶
 - 
get_conjugate()¶
- Return the conjugate of an given atom. - >>> import regreg.api as rr >>> penalty = rr.nonnegative((30,)) >>> penalty.get_conjugate() nonpositive((30,), offset=None) 
 - 
get_dual()¶
- Return the dual of an atom. This dual is formed by making the substitution \(v=Ax\) where \(A\) is the self.linear_transform. - >>> import regreg.api as rr >>> penalty = rr.nonnegative((30,)) >>> penalty nonnegative((30,), offset=None) >>> penalty.dual (<regreg.affine.identity object at 0x...>, nonpositive((30,), offset=None)) - If there is a linear part to the penalty, the linear_transform may not be identity: - >>> D = (np.identity(4) + np.diag(-np.ones(3),1))[:-1] >>> D array([[ 1., -1., 0., 0.], [ 0., 1., -1., 0.], [ 0., 0., 1., -1.]]) >>> linear_atom = rr.nonnegative.linear(D) >>> linear_atom affine_cone(nonnegative((3,), offset=None), array([[ 1., -1., 0., 0.], [ 0., 1., -1., 0.], [ 0., 0., 1., -1.]])) >>> linear_atom.dual (<regreg.affine.linear_transform object at 0x...>, nonpositive((3,), offset=None)) 
 - 
get_offset()¶
 - 
get_quadratic()¶
- Get the quadratic part of the composite. 
 - 
latexify(var=None, idx='')¶
 - 
classmethod linear(linear_operator, diag=False, offset=None, quadratic=None)¶
 - 
property linear_transform¶
- The linear transform applied before a penalty is computed. Defaults to regreg.affine.identity - >>> from regreg.api import l1norm >>> penalty = l1norm(30, lagrange=3.4) >>> type(penalty.linear_transform) <class 'regreg.affine.identity'> 
 - 
nonsmooth_objective(x, check_feasibility=False)¶
- >>> import regreg.api as rr >>> cone = rr.nonnegative(4) >>> cone.nonsmooth_objective([3, 4, 5, 9]) 0.0 
 - 
objective(x, check_feasibility=False)¶
 - 
objective_template= 'I^{\\infty}(%(var)s \\succeq 0)'¶
 - 
objective_vars= {'coneklass': 'nonnegative', 'dualconeklass': 'nonpositive', 'initargs': '(30,)', 'linear': 'D', 'offset': '\\alpha', 'shape': 'p', 'var': '\\beta'}¶
 - 
property offset¶
 - 
proximal(quadratic, prox_control=None)¶
- The proximal operator. \[v^{\lambda}(x) = \text{argmin}_{v \in \mathbb{R}^{p}} \frac{L}{2} \|x-\alpha - v\|^2_2 + I^{\infty}(\beta \succeq 0) + \langle v, \eta \rangle\]- where \(\alpha\) is self.offset, \(\eta\) is quadratic.linear_term. - >>> import regreg.api as rr >>> cone = rr.nonnegative((4,)) >>> Q = rr.identity_quadratic(1.5, [3, -4, -1, 1], 0, 0) >>> np.allclose(cone.proximal(Q), [3, 0, 0, 1]) True - Parameters
- quadratic : regreg.identity_quadratic.identity_quadratic - A quadratic added to the atom before minimizing. - prox_control : [None, dict] - This argument is ignored for seminorms, but otherwise is passed to regreg.algorithms.FISTA if the atom needs to be solved iteratively. 
- Returns
- Z : np.ndarray(np.float) - The proximal map of the implied center of 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. 
 - 
set_offset(value)¶
 - 
set_quadratic(quadratic)¶
- Set the quadratic part of the composite. 
 - 
smooth_objective(x, mode='both', check_feasibility=False)¶
- The zero function. 
 - 
smoothed(smoothing_quadratic)¶
- Add quadratic smoothing term 
 - 
solve(quadratic=None, return_optimum=False, **fit_args)¶
 - 
tol= 1e-05¶
 
- 
nonpositive¶
- 
class regreg.atoms.cones.nonpositive(shape, offset=None, quadratic=None, initial=None)¶
- Bases: - regreg.atoms.cones.nonnegative- The non-positive cone constraint (which is the support function of the non-negative cone constraint). - 
__init__(shape, offset=None, quadratic=None, initial=None)¶
- Initialize self. See help(type(self)) for accurate signature. 
 - 
classmethod affine(linear_operator, offset, diag=False, quadratic=None)¶
 - 
apply_offset(x)¶
- If self.offset is not None, return x-self.offset, else return x. 
 - 
static check_subgradient(atom, prox_center)¶
- For a given seminorm, verify the KKT condition for the problem for the proximal problem \[\text{minimize}_u \frac{1}{2} \|u-z\|^2_2 + h(z)\]- where \(z\) is the prox_center and \(h\) is atom. - This should return two values that are 0, one is the inner product of the minimizer and the residual, the other is just 0. - Parameters
- atom : cone - A cone instance with a proximal method. - prox_center : np.ndarray(np.float) - Center for the proximal map. 
- Returns
- v1, v2 : float - Two values that should be equal if the proximal map is correct. 
 
 - 
cone_prox(x)¶
- Return (unique) minimizer \[\beta^{\lambda}(u) = \text{argmin}_{\beta \in \mathbb{R}^p} \frac{1}{2} \|\beta-u\|^2_2 + I^{\infty}(\beta \preceq 0)\]
 - 
property conjugate¶
 - 
constraint(x)¶
- The constraint \[I^{\infty}(\beta \preceq 0)\]
 - 
property dual¶
 - 
get_conjugate()¶
- Return the conjugate of an given atom. - >>> import regreg.api as rr >>> penalty = rr.nonpositive((30,)) >>> penalty.get_conjugate() nonnegative((30,), offset=None) 
 - 
get_dual()¶
- Return the dual of an atom. This dual is formed by making the substitution \(v=Ax\) where \(A\) is the self.linear_transform. - >>> import regreg.api as rr >>> penalty = rr.nonpositive((30,)) >>> penalty nonpositive((30,), offset=None) >>> penalty.dual (<regreg.affine.identity object at 0x...>, nonnegative((30,), offset=None)) - If there is a linear part to the penalty, the linear_transform may not be identity: - >>> D = (np.identity(4) + np.diag(-np.ones(3),1))[:-1] >>> D array([[ 1., -1., 0., 0.], [ 0., 1., -1., 0.], [ 0., 0., 1., -1.]]) >>> linear_atom = rr.nonnegative.linear(D) >>> linear_atom affine_cone(nonnegative((3,), offset=None), array([[ 1., -1., 0., 0.], [ 0., 1., -1., 0.], [ 0., 0., 1., -1.]])) >>> linear_atom.dual (<regreg.affine.linear_transform object at 0x...>, nonpositive((3,), offset=None)) 
 - 
get_offset()¶
 - 
get_quadratic()¶
- Get the quadratic part of the composite. 
 - 
latexify(var=None, idx='')¶
 - 
classmethod linear(linear_operator, diag=False, offset=None, quadratic=None)¶
 - 
property linear_transform¶
- The linear transform applied before a penalty is computed. Defaults to regreg.affine.identity - >>> from regreg.api import l1norm >>> penalty = l1norm(30, lagrange=3.4) >>> type(penalty.linear_transform) <class 'regreg.affine.identity'> 
 - 
nonsmooth_objective(x, check_feasibility=False)¶
- >>> import regreg.api as rr >>> cone = rr.nonnegative(4) >>> cone.nonsmooth_objective([3, 4, 5, 9]) 0.0 
 - 
objective(x, check_feasibility=False)¶
 - 
objective_template= 'I^{\\infty}(%(var)s \\preceq 0)'¶
 - 
objective_vars= {'coneklass': 'nonpositive', 'dualconeklass': 'nonnegative', 'initargs': '(30,)', 'linear': 'D', 'offset': '\\alpha', 'shape': 'p', 'var': '\\beta'}¶
 - 
property offset¶
 - 
proximal(quadratic, prox_control=None)¶
- The proximal operator. \[v^{\lambda}(x) = \text{argmin}_{v \in \mathbb{R}^{p}} \frac{L}{2} \|x-\alpha - v\|^2_2 + I^{\infty}(\beta \preceq 0) + \langle v, \eta \rangle\]- where \(\alpha\) is self.offset, \(\eta\) is quadratic.linear_term. - >>> import regreg.api as rr >>> cone = rr.nonnegative((4,)) >>> Q = rr.identity_quadratic(1.5, [3, -4, -1, 1], 0, 0) >>> np.allclose(cone.proximal(Q), [3, 0, 0, 1]) True - Parameters
- quadratic : regreg.identity_quadratic.identity_quadratic - A quadratic added to the atom before minimizing. - prox_control : [None, dict] - This argument is ignored for seminorms, but otherwise is passed to regreg.algorithms.FISTA if the atom needs to be solved iteratively. 
- Returns
- Z : np.ndarray(np.float) - The proximal map of the implied center of 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. 
 - 
set_offset(value)¶
 - 
set_quadratic(quadratic)¶
- Set the quadratic part of the composite. 
 - 
smooth_objective(x, mode='both', check_feasibility=False)¶
- The zero function. 
 - 
smoothed(smoothing_quadratic)¶
- Add quadratic smoothing term 
 - 
solve(quadratic=None, return_optimum=False, **fit_args)¶
 - 
tol= 1e-05¶
 
- 
zero¶
- 
class regreg.atoms.cones.zero(shape, offset=None, quadratic=None, initial=None)¶
- Bases: - regreg.atoms.cones.cone- The zero seminorm, support function of :math:{0} - 
__init__(shape, offset=None, quadratic=None, initial=None)¶
- Initialize self. See help(type(self)) for accurate signature. 
 - 
classmethod affine(linear_operator, offset, diag=False, quadratic=None)¶
 - 
apply_offset(x)¶
- If self.offset is not None, return x-self.offset, else return x. 
 - 
static check_subgradient(atom, prox_center)¶
- For a given seminorm, verify the KKT condition for the problem for the proximal problem \[\text{minimize}_u \frac{1}{2} \|u-z\|^2_2 + h(z)\]- where \(z\) is the prox_center and \(h\) is atom. - This should return two values that are 0, one is the inner product of the minimizer and the residual, the other is just 0. - Parameters
- atom : cone - A cone instance with a proximal method. - prox_center : np.ndarray(np.float) - Center for the proximal map. 
- Returns
- v1, v2 : float - Two values that should be equal if the proximal map is correct. 
 
 - 
cone_prox(x)¶
- Return (unique) minimizer \[\beta^{\lambda}(u) = \text{argmin}_{\beta \in \mathbb{R}^p} \frac{1}{2} \|\beta-u\|^2_2 + {\cal Z}(\beta)\]
 - 
property conjugate¶
 - 
constraint(x)¶
- The constraint \[{\cal Z}(\beta)\]
 - 
property dual¶
 - 
get_conjugate()¶
- Return the conjugate of an given atom. - >>> import regreg.api as rr >>> penalty = rr.zero((30,)) >>> penalty.get_conjugate() zero_constraint((30,), offset=None) 
 - 
get_dual()¶
- Return the dual of an atom. This dual is formed by making the substitution \(v=Ax\) where \(A\) is the self.linear_transform. - >>> import regreg.api as rr >>> penalty = rr.zero((30,)) >>> penalty zero((30,), offset=None) >>> penalty.dual (<regreg.affine.identity object at 0x...>, zero_constraint((30,), offset=None)) - If there is a linear part to the penalty, the linear_transform may not be identity: - >>> D = (np.identity(4) + np.diag(-np.ones(3),1))[:-1] >>> D array([[ 1., -1., 0., 0.], [ 0., 1., -1., 0.], [ 0., 0., 1., -1.]]) >>> linear_atom = rr.nonnegative.linear(D) >>> linear_atom affine_cone(nonnegative((3,), offset=None), array([[ 1., -1., 0., 0.], [ 0., 1., -1., 0.], [ 0., 0., 1., -1.]])) >>> linear_atom.dual (<regreg.affine.linear_transform object at 0x...>, nonpositive((3,), offset=None)) 
 - 
get_offset()¶
 - 
get_quadratic()¶
- Get the quadratic part of the composite. 
 - 
latexify(var=None, idx='')¶
 - 
classmethod linear(linear_operator, diag=False, offset=None, quadratic=None)¶
 - 
property linear_transform¶
- The linear transform applied before a penalty is computed. Defaults to regreg.affine.identity - >>> from regreg.api import l1norm >>> penalty = l1norm(30, lagrange=3.4) >>> type(penalty.linear_transform) <class 'regreg.affine.identity'> 
 - 
nonsmooth_objective(x, check_feasibility=False)¶
- >>> import regreg.api as rr >>> cone = rr.nonnegative(4) >>> cone.nonsmooth_objective([3, 4, 5, 9]) 0.0 
 - 
objective(x, check_feasibility=False)¶
 - 
objective_template= '{\\cal Z}(%(var)s)'¶
 - 
objective_vars= {'coneklass': 'zero', 'dualconeklass': 'zero_constraint', 'initargs': '(30,)', 'linear': 'D', 'offset': '\\alpha', 'shape': 'p', 'var': '\\beta'}¶
 - 
property offset¶
 - 
proximal(quadratic, prox_control=None)¶
- The proximal operator. \[v^{\lambda}(x) = \text{argmin}_{v \in \mathbb{R}^{p}} \frac{L}{2} \|x-\alpha - v\|^2_2 + {\cal Z}(\beta) + \langle v, \eta \rangle\]- where \(\alpha\) is self.offset, \(\eta\) is quadratic.linear_term. - >>> import regreg.api as rr >>> cone = rr.nonnegative((4,)) >>> Q = rr.identity_quadratic(1.5, [3, -4, -1, 1], 0, 0) >>> np.allclose(cone.proximal(Q), [3, 0, 0, 1]) True - Parameters
- quadratic : regreg.identity_quadratic.identity_quadratic - A quadratic added to the atom before minimizing. - prox_control : [None, dict] - This argument is ignored for seminorms, but otherwise is passed to regreg.algorithms.FISTA if the atom needs to be solved iteratively. 
- Returns
- Z : np.ndarray(np.float) - The proximal map of the implied center of 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. 
 - 
set_offset(value)¶
 - 
set_quadratic(quadratic)¶
- Set the quadratic part of the composite. 
 - 
smooth_objective(x, mode='both', check_feasibility=False)¶
- The zero function. 
 - 
smoothed(smoothing_quadratic)¶
- Add quadratic smoothing term 
 - 
solve(quadratic=None, return_optimum=False, **fit_args)¶
 - 
tol= 1e-05¶
 
- 
zero_constraint¶
- 
class regreg.atoms.cones.zero_constraint(shape, offset=None, quadratic=None, initial=None)¶
- Bases: - regreg.atoms.cones.cone- The zero constraint, support function of :math:`mathbb{R}`^p - 
__init__(shape, offset=None, quadratic=None, initial=None)¶
- Initialize self. See help(type(self)) for accurate signature. 
 - 
classmethod affine(linear_operator, offset, diag=False, quadratic=None)¶
 - 
apply_offset(x)¶
- If self.offset is not None, return x-self.offset, else return x. 
 - 
static check_subgradient(atom, prox_center)¶
- For a given seminorm, verify the KKT condition for the problem for the proximal problem \[\text{minimize}_u \frac{1}{2} \|u-z\|^2_2 + h(z)\]- where \(z\) is the prox_center and \(h\) is atom. - This should return two values that are 0, one is the inner product of the minimizer and the residual, the other is just 0. - Parameters
- atom : cone - A cone instance with a proximal method. - prox_center : np.ndarray(np.float) - Center for the proximal map. 
- Returns
- v1, v2 : float - Two values that should be equal if the proximal map is correct. 
 
 - 
cone_prox(x)¶
- Return (unique) minimizer \[\beta^{\lambda}(u) = \text{argmin}_{\beta \in \mathbb{R}^p} \frac{1}{2} \|\beta-u\|^2_2 + I^{\infty}(\beta = 0)\]
 - 
property conjugate¶
 - 
constraint(x)¶
- The constraint \[I^{\infty}(\beta = 0)\]
 - 
property dual¶
 - 
get_conjugate()¶
- Return the conjugate of an given atom. - >>> import regreg.api as rr >>> penalty = rr.zero_constraint((30,)) >>> penalty.get_conjugate() zero((30,), offset=None) 
 - 
get_dual()¶
- Return the dual of an atom. This dual is formed by making the substitution \(v=Ax\) where \(A\) is the self.linear_transform. - >>> import regreg.api as rr >>> penalty = rr.zero_constraint((30,)) >>> penalty zero_constraint((30,), offset=None) >>> penalty.dual (<regreg.affine.identity object at 0x...>, zero((30,), offset=None)) - If there is a linear part to the penalty, the linear_transform may not be identity: - >>> D = (np.identity(4) + np.diag(-np.ones(3),1))[:-1] >>> D array([[ 1., -1., 0., 0.], [ 0., 1., -1., 0.], [ 0., 0., 1., -1.]]) >>> linear_atom = rr.nonnegative.linear(D) >>> linear_atom affine_cone(nonnegative((3,), offset=None), array([[ 1., -1., 0., 0.], [ 0., 1., -1., 0.], [ 0., 0., 1., -1.]])) >>> linear_atom.dual (<regreg.affine.linear_transform object at 0x...>, nonpositive((3,), offset=None)) 
 - 
get_offset()¶
 - 
get_quadratic()¶
- Get the quadratic part of the composite. 
 - 
latexify(var=None, idx='')¶
 - 
classmethod linear(linear_operator, diag=False, offset=None, quadratic=None)¶
 - 
property linear_transform¶
- The linear transform applied before a penalty is computed. Defaults to regreg.affine.identity - >>> from regreg.api import l1norm >>> penalty = l1norm(30, lagrange=3.4) >>> type(penalty.linear_transform) <class 'regreg.affine.identity'> 
 - 
nonsmooth_objective(x, check_feasibility=False)¶
- >>> import regreg.api as rr >>> cone = rr.nonnegative(4) >>> cone.nonsmooth_objective([3, 4, 5, 9]) 0.0 
 - 
objective(x, check_feasibility=False)¶
 - 
objective_template= 'I^{\\infty}(%(var)s = 0)'¶
 - 
objective_vars= {'coneklass': 'zero_constraint', 'dualconeklass': 'zero', 'initargs': '(30,)', 'linear': 'D', 'offset': '\\alpha', 'shape': 'p', 'var': '\\beta'}¶
 - 
property offset¶
 - 
proximal(quadratic, prox_control=None)¶
- The proximal operator. \[v^{\lambda}(x) = \text{argmin}_{v \in \mathbb{R}^{p}} \frac{L}{2} \|x-\alpha - v\|^2_2 + I^{\infty}(\beta = 0) + \langle v, \eta \rangle\]- where \(\alpha\) is self.offset, \(\eta\) is quadratic.linear_term. - >>> import regreg.api as rr >>> cone = rr.nonnegative((4,)) >>> Q = rr.identity_quadratic(1.5, [3, -4, -1, 1], 0, 0) >>> np.allclose(cone.proximal(Q), [3, 0, 0, 1]) True - Parameters
- quadratic : regreg.identity_quadratic.identity_quadratic - A quadratic added to the atom before minimizing. - prox_control : [None, dict] - This argument is ignored for seminorms, but otherwise is passed to regreg.algorithms.FISTA if the atom needs to be solved iteratively. 
- Returns
- Z : np.ndarray(np.float) - The proximal map of the implied center of 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. 
 - 
set_offset(value)¶
 - 
set_quadratic(quadratic)¶
- Set the quadratic part of the composite. 
 - 
smooth_objective(x, mode='both', check_feasibility=False)¶
- The zero function. 
 - 
smoothed(smoothing_quadratic)¶
- Add quadratic smoothing term 
 - 
solve(quadratic=None, return_optimum=False, **fit_args)¶
 - 
tol= 1e-05¶
 
-