smooth.quadratic

Module: smooth.quadratic

Inheritance diagram for regreg.smooth.quadratic:

digraph inheritancebc68210771 { rankdir=LR; size="8.0, 12.0"; "problems.composite.composite" [URL="regreg.problems.composite.html#regreg.problems.composite.composite",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="A generic way to specify a problem in composite form."]; "problems.composite.smooth" [URL="regreg.problems.composite.html#regreg.problems.composite.smooth",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="A composite subclass that has 0 as "]; "problems.composite.composite" -> "problems.composite.smooth" [arrowsize=0.5,style="setlinewidth(0.5)"]; "regreg.smooth.smooth_atom" [URL="regreg.smooth.html#regreg.smooth.smooth_atom",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="A class for representing a smooth function and its gradient"]; "problems.composite.smooth" -> "regreg.smooth.smooth_atom" [arrowsize=0.5,style="setlinewidth(0.5)"]; "smooth.quadratic.cholesky" [URL="#regreg.smooth.quadratic.cholesky",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="Given :math:`Q > 0`, returns a linear transform"]; "smooth.quadratic.quadratic_loss" [URL="#regreg.smooth.quadratic.quadratic_loss",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="Half of the square of the l2 norm"]; "regreg.smooth.smooth_atom" -> "smooth.quadratic.quadratic_loss" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

Classes

cholesky

class regreg.smooth.quadratic.cholesky(Q, cholesky=None, banded=False)

Bases: object

Given \(Q > 0\), returns a linear transform that is multiplication by \(Q^{-1}\) by first computing the Cholesky decomposition of \(Q\).

Parameters

Q: array

positive definite matrix

__init__(Q, cholesky=None, banded=False)

Initialize self. See help(type(self)) for accurate signature.

adjoint_map(x)
affine_map(x)
linear_map(x)

quadratic_loss

class regreg.smooth.quadratic.quadratic_loss(shape, Q=None, Qdiag=False, coef=1.0, offset=None, quadratic=None, initial=None)

Bases: regreg.smooth.smooth_atom

Half of the square of the l2 norm

Parameters

shape : tuple

Shape of argument to smooth_objective

Q: ndarray

positive definite matrix (optional), defaults to identity. If Qdiag then Q is one-dimensional.

Qdiag : bool

Is the quadratic form diagonal?

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, Q=None, Qdiag=False, coef=1.0, 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
static diagonal(D, offset=None, quadratic=None, initial=None)
static fromarray(Q, offset=None, quadratic=None, initial=None)
get_conjugate(factor=False)
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 = '\\frac{%(coef)s}{2} \\cdot %(var)s^T %(Q)s %(var)s'
objective_vars = {'Q': 'Q', '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)

Evaluate a smooth function and/or its gradient

if mode == ‘both’, return both function value and gradient if mode == ‘grad’, return only the gradient if mode == ‘func’, return only the function value

smoothed(smoothing_quadratic)

Add quadratic smoothing term

solve(quadratic=None, return_optimum=False, **fit_args)
static squared_transform(transform, offset=None, quadratic=None, initial=None)

Functions

regreg.smooth.quadratic.signal_approximator(signal, coef=1)

Least squares with design \(I\)

\[\]

rac{C}{2} |eta-Y|^2_2

regreg.smooth.quadratic.squared_error(X, Y, coef=1)

Least squares with design \(X\)

\[\frac{C}{2} \|X\beta-Y\|^2_2\]
Parameters

X : affine_transform

Design matrix

Y : np.array