Main Content

transform

Transform predictors into extracted features

Description

example

z= transform(Mdl,x)transforms the dataxinto the featureszvia the modelMdl.

Examples

collapse all

Create a feature transformation model with 100 features from theSampleImagePatchesdata.

rng(“默认”)% For reproducibilitydata = load('SampleImagePatches'); q = 100; X = data.X; Mdl = sparsefilt(X,q)
Warning: Solver LBFGS was not able to converge to a solution.
Mdl = SparseFiltering ModelParameters: [1x1 struct] NumPredictors: 363 NumLearnedFeatures: 100 Mu: [] Sigma: [] FitInfo: [1x1 struct] TransformWeights: [363x100 double] InitialTransformWeights: [] Properties, Methods

sparsefiltissues 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 thetransformfunction.

Transform the first five rows of the input dataXto the new feature space.

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

Input Arguments

collapse all

Feature extraction model, specified as aSparseFilteringobject or as aReconstructionICAobject. CreateMdlby using thesparsefiltfunction or thericafunction.

Predictor data, specified as a matrix withpcolumns or as a table of numeric values withpcolumns. Here,pis the number of predictors in the model, which isMdl.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 ann-by-qmatrix. Here,nis the number of rows in the input datax, andqis the number of features, which isMdl.NumLearnedFeatures.

Algorithms

transformconverts data to predicted features by using the learned weight matrixWto map input predictors to output features.

  • Forrica, input dataXmaps linearly to output featuresXW. SeeReconstruction ICA Algorithm.

  • Forsparsefilt, input data maps nonlinearly to output features F ^ (X,W). SeeSparse Filtering Algorithm.

    Caution

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

版本历史

Introduced in R2017a