dicodile.dicodile

dicodile.dicodile(X, D_init, reg=0.1, n_iter=100, eps=1e-05, window=False, z_positive=True, n_workers=4, w_world='auto', tol=0.001, hostfile=None, dicod_kwargs={}, random_state=None, verbose=0)

Convolutional dictionary learning.

Computes a sparse representation of a signal X, returning a dictionary D and a sparse activation signal Z such that X is close to \(Z \ast D\).

This is done by solving the following optimization problem:

\[\underset{Z,D, \left \| D_{k}\right \|\leq 1}{min} \frac{1}{2} \left \| X - Z \ast D \right\|_{2}^{2} + \lambda \left \| Z \right \|_{1}\]

The support for X is noted sig_support.

The support for D is noted atom_support.

Parameters:
Xndarray, shape (n_channels, *sig_support)

Signal to encode.

For example, a 3-channel RGB image of definition 640x480 would have a shape of (3, 640, 480), a grayscale image of the same definition would have a shape of (1, 640, 480), a single time series would have a shape of (1, number_of_samples)

D_initndarray, shape (n_atoms, n_channels, *atom_support)

Current atoms dictionary.

regfloat, defaults to .1

Regularization parameter, in [0,1] The λ parameter is computed as reg * lambda_max

n_iterint, defaults to 100

Maximum number of iterations

epsfloat, defaults to 1e-5

Tolerance for the stopping criterion. A lower value will result in more computing time.

windowbool

If set to True, the learned atoms are multiplied by a Tukey window that sets its borders to 0. This can help having patterns localized in the middle of the atom support and reduces border effects.

z_positivebool, default True

If True, adds a constraint that the activations Z must be positive.

n_workersint, defaults to 4

Number of workers used to compute the convolutional sparse coding solution.

w_worldint or {{‘auto’}}

Number of jobs used per row in the splitting grid. This should divide n_workers.

tolfloat, defaults to 1e-3

Tolerance for minimal update size.

hostfilestr or None

MPI hostfile as used by mpirun. See your MPI implementation documentation. Defaults to None.

dicod_kwargsdict

Extra arguments passed to the dicod function. See dicodile.update_z.dicod

random_stateNone or int or RandomState

Random state to seed the random number generator.

verboseint, defaults to 0

Verbosity level, higher is more verbose.

Returns:
D_hatndarray, shape (n_channels, *sig_support)

Updated atoms dictionary.

Z_hatndarray, shape (n_channels, *valid_support)

Activations of the different atoms (where or when the atoms are estimated).

pobjlist of float

list of costs

timeslist of float

list of running times (seconds) for each dictionary and activation update step. The total running time of the algorithm is given by sum(times)

See also

dicodile.update_z.dicod

Convolutional sparse coding.