local_coordinate_coding: Local Coordinate Coding

View source: R/local_coordinate_coding.R

local_coordinate_codingR Documentation

Local Coordinate Coding

Description

An implementation of Local Coordinate Coding (LCC), a data transformation technique. Given input data, this transforms each point to be expressed as a linear combination of a few points in the dataset; once an LCC model is trained, it can be used to transform points later also.

Usage

local_coordinate_coding(
  atoms = NA,
  initial_dictionary = NA,
  input_model = NA,
  lambda = NA,
  max_iterations = NA,
  normalize = FALSE,
  seed = NA,
  test = NA,
  tolerance = NA,
  training = NA,
  verbose = FALSE
)

Arguments

atoms

Number of atoms in the dictionary. Default value "0" (integer).

initial_dictionary

Optional initial dictionary (numeric matrix).

input_model

Input LCC model (LocalCoordinateCoding).

lambda

Weighted l1-norm regularization parameter. Default value "0" (numeric).

max_iterations

Maximum number of iterations for LCC (0 indicates no limit). Default value "0" (integer).

normalize

If set, the input data matrix will be normalized before coding. Default value "FALSE" (logical).

seed

Random seed. If 0, 'std::time(NULL)' is used. Default value "0" (integer).

test

Test points to encode (numeric matrix).

tolerance

Tolerance for objective function. Default value "0.01" (numeric).

training

Matrix of training data (X) (numeric matrix).

verbose

Display informational messages and the full list of parameters and timers at the end of execution. Default value "FALSE" (logical).

Details

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.

Value

A list with several components:

codes

Output codes matrix (numeric matrix).

dictionary

Output dictionary matrix (numeric matrix).

output_model

Output for trained LCC model (LocalCoordinateCoding).

Author(s)

mlpack developers

Examples

# 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

## Not run: 
output <- local_coordinate_coding(training=data, atoms=200, lambda=0.1)
dict <- output$dictionary
codes <- output$codes

## End(Not run)

# 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:

## Not run: 
output <- local_coordinate_coding(input_model=lcc_model, test=points)
new_codes <- output$codes

## End(Not run)

mlpack documentation built on Oct. 29, 2022, 1:06 a.m.