sporco.pgm.cmod

PGM algorithm for the CMOD problem

Functions

getPcn(zm, nnc)

Construct constraint set projection function.

zeromean(v)

Subtract mean of each column of matrix.

normalise(v)

Normalise columns of matrix.

Classes

CnstrMOD(*args, **kwargs)

PGM algorithm for a constrained variant of the Method of Optimal Directions (MOD) [20] problem, referred to here as Constrained MOD (CMOD).

WeightedCnstrMOD(*args, **kwargs)

PGM algorithm for a weighted variant of Constrained MOD (CMOD) problem.


Function Descriptions

sporco.pgm.cmod.getPcn(zm, nnc)[source]

Construct constraint set projection function.

Parameters:
zmbool

Flag indicating whether the projection function should include column mean subtraction

nncbool

Flag indicating whether the projection function should include clipping to positive values

Returns:
fnfunction

Constraint set projection function

sporco.pgm.cmod.zeromean(v)[source]

Subtract mean of each column of matrix.

Parameters:
varray_like

Input dictionary array

Returns:
vzndarray

Dictionary array with column means subtracted

sporco.pgm.cmod.normalise(v)[source]

Normalise columns of matrix.

Parameters:
varray_like

Array with columns to be normalised

Returns:
vnrmndarray

Normalised array


Class Descriptions

class sporco.pgm.cmod.CnstrMOD(*args, **kwargs)[source]

Bases: PGM

PGM algorithm for a constrained variant of the Method of Optimal Directions (MOD) [20] problem, referred to here as Constrained MOD (CMOD).


Inheritance diagram of CnstrMOD


Solve the optimisation problem

\[\mathrm{argmin}_D \| D X - S \|_2^2 + \iota_C(D)\]

where \(\iota_C(\cdot)\) is the indicator function of feasible set \(C\) consisting of matrices with unit-norm columns.

After termination of the solve method, attribute itstat is a list of tuples representing statistics of each iteration. The fields of the named tuple IterationStats are:

Iter : Iteration number

DFid : Value of data fidelity term \((1/2) \| D X - S \|_2^2\)

Cnstr : Constraint violation measure

Rsdl : Residual

L : Inverse of gradient step parameter

Time : Cumulative run time

Parameters:
Zarray_like, shape (M, K)

Sparse representation coefficient matrix

Sarray_like, shape (N, K)

Signal vector or matrix

dsztuple

Dictionary size

optCnstrMOD.Options object

Algorithm options

class Options(opt=None)[source]

Bases: Options

CnstrMOD algorithm options

Options include all of those defined in pgm.PGM.Options, together with additional options:

ZeroMeanFlag indicating whether the solution

dictionary \(D\) should have zero-mean components.

NonNegCoefFlag indicating whether the solution

dictionary \(D\) should have non-negative coefficients.

Note that ZeroMean and NonNegCoef may not both be True.

Parameters:
optdict or None, optional (default None)

CnstrMOD algorithm options

defaults = {'AutoStop': {'Enabled': False, 'Tau0': 0.01}, 'Backtrack': None, 'Callback': None, 'DataType': None, 'FastSolve': False, 'IterTimer': 'solve', 'L': 500.0, 'MaxMainIter': 1000, 'Momentum': <sporco.pgm.momentum.MomentumNesterov object>, 'Monotone': False, 'NonNegCoef': False, 'RelStopTol': 0.001, 'StatusHeader': True, 'StepSizePolicy': None, 'Verbose': False, 'X0': None, 'ZeroMean': False}

Default content and allowed dict keys

itstat_fields_objfn = ('DFid', 'Cnstr')

Fields in IterationStats associated with the objective function; see eval_objfun

hdrtxt_objfn = ('DFid', 'Cnstr')

Display column headers associated with the objective function; see eval_objfun

hdrval_objfun = {'Cnstr': 'Cnstr', 'DFid': 'DFid'}

Dictionary mapping display column headers in hdrtxt_objfn to IterationStats entries

setcoef(Z)[source]

Set coefficient array.

getdict()[source]

Get final coefficient array.

grad_f(V=None)[source]

Compute gradient of data fidelity for variable V or self.Y.

prox_g(V)[source]

Compute proximal operator of \(g\).

hessian_f(V)[source]

Compute Hessian of \(f\) applied to V.

eval_objfn()[source]

Compute components of objective function as well as total contribution to objective function.

obfn_f(X=None)[source]

Compute data fidelity term \((1/2) \| D \mathbf{x} - \mathbf{s} \|_2^2\).

obfn_cns()[source]

Compute constraint violation measure \(\| P(\mathbf{y}) - \mathbf{y}\|_2\).

reconstruct(X=None)[source]

Reconstruct representation.

class sporco.pgm.cmod.WeightedCnstrMOD(*args, **kwargs)[source]

Bases: CnstrMOD

PGM algorithm for a weighted variant of Constrained MOD (CMOD) problem.


Inheritance diagram of WeightedCnstrMOD


Solve the optimisation problem

\[\mathrm{argmin}_D \| D X - S \|_W^2 + \iota_C(D)\]

where \(\iota_C(\cdot)\) is the indicator function of feasible set \(C\) consisting of matrices with unit-norm columns and \(\| \cdot \|_W\) denotes the weighted Frobenius norm defined as (note that this is not the standard definition)

\[\| X \|_W^2 = \| W^{1/2} \odot X \|_F\]

so that

\[\| X \|_W^2 = \sum_i \| W_i^{1/2} \mathbf{x}_i \|_2^2 = \sum_i \| \mathbf{x}_i \|_{W_i}^2 \;,\]

where \(\mathbf{x}_i\) and \(\mathbf{w}_i\) are the \(i^{\text{th}}\) columns of \(X\) and \(W\) respectively, and \(W_i = \mathrm{diag}(\mathbf{w}_i)\).

After termination of the solve method, attribute itstat is a list of tuples representing statistics of each iteration. The fields of the named tuple IterationStats are:

Iter : Iteration number

DFid : Value of data fidelity term \((1/2) \| D X - S \|_W^2\)

Cnstr : Constraint violation measure

Rsdl : Residual

L : Inverse of gradient step parameter

Time : Cumulative run time

Parameters:
Zarray_like, shape (M, K)

Sparse representation coefficient matrix

Sarray_like, shape (N, K)

Signal matrix

Warray_like, shape (N, K)

Weight matrix

dsztuple

Dictionary size

optWeightedCnstrMOD.Options object

Algorithm options

grad_f(V=None)[source]

Compute gradient of data fidelity for variable V or self.Y.

obfn_f(X=None)[source]

Compute data fidelity term \((1/2) \| D \mathbf{x} - \mathbf{s} \|_W^2\).