Package parsimony :: Package functions :: Package multiblock :: Module losses :: Class CombinedMultiblockFunction
[hide private]
[frames] | no frames]

Class CombinedMultiblockFunction

source code

                     object --+            
                              |            
            properties.Function --+        
                                  |        
       properties.CompositeFunction --+    
                                      |    
          properties.MultiblockFunction --+
                                          |
                             object --+   |
                                      |   |
          properties.MultiblockGradient --+
                                          |
                             object --+   |
                                      |   |
  properties.MultiblockProximalOperator --+
                                          |
                             object --+   |
                                      |   |
properties.MultiblockProjectionOperator --+
                                          |
                             object --+   |
                                      |   |
          properties.MultiblockStepSize --+
                                          |
                                         CombinedMultiblockFunction

Combines one or more loss functions, any number of penalties and zero
or one proximal operator.

This function thus represents

    f(x) = g_1(x) [ + g_2(x) ... ] [ + d_1(x) ... ] [ + N_1(x) ...]
       [ + h_1(x) ...],

subject to [ C_1(x) <= c_1,
             C_2(x) <= c_2,
             ... ],

where g_i are differentiable Functions that may be multiblock, d_j are
differentiable penalties, h_k are a ProximalOperators and N_l are
NesterovFunctions. All functions and penalties must thus have Gradients,
unless they are ProximalOperators.

If no ProximalOperator is given, prox will be the identity.

Parameters
----------
X : List of numpy arrays. The blocks of data in the multiblock model.

functions : List of lists of lists. A function matrix, with element
        i,j connecting block i to block j.

penalties : A list of lists. Element i of the outer list is also a list
        that contains the penalties for block i.

prox : A list of lists. Element i of the outer list is also a list that
        contains the penalties that can be expressed as proximal operators
        for block i.

constraints : A list of lists. Element i of the outer list is also a list
        that contains the constraints for block i.

Instance Methods [hide private]
 
__init__(self, X, functions=[], penalties=[], prox=[], constraints=[])
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
reset(self)
Free any cached computations from previous use of this Function.
source code
 
add_function(self, function, i, j)
Add a function that connects blocks i and j.
source code
 
add_penalty(self, penalty, i) source code
 
add_prox(self, penalty, i) source code
 
add_constraint(self, constraint, i)
Add a constraint to this function.
source code
 
has_nesterov_function(self, index) source code
 
f(self, w)
Function value.
source code
 
fmu(self, w)
Function value of smoothed function.
source code
 
grad(self, w, index)
Gradient of the differentiable part of the function.
source code
 
prox(self, w, index, factor=1.0, eps=5e-08, max_iter=100)
The proximal operator of the non-differentiable part of the function with the given index.
source code
 
proj(self, w, index, eps=5e-08, max_iter=100)
The projection operator of a constraint that corresponds to the function with the given index.
source code
 
step(self, w, index)
The step size to use in descent methods.
source code

Inherited from properties.MultiblockFunction: get_constraints

Inherited from properties.Function: get_params, set_params

Inherited from properties.MultiblockGradient: approx_grad

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

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

Inherited from properties.MultiblockFunction: __metaclass__, constraints

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, X, functions=[], penalties=[], prox=[], constraints=[])
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

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)

add_function(self, function, i, j)

source code 
Add a function that connects blocks i and j.

Parameters
----------
function : Function or MultiblockFunction. A function that connects
        block i and block j.

i : Non-negative integer. Index of the first block. Zero based, so 0
        is the first block.

j : Non-negative integer. Index of the second block. Zero based, so 0
        is the first block.

add_constraint(self, constraint, i)

source code 

Add a constraint to this function.

Overrides: properties.MultiblockFunction.add_constraint
(inherited documentation)

f(self, w)

source code 
Function value.

Parameters
----------
w : List of numpy arrays. The weight vectors.

Overrides: properties.Function.f

fmu(self, w)

source code 
Function value of smoothed function.

Parameters
----------
w : List of numpy arrays. The weight vectors.

grad(self, w, index)

source code 
Gradient of the differentiable part of the function.

From the interface "MultiblockGradient".

Parameters
----------
w : List of numpy arrays. The weight vectors, w[index] is the point at
        which to evaluate the gradient.

index : Non-negative integer. Which variable the step is for.

Overrides: properties.MultiblockGradient.grad

prox(self, w, index, factor=1.0, eps=5e-08, max_iter=100)

source code 
The proximal operator of the non-differentiable part of the
function with the given index.

From the interface "MultiblockProximalOperator".

Parameters
----------
w : List of numpy arrays. The weight vectors.

index : Non-negative integer. Which variable the step is for.

factor : Positive float. A factor by which the Lagrange multiplier is
        scaled. This is usually the step size.

Overrides: properties.MultiblockProximalOperator.prox

proj(self, w, index, eps=5e-08, max_iter=100)

source code 
The projection operator of a constraint that corresponds to the
function with the given index.

From the interface "MultiblockProjectionOperator".

Parameters
----------
w : List of numpy arrays. The weight vectors.

index : Non-negative integer. Which variable the step is for.

Overrides: properties.MultiblockProjectionOperator.proj

step(self, w, index)

source code 
The step size to use in descent methods.

From the interface "StepSize".

Parameters
----------
w : Numpy array. The point at which to determine the step size.

index : Non-negative integer. The variable which the step is for.

Overrides: properties.MultiblockStepSize.step