This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

transform

Transform predictors into extracted features

Syntax

z = transform(Mdl,x)

Description

example

z = transform(Mdl,x) transforms the data x into the features z via the model Mdl.

Examples

collapse all

Create a feature transformation model with 100 features from the caltech101patches data.

rng('default') % For reproducibility
data = load('caltech101patches');
q = 100;
X = data.X;
Mdl = sparsefilt(X,q)
Warning: Solver LBFGS was not able to converge to a solution.
Mdl = 
  SparseFiltering
            ModelParameters: [1×1 struct]
              NumPredictors: 363
         NumLearnedFeatures: 100
                         Mu: []
                      Sigma: []
                    FitInfo: [1×1 struct]
           TransformWeights: [363×100 double]
    InitialTransformWeights: []


  Properties, Methods

sparsefilt 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.

Transform the first five rows of the input data X to the new feature space.

y = transform(Mdl,X(1:5,:));
size(y)
ans = 1×2

     5   100

Input Arguments

collapse all

Feature extraction model, specified as a SparseFiltering object or as a ReconstructionICA object. Create Mdl by using the sparsefilt function or the rica function.

Predictor data, specified as a matrix with p columns or as a table of numeric values with p columns. Here, p is the number of predictors in the model, which is Mdl.NumPredictors. Each row of the input matrix or table represents one data point to transform.

Data Types: single | double | table

Output Arguments

collapse all

Transformed data, returned as an n-by-q matrix. Here, n is the number of rows in the input data x, and q is the number of features, which is Mdl.NumLearnedFeatures.

Algorithms

transform converts data to predicted features by using the learned weight matrix W to map input predictors to output features.

  • For rica, input data X maps linearly to output features XW. See Reconstruction ICA Algorithm.

  • For sparsefilt, input data maps nonlinearly to output features F^(X,W). See Sparse Filtering Algorithm.

    Caution

    The result of transform for sparse filtering depends on the number of data points. In particular, the result of applying transform to each row of a matrix separately differs from the result of applying transform to the entire matrix at once.

Introduced in R2017a