Local Coordinate Coding

>>> from mlpack import local_coordinate_coding

An implementation of Local Coordinate Coding (LCC), which codes data that approximately lives on a manifold using a variation of l1-norm regularized sparse coding. Given a dense data matrix X with n points and d dimensions, LCC seeks to find a dense dictionary matrix D with k atoms in d dimensions, and a coding matrix Z with n points in k dimensions. Because of the regularization method used, the atoms in D should lie close to the manifold on which the data points lie.

The original data matrix X can then be reconstructed as D * Z. Therefore, this program finds a representation of each point in X as a sparse linear combination of atoms in the dictionary D.

The coding is found with an algorithm which alternates between a dictionary step, which updates the dictionary D, and a coding step, which updates the coding matrix Z.

To run this program, the input matrix X must be specified (with -i), along with the number of atoms in the dictionary (-k). An initial dictionary may also be specified with the 'initial_dictionary' parameter. The l1-norm regularization parameter is specified with the 'lambda_' parameter. For example, to run LCC on the dataset 'data' using 200 atoms and an l1-regularization parameter of 0.1, saving the dictionary 'dictionary' and the codes into 'codes', use

>>> local_coordinate_coding(training=data, atoms=200, lambda_=0.1)
>>> dict = output['dictionary']
>>> codes = output['codes']

The maximum number of iterations may be specified with the 'max_iterations' parameter. Optionally, the input data matrix X can be normalized before coding with the 'normalize' parameter.

An LCC model may be saved using the 'output_model' output parameter. Then, to encode new points from the dataset 'points' with the previously saved model 'lcc_model', saving the new codes to 'new_codes', the following command can be used:

>>> local_coordinate_coding(input_model=lcc_model, test=points)
>>> new_codes = output['codes']

input options

output options

The return value from the binding is a dict containing the following elements: