Main Content

rica

Feature extraction by using reconstruction ICA

Description

Mdl = rica(X,q) returns a reconstruction independent component analysis (RICA) model object that contains the results from applying RICA to the table or matrix of predictor data X containing p variables. q is the number of features to extract from X, therefore rica learns a p-by-q matrix of transformation weights. For undercomplete or overcomplete feature representations, q can be less than or greater than the number of predictor variables, respectively.

  • To access the learned transformation weights, use Mdl.TransformWeights.

  • To transform X to the new set of features by using the learned transformation, pass Mdl and X to transform.

Mdl = rica(X,q,Name,Value) uses additional options specified by one or more Name,Value pair arguments. For example, you can standardize the predictor data or specify the value of the penalty coefficient in the reconstruction term of the objective function.

example

Examples

collapse all

Create a ReconstructionICA object by using the rica function.

Load the SampleImagePatches image patches.

data = load('SampleImagePatches');
size(data.X)
ans = 1×2

        5000         363

There are 5,000 image patches, each containing 363 features.

Extract 100 features from the data.

rng default % For reproducibility
q = 100;
Mdl = rica(data.X,q,'IterationLimit',100)
Warning: Solver LBFGS was not able to converge to a solution.
Mdl = 
  ReconstructionICA
            ModelParameters: [1x1 struct]
              NumPredictors: 363
         NumLearnedFeatures: 100
                         Mu: []
                      Sigma: []
                    FitInfo: [1x1 struct]
           TransformWeights: [363x100 double]
    InitialTransformWeights: []
    NonGaussianityIndicator: [100x1 double]


rica issues a warning because it stopped due to reaching the iteration limit, instead of reaching a step-size limit or a gradient-size limit. You can still use the learned features in the returned object by calling the transform function.

Input Arguments

collapse all

Predictor data, specified as an n-by-p numeric matrix or table. Rows correspond to individual observations and columns correspond to individual predictor variables. If X is a table, then all of its variables must be numeric vectors.

Data Types: single | double | table

Number of features to extract from the predictor data, specified as a positive integer.

rica stores a p-by-q transform weight matrix in Mdl.TransformWeights. Therefore, setting very large values for q can result in greater memory consumption and increased computation time.

Data Types: single | double

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: Mdl = rica(X,q,'IterationLimit',200,'Standardize',true) runs rica with optimization iterations limited to 200 and standardized predictor data.

Maximum number of iterations, specified as the comma-separated pair consisting of 'IterationLimit' and a positive integer.

Example: 'IterationLimit',1e6

Data Types: single | double

Verbosity level for monitoring algorithm convergence, specified as the comma-separated pair consisting of 'VerbosityLevel' and a value in this table.

ValueDescription
0rica does not display convergence information at the command line.
Positive integerrica displays convergence information at the command line.

Convergence Information

HeadingMeaning
FUN VALUEObjective function value.
NORM GRADNorm of the gradient of the objective function.
NORM STEPNorm of the iterative step, meaning the distance between the previous point and the current point.
CURVOK means the weak Wolfe condition is satisfied. This condition is a combination of sufficient decrease of the objective function and a curvature condition.
GAMMAInner product of the step times the gradient difference, divided by the inner product of the gradient difference with itself. The gradient difference is the gradient at the current point minus the gradient at the previous point. Gives diagnostic information on the objective function curvature.
ALPHAStep direction multiplier, which differs from 1 when the algorithm performed a line search.
ACCEPTYES means the algorithm found an acceptable step to take.

Example: 'VerbosityLevel',1

Data Types: single | double

Regularization coefficient value for the transform weight matrix, specified as the comma-separated pair consisting of 'Lambda' and a positive numeric scalar. If you specify 0, then there is no regularization term in the objective function.

Example: 'Lambda',0.1

Data Types: single | double

Flag to standardize the predictor data, specified as the comma-separated pair consisting of 'Standardize' and true (1) or false (0).

If Standardize is true, then:

  • rica centers and scales each column of the predictor data (X) by the column mean and standard deviation, respectively.

  • rica extracts new features by using the standardized predictor matrix, and stores the predictor variable means and standard deviations in properties Mu and Sigma of Mdl.

Example: 'Standardize',true

Data Types: logical

Contrast function, specified as 'logcosh', 'exp', or 'sqrt'. The contrast function is a smooth function that is similar to an absolute value function. The rica objective function contains a term

j=1q1ni=1ng(wjTx˜i),

where g represents the contrast function, the wj are the variables over which the optimization takes place, and the x˜i are data.

The three available contrast functions are:

  • 'logcosh'g=12log(cosh(2x))

  • 'exp'g=exp(x22)

  • 'sqrt'g=x2+108

Example: 'ContrastFcn','exp'

Transformation weights that initialize optimization, specified as the comma-separated pair consisting of 'InitialTransformWeights' and a p-by-q numeric matrix. p must be the number of columns or variables in X and q is the value of q.

Tip

You can continue optimizing a previously returned transform weight matrix by passing it as an initial value in another call to rica. The output model object Mdl stores a learned transform weight matrix in the TransformWeights property.

Example: 'InitialTransformWeights',Mdl.TransformWeights

Data Types: single | double

Non-Gaussianity of sources, specified as a length-q vector of ±1.

  • NonGaussianityIndicator(k) = 1 means rica models the kth source as super-Gaussian, with a sharp peak at 0.

  • NonGaussianityIndicator(k) = -1 means rica models the kth source as sub-Gaussian.

Data Types: single | double

Relative convergence tolerance on gradient norm, specified as the comma-separated pair consisting of 'GradientTolerance' and a positive numeric scalar. This gradient is the gradient of the objective function.

Example: 'GradientTolerance',1e-4

Data Types: single | double

Absolute convergence tolerance on the step size, specified as the comma-separated pair consisting of 'StepTolerance' and a positive numeric scalar.

Example: 'StepTolerance',1e-4

Data Types: single | double

Output Arguments

collapse all

Learned reconstruction ICA model, returned as a ReconstructionICA model object.

To access properties of Mdl, use dot notation. For example:

  • To access the learned transform weights, use Mdl.TransformWeights.

  • To access the structure of fitting information, use Mdl.FitInfo.

Algorithms

The rica function creates a linear transformation of input features to output features. The transformation is based on optimizing a nonlinear objective function that roughly balances statistical independence of the output features versus the ability to reconstruct the input data using the output features.

For details, see Reconstruction ICA Algorithm.

Version History

Introduced in R2017a