mccd.proxs

PROXIMAL OPERATORS.

Defines proximal operators to be fed to ModOpt algorithm that are specific to MCCD(or rather, not currently in modopt.opt.proximity).

: Authors: Tobias Liaudat <tobiasliaudat@gmail.com>,

Morgan Schmitz <github @MorganSchmitz>

class LinRecombine(A, filters, compute_norm=False)[source]

Bases: modopt.opt.proximity.ProximityParent

Multiply eigenvectors S and (factorized) weights A.

Maintain the knowledge about the linear operator norm which is calculated as the spectral norm (highest eigenvalue of the matrix). The recombination is done with S living in the tranformed domain.

Parameters
  • A (numpy.ndarray) – Matrix defining the linear operator.

  • filters (numpy.ndarray) – Filters used by the wavelet transform.

  • compute_norm (bool) – Computation of the matrix spectral radius in the initialization.

recombine(transf_S)[source]

Recombine new S and return it.

adj_rec(Y)[source]

Return the adjoint operator of recombine.

update_A(new_A, update_norm=True)[source]

Update the A matrix.

Also calculate the operator norm of A.

class KThreshold(iter_func)[source]

Bases: modopt.opt.proximity.ProximityParent

Define linewise hard-thresholding operator with variable thresholds.

Parameters

iter_func (function) – Input function that calcultates the number of non-zero values to keep in each line at each iteration.

reset_iter()[source]

Set iteration counter to zero.

op(data, extra_factor=1.0)[source]

Return input data after thresholding.

cost(x)[source]

Return cost.

(Indicator of \(\Omega\) is either 0 or infinity).

class StarletThreshold(threshold, thresh_type='soft')[source]

Bases: modopt.opt.proximity.ProximityParent

Apply soft thresholding in wavelet(default Starlet) domain.

Parameters
  • threshold (numpy.ndarray) – Threshold levels.

  • thresh_type (str) – Whether soft- or hard-thresholding should be used. Default is 'soft'.

update_threshold(new_threshold, new_thresh_type=None)[source]

Update starlet threshold.

op(transf_data, **kwargs)[source]

Apply wavelet transform and perform thresholding.

cost(x, y)[source]

Return cost.

class proxNormalization(type='columns')[source]

Bases: modopt.opt.proximity.ProximityParent

Normalize rows or columns of \(x\) relatively to L2 norm.

Parameters

type (str) – String defining the axis to normalize. If is lines` or columns. Default is columns.

normalize(x, extra_factor=1.0)[source]

Apply normalization.

Following the prefered type.

cost(x)[source]

Return cost.

class PositityOff(offset)[source]

Bases: modopt.opt.proximity.ProximityParent

Project to the positive subset, taking into acount an offset.

update_offset(new_offset)[source]

Update the offset value.

off_positive_part(x, extra_factor=1.0)[source]

Perform the projection accounting for the offset.

cost(x)[source]

Return cost.

class LinRecombineAlpha(M)[source]

Bases: modopt.opt.proximity.ProximityParent

Compute alpha recombination.

Multiply alpha and VT/Pi matrices (in this function named M) and compute the operator norm.

recombine(x)[source]

Return recombination.

adj_rec(y)[source]

Return adjoint recombination.

class GMCAlikeProxL1(iter_func, kmax)[source]

Bases: modopt.opt.proximity.ProximityParent

Classic l1 prox with GMCA-like decreasing weighting values.

GMCA stand for Generalized Morphological Component Analysis.

Parameters

iter_func (function) – Input function that calcultates the number of non-zero values to keep in each line at each iteration.

Notes

Not being used by the MCCD algorithm for the moment.

reset_iter()[source]

Set iteration counter to zero.

op(data, extra_factor=1.0)[source]

Return input data after thresholding.

op_tobi_prox_l1(mat, k, kmax)[source]

Apply GMCA hard-thresholding to each line of input matrix.

static HardThresholding(data, thresh)[source]

Perform element-wise hard thresholding.

cost(x)[source]

Cost function. To do.

class ClassicProxL2[source]

Bases: modopt.opt.proximity.ProximityParent

This class defines the classic l2 prox.

Notes

prox_weights: Corresponds to the weights of the weighted norm l_{w,2}. They are set by default to ones. Not being used in this implementation. beta_param: Corresponds to the beta (or lambda) parameter that goes with the fucn tion we will calculate the prox on prox_{lambda f(.)}(y). iter: Iteration number, just to follow track of the iterations. It could be part of the lambda update strategy for the prox calculation.

Reference: « Mixed-norm estimates for the M/EEG inverse problem using accelerated gradient methods Alexandre Gramfort, Matthieu Kowalski, Matti Hämäläinen »

set_beta_param(beta_param)[source]

Set beta_param.

reset_iter()[source]

Set iteration counter to zero.

op(data, extra_factor=1.0)[source]

Return input data after thresholding.

The extra factor is the beta_param! Should be used on the proximal operator function.

op_tobi_prox_l2(data)[source]

Apply the opterator on the whole data matrix.

for a vector: \(x = prox_{lambda || . ||^{2}_{w,2}}(y)\) \(=> x_i = y_i /(1 + lambda w_i)\) The operator can be used for the whole data matrix at once.

cost(x)[source]

Cost function. To do.