Categories &

Functions List

Function Reference: rica

statistics: Mdl = rica (X, Q)
statistics: Mdl = rica (X, Q, Name, Value)

Reconstruction independent component analysis (RICA) for feature extraction.

Mdl = rica (X, Q) learns Q features from the N × P data matrix X (rows are observations, columns are predictors) and returns a ReconstructionICA object Mdl. Apply the learned transformation to data with transform (Mdl, X), which returns X * Mdl.TransformWeights.

The P × Q weight matrix (with unit-length columns) minimizes the objective

 
 Lambda * ||X * W * W' - X||_F^2
       + sum (sum (g (X * W)))

over the transformation weights W, combining a reconstruction cost with a sparsity contrast g applied elementwise and selected by 'ContrastFcn'.

Name/Value pairs:

'IterationLimit'
Maximum number of iterations (default 1000).
'Lambda'
Weight of the reconstruction term (default 1).
'Standardize'
Logical; center and scale each predictor before fitting (default false).
'ContrastFcn'
The sparsity contrast g applied to each element z of X × W: 'logcosh' (default), which is 0.5 × log (cosh (2 × z)); 'exp', which is -exp (-z^2 / 2); or 'sqrt', which is sqrt (z^2 + 1e-8), a smooth stand-in for abs (z).
'InitialTransformWeights'
A P × Q initial value for the weights. The default is random.
'GradientTolerance', 'StepTolerance'
Stop once the gradient’s or the step’s infinity norm falls to or below the given value (default 1e-6 each). They govern the fit only under 'Solver', 'lbfgs'; the 'quasinewton' solver runs to its own tighter internal tolerances and records these without acting on them.
'Solver'
'quasinewton' (default) minimizes through Octave’s fminunc, which carries a full inverse Hessian. 'lbfgs' selects the limited-memory BFGS solver MATLAB uses, holding as many curvature pairs as the transform has parameters, and is several times faster here. It stops where 'GradientTolerance' and 'StepTolerance' say to, so a value tighter than the default carries it further.

Note on reproducibility

The RICA objective is not convex and is minimized by a quasi-Newton solver, so the learned weights depend on the starting point and the solver, and are only defined up to a permutation and sign of the feature columns. Different runs (or different software, including MATLAB) may return different weights that nonetheless describe an equally valid feature transformation. Fix 'InitialTransformWeights' for a reproducible result.

See also: ReconstructionICA, sparsefilt, pca

Source Code: rica

Learn two features from data with the default (random) start.

 X = [1, 2, 3, 4; 2, 3, 4, 5; -1, 0, 1, 2; 3, 1, 4, 1; 0, 2, 1, 3];
 Mdl = rica (X, 2, "IterationLimit", 200);
 Z = transform (Mdl, X)
Z =

  -5.4695   0.1853
  -7.3347  -0.3226
  -1.7392   1.2012
  -3.9338  -3.3743
  -3.4565   1.3492