7 Stars
Updated Last
3 Years Ago
Started In
September 2016


K-SVD is an algorithm for creating overcomplete dictionaries for sparse representations.

This package implements:


Launch Julia and type



Assume that each column of Y represents a feature vector (or an input signal from some system).
D is a dictionary. Each column of D represents an atom.
K-SVD derives D and X such that DX ≈ Y from only Y.

D, X = ksvd(
    256,  # the number of atoms in D
    max_iter = 200,  # max iterations of K-SVD
    max_iter_mp = 40,  # max iterations of matching pursuit called in K-SVD
    sparsity_allowance = 0.96  # stop iteration when more than 96% of elements in X become zeros

Matching Pursuit derives X from D and Y such that DX = Y in constraint that X be as sparse as possible.

X_sparse = matching_pursuit(Y, D, max_iter = 200)


Samples of the digits dataset in scikit-learn and the obtained dictionary of 256 atoms.

images digits256

See examples for more details.

Provided functions

Only a few functions are provided: ksvd and matching_pursuit. See the documentation.