pysparse.cs.recovery package

Submodules

pysparse.cs.recovery.lasso module

pysparse.cs.recovery.lasso.lasso(y, A, alpha=0.5, normalize=False, max_iter=200, tol=1e-06, verbose=False)[source]

The optimization objective for Lasso is:

\[(1 / (2 * n_{samples})) * ||y - Xw||^2_2 + \alpha * ||w||_1 \]

Technically the Lasso model is optimizing the same objective function as the Elastic Net with l1_ratio=1.0 (no L2 penalty).

Parameters:
  • {[type]} -- [description] (A) –
  • {[type]} -- [description]
Keyword Arguments:
 
  • {float, optional} -- Constant that multiplies the L1 term. (default (alpha) – {0.5})
  • {boolean} -- If True, the regressors X will be normalized before regression by (normalize) – subtracting the mean and dividing by the l2-norm. (default: {True})
  • {int} -- The maximum number of iterations (default (max_iter) – {200})
  • {float} -- The tolerance for the optimization (default (tol) – {1.0e-6})

pysparse.cs.recovery.omp module

pysparse.cs.recovery.omp.omp(Y, A, k=None, normalize=False, tol=1e-06, verbose=False)[source]

Orthogonal Matching Pursuit

OMP find the sparse most decomposition

(1)\[{\bm y} = {\bm A}{\bm \alpha} = {\alpha}_1 {\bm a}_1 + {\alpha}_2 {\bm a}_2 + \cdots {\alpha}_n {\bm a}_n, \]

The optimization objective for omp is:

(2)\[{\rm min}_{\bm x} = \|{\bm x}\|_p + \lambda\|{\bm y} - {\bm A}{\bm x}\|_2. \]
Parameters:
  • y (ndarray) – signal vector or matrix, if \({\bm y}\in{\mathbb R}^{M\times 1}\) is a matrix, then apply OMP on each column
  • A (ndarary) – overcomplete dictionary ( \({\bm A}\in {\mathbb R}^{M\times N}\) )
Keyword Arguments:
 
  • k (integer) – The sparse degree (default: size of \({\bm x}\))
  • normalize (boolean) – If True, the regressors X will be normalized before regression by subtracting the mean and dividing by the l2-norm. (default: {True})
  • tol (float) – The tolerance for the optimization (default: {1.0e-6})
  • verbose (boolean) – show more log info.
pysparse.cs.recovery.omp.omp0(y, A, normalize=False, tol=1e-06, verbose=False)[source]

omp

Parameters:
  • {[type]} -- [description] (A) –
  • {[type]} -- [description]
Keyword Arguments:
 
  • {float, optional} -- Constant that multiplies the L1 term. (default (alpha) –
  • {boolean} -- If True, the regressors X will be normalized before regression by (normalize) – subtracting the mean and dividing by the l2-norm. (default: {True})
  • {int} -- The maximum number of iterations (default (max_iter) –
  • {float} -- The tolerance for the optimization (default (tol) –
pysparse.cs.recovery.omp.romp(Y, A, k=None, alpha=1e-06, normalize=False, tol=1e-06, verbose=False)[source]

Regularized Orthogonal Matching Pursuit

ROMP add a small penalty factor \(\alpha\) to

\[({\bm A}_{{\mathbb I}_t}^T{\bm A}_{{\mathbb I}_t})^{-1} \]

to avoid matrix singularity

\[({\bm A}_{{\mathbb I}_t}^T{\bm A}_{{\mathbb I}_t} + \alpha {\bm I})^{-1} \]

where, \(\alpha > 0\).

Parameters:
  • y (ndarray) – signal vector or matrix, if \({\bm y}\in{\mathbb R}^{M\times 1}\) is a matrix, then apply OMP on each column
  • A (ndarary) – overcomplete dictionary ( \({\bm A}\in {\mathbb R}^{M\times N}\) )
Keyword Arguments:
 
  • k (integer) – The sparse degree (default: size of \({\bm x}\))
  • alpha (float) – The regularization factor (default: 1.0e-6)
  • normalize (boolean) – If True, Y will be normalized before decomposition by subtracting the mean and dividing by the l2-norm. (default: {True})
  • tol (float) – The tolerance for the optimization (default: {1.0e-6})
  • verbose (boolean) – show more log info.

Module contents