Package parsimony :: Package functions :: Module combinedfunctions :: Class LinearRegressionL1L2TV
[hide private]
[frames] | no frames]

Class LinearRegressionL1L2TV

source code

                            object --+        
                                     |        
                   properties.Function --+    
                                         |    
              properties.CompositeFunction --+
                                             |
                            object --+       |
                                     |       |
                   properties.Gradient --+   |
                                         |   |
                            object --+   |   |
                                     |   |   |
properties.LipschitzContinuousGradient --+   |
                                         |   |
                            object --+   |   |
                                     |   |   |
                properties.Eigenvalues --+   |
                                         |   |
                            object --+   |   |
                                     |   |   |
           properties.ProximalOperator --+   |
                                         |   |
               properties.NesterovFunction --+
                                             |
                                object --+   |
                                         |   |
               properties.ProximalOperator --+
                                             |
                                object --+   |
                                         |   |
                   properties.Continuation --+
                                             |
                                object --+   |
                                         |   |
                   properties.DualFunction --+
                                             |
                                object --+   |
                                         |   |
                 properties.StronglyConvex --+
                                             |
                                object --+   |
                                         |   |
                       properties.StepSize --+
                                             |
                                            LinearRegressionL1L2TV
Known Subclasses:

Combination (sum) of LinearRegression, L1, L2 and TotalVariation.

Parameters:
----------
X : Numpy array. The X matrix for the linear regression.

y : Numpy array. The y vector for the linear regression.

l1 : Non-negative float. The Lagrange multiplier, or regularisation
        constant, for the L1 penalty.

l2 : Non-negative float. The Lagrange multiplier, or regularisation
        constant, for the ridge penalty.

tv : Non-negative float. The Lagrange multiplier, or regularisation
        constant, of the smoothed TV function.

A : Numpy array (usually sparse). The linear operator for the Nesterov
        formulation of TV. May not be None!

mu : Non-negative float. The regularisation constant for the smoothing
        of the TV function.

penalty_start : Non-negative integer. The number of columns, variables
        etc., to except from penalisation. Equivalently, the first
        index to be penalised. Default is 0, all columns are included.

mean : Boolean. Whether to compute the squared loss or the mean
        squared loss. Default is True, the mean squared loss.

Instance Methods [hide private]
 
__init__(self, X, y, l1, l2, tv, A=None, mu=0.0, penalty_start=0, mean=True)
Parameters ---------- l : Non-negative float.
source code
 
reset(self)
Free any cached computations from previous use of this Function.
source code
 
set_params(self, **kwargs) source code
 
get_mu(self)
Returns the regularisation constant for the smoothing.
source code
 
set_mu(self, mu)
Sets the regularisation constant for the smoothing.
source code
 
f(self, beta)
Function value.
source code
 
fmu(self, beta, mu=None)
Function value.
source code
 
phi(self, alpha, beta)
Function value with known alpha.
source code
 
grad(self, beta)
Gradient of the differentiable part of the function.
source code
 
L(self)
Lipschitz constant of the gradient.
source code
 
prox(self, beta, factor=1.0, **kwargs)
The proximal operator of the non-differentiable part of the function.
source code
 
estimate_mu(self, beta)
Computes a "good" value of mu with respect to the given beta.
source code
 
M(self)
The maximum value of the regularisation of the dual variable.
source code
 
mu_opt(self, eps)
The optimal value of mu given epsilon.
source code
 
eps_opt(self, mu)
The optimal value of epsilon given mu.
source code
 
eps_max(self, mu)
The maximum value of epsilon.
source code
 
mu_max(self, eps)
The maximum value of mu.
source code
 
betahat(self, alphak, betak, eps=5e-08, max_iter=10000)
Returns the beta that minimises the dual function.
source code
 
gap(self, beta, beta_hat=None, eps=5e-08, max_iter=10000)
Compute the duality gap.
source code
 
A(self)
Linear operator of the Nesterov function.
source code
 
Aa(self, alpha)
Computes A'.alpha.
source code
 
project(self, a)
Projection onto the compact space of the Nesterov function.
source code
 
parameter(self)
Returns the strongly convex parameter for the function.
source code
 
step(self, x)
The step size to use in descent methods.
source code

Inherited from properties.Function: get_params

Inherited from properties.NesterovFunction: alpha, lA, lambda_max

Inherited from properties.Gradient: approx_grad

Inherited from properties.LipschitzContinuousGradient: approx_L

Inherited from properties.Eigenvalues: lambda_min

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  __abstractmethods__ = frozenset([])

Inherited from properties.CompositeFunction: __metaclass__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, X, y, l1, l2, tv, A=None, mu=0.0, penalty_start=0, mean=True)
(Constructor)

source code 

Parameters
----------
l : Non-negative float. The Lagrange multiplier, or regularisation
        constant, of the function.

A : A (usually sparse) array. The linear operator for the Nesterov
        formulation. May not be None!

mu: Non-negative float. The regularisation constant for the smoothing.

penalty_start : Non-negative integer. The number of columns, variables
        etc., to except from penalisation. Equivalently, the first
        index to be penalised. Default is 0, all columns are included.

Overrides: object.__init__
(inherited documentation)

reset(self)

source code 

Free any cached computations from previous use of this Function.

Overrides: properties.Function.reset
(inherited documentation)

set_params(self, **kwargs)

source code 
Overrides: properties.Function.set_params

get_mu(self)

source code 

Returns the regularisation constant for the smoothing.

From the interface "NesterovFunction".

Overrides: properties.NesterovFunction.get_mu

set_mu(self, mu)

source code 
Sets the regularisation constant for the smoothing.

From the interface "NesterovFunction".

Parameters:
----------
mu : Non-negative float. The regularisation constant for the smoothing
        to use from now on.

Returns:
-------
old_mu : Non-negative float. The old regularisation constant for the
        smoothing that was overwritten and is no longer used.

Overrides: properties.NesterovFunction.set_mu

f(self, beta)

source code 

Function value.

Overrides: properties.Function.f

fmu(self, beta, mu=None)

source code 

Function value.

Overrides: properties.NesterovFunction.fmu

phi(self, alpha, beta)

source code 

Function value with known alpha.

Overrides: properties.NesterovFunction.phi

grad(self, beta)

source code 

Gradient of the differentiable part of the function.

From the interface "Gradient".

Overrides: properties.Gradient.grad

L(self)

source code 

Lipschitz constant of the gradient.

From the interface "LipschitzContinuousGradient".

Overrides: properties.LipschitzContinuousGradient.L

prox(self, beta, factor=1.0, **kwargs)

source code 

The proximal operator of the non-differentiable part of the function.

From the interface "ProximalOperator".

Overrides: properties.ProximalOperator.prox

estimate_mu(self, beta)

source code 

Computes a "good" value of mu with respect to the given beta.

From the interface "NesterovFunction".

Overrides: properties.NesterovFunction.estimate_mu

M(self)

source code 
The maximum value of the regularisation of the dual variable. We
have

    M = max_{alpha in K} 0.5*|alpha|²_2.

From the interface "NesterovFunction".

Overrides: properties.NesterovFunction.M

mu_opt(self, eps)

source code 

The optimal value of mu given epsilon.

From the interface "Continuation".

Overrides: properties.Continuation.mu_opt

eps_opt(self, mu)

source code 

The optimal value of epsilon given mu.

From the interface "Continuation".

Overrides: properties.Continuation.eps_opt

eps_max(self, mu)

source code 
The maximum value of epsilon.

From the interface "Continuation".

Parameters
----------
mu : Positive float. The regularisation constant of the smoothing.

Returns
-------
eps : Positive float. The upper limit, the maximum, precision.

Overrides: properties.Continuation.eps_max

mu_max(self, eps)

source code 
The maximum value of mu.

From the interface "Continuation".

Parameters
----------
eps : Positive float. The maximum precision of the smoothing.

Returns
-------
mu : Positive float. The upper limit, the maximum, of the
        regularisation constant of the smoothing.

Overrides: properties.Continuation.mu_max

betahat(self, alphak, betak, eps=5e-08, max_iter=10000)

source code 

Returns the beta that minimises the dual function. Used when we compute the gap.

From the interface "DualFunction".

Overrides: properties.DualFunction.betahat

gap(self, beta, beta_hat=None, eps=5e-08, max_iter=10000)

source code 

Compute the duality gap.

From the interface "DualFunction".

Overrides: properties.DualFunction.gap

A(self)

source code 

Linear operator of the Nesterov function.

From the interface "NesterovFunction".

Overrides: properties.NesterovFunction.A

Aa(self, alpha)

source code 

Computes A'.alpha.

From the interface "NesterovFunction".

Overrides: properties.NesterovFunction.Aa

project(self, a)

source code 

Projection onto the compact space of the Nesterov function.

From the interface "NesterovFunction".

Overrides: properties.NesterovFunction.project

parameter(self)

source code 

Returns the strongly convex parameter for the function.

From the interface "StronglyConvex".

Overrides: properties.StronglyConvex.parameter

step(self, x)

source code 
The step size to use in descent methods.

From the interface "StepSize".

Parameters
----------
x : Numpy array. The point at which to evaluate the step size.

Overrides: properties.StepSize.step