atoms¶
Module: atoms
¶
Inheritance diagram for regreg.atoms
:
Classes¶
affine_atom
¶
-
class
regreg.atoms.
affine_atom
(atom_obj, atransform)¶ Bases:
object
Given a seminorm on \(\mathbb{R}^p\), i.e. \(\beta \mapsto h_K(\beta)\) this class creates a new seminorm that evaluates \(h_K(D\beta+\alpha)\)
This class does not have a prox, but its dual does. The prox of the dual is
\[\text{minimize} \frac{1}{2} \|y-x\|^2_2 + x^T\alpha \ \text{s.t.} \ x \in \lambda K\]-
__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
-
atom
¶
-
class
regreg.atoms.
atom
(shape, offset=None, quadratic=None, initial=None)¶ Bases:
regreg.problems.composite.nonsmooth
A class that defines the API for support functions.
-
__init__
(shape, offset=None, quadratic=None, initial=None)¶ Initialize self. See help(type(self)) for accurate signature.
-
apply_offset
(x)¶ If self.offset is not None, return x-self.offset, else return x.
-
property
conjugate
¶ The conjugate of an atom.
-
property
dual
¶
-
get_conjugate
()¶
-
get_dual
()¶
-
get_offset
()¶
-
get_quadratic
()¶ Get the quadratic part of the composite.
-
latexify
(var=None, idx='')¶
-
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
(arg, check_feasibility=False)¶
-
objective
(x, check_feasibility=False)¶
-
objective_template
= 'f(%(var)s)'¶
-
objective_vars
= {'dualklass': 'dualnorm', 'klass': 'norm', 'offset': '\\alpha', 'shape': 'p', 'var': '\\beta'}¶
-
property
offset
¶
-
proximal
(proxq, prox_control=None)¶
-
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¶
-