Main Content

CompactRegressionSVM

R2026b

Compact support vector machine regression model

Description

CompactRegressionSVM is a compact support vector machine (SVM) regression model. The compact model consumes less memory than the full support vector machine model (RegressionSVM) because it does not store the data used to train the model. Because the compact model does not store the training data, you cannot use it to perform certain tasks, such as cross-validation. However, you can use a compact SVM regression model to predict responses using new input data.

Creation

Create a CompactRegressionSVM object from a full RegressionSVM model object by using compact.

Properties

expand all

SVM Properties

This property is read-only.

Dual problem coefficients, returned as a vector of numeric values. Alpha contains m elements, where m is the number of support vectors in the trained SVM regression model. The dual problem introduces two Lagrange multipliers for each support vector. The values of Alpha are the differences between the two estimated Lagrange multipliers for the support vectors. For more details, see Understanding Support Vector Machine Regression.

If you specified to remove duplicates using RemoveDuplicates, then, for a particular set of duplicate observations that are support vectors, Alpha contains one coefficient corresponding to the entire set. That is, MATLAB® attributes a nonzero coefficient to one observation from the set of duplicates and a coefficient of 0 to all other duplicate observations in the set.

Data Types: single | double

This property is read-only.

Primal linear problem coefficients, returned as a numeric vector of length p, where p is the number of predictors in the SVM regression model.

The values in Beta are the linear coefficients for the primal optimization problem.

If the model is obtained using a kernel function other than 'linear', this property is empty ('[]').

The predict function computes predicted response values for the model as YFIT = (X/S)×Beta + Bias, where S is the value of the kernel scale stored in the KernelParameters.Scale property.

Data Types: double

This property is read-only.

Bias term in the SVM regression model, returned as a scalar value.

Data Types: double

This property is read-only.

Kernel function parameters, returned as a structure with the following fields.

FieldDescription
Function Kernel function name (a character vector).
ScaleNumeric scale factor used to divide predictor values.

You can specify values for KernelParameters.Function and KernelParameters.Scale by using the KernelFunction and KernelScale name-value arguments in fitrsvm, respectively.

Data Types: struct

This property is read-only.

Support vectors, returned as an m-by-p matrix of numeric values. m is the number of support vectors (sum(Mdl.IsSupportVector)), and p is the number of predictors in X.

If you specified to remove duplicates using RemoveDuplicates, then for a given set of duplicate observations that are support vectors, SupportVectors contains one unique support vector.

Data Types: single | double

Data Properties

This property is read-only.

Categorical predictor indices, returned as a vector of positive integers. CategoricalPredictors contains index values indicating that the corresponding predictors are categorical. The index values are between 1 and p, where p is the number of predictors used to train the model. If none of the predictors are categorical, then this property is empty ([]).

Data Types: single | double

This property is read-only.

Expanded predictor names, returned as a cell array of character vectors.

If the model uses encoding for categorical variables, then ExpandedPredictorNames includes the names that describe the expanded variables. Otherwise, ExpandedPredictorNames is the same as PredictorNames.

Data Types: cell

This property is read-only.

Predictor means, returned as a vector of numeric values.

If the training data is standardized, then Mu is a numeric vector of length p, where p is the number of predictors used to train the model. In this case, the predict function centers predictor matrix X by subtracting the corresponding element of Mu from each column.

If the training data is not standardized, then Mu is empty ('[]').

Data Types: single | double

This property is read-only.

Predictor names, returned as a cell array of character vectors containing the name of each predictor in the order in which they appear in X. PredictorNames has a length equal to the number of columns in X.

Data Types: cell

This property is read-only.

Response variable name, returned as a character vector.

Data Types: char

Response transformation function, specified as "none" or a function handle. ResponseTransform describes how the software transforms raw response values.

For a MATLAB function or a function that you define, enter its function handle. For example, you can enter Mdl.ResponseTransform = @function, where function accepts a numeric vector of the original responses and returns a numeric vector of the same size containing the transformed responses.

Data Types: char | string | function_handle

This property is read-only.

Predictor standard deviations, returned as a vector of numeric values.

If the training data is standardized, then Sigma is a numeric vector of length p, where p is the number of predictors used to train the model. In this case, the predict function scales the predictor matrix X by dividing each column by the corresponding element of Sigma, after centering each element using Mu.

If the training data is not standardized, then Sigma is empty ('[]').

Data Types: single | double

Object Functions

discardSupportVectorsDiscard support vectors for linear support vector machine (SVM) regression model
gatherGather properties of Statistics and Machine Learning Toolbox object from GPU
incrementalLearnerConvert support vector machine (SVM) regression model to incremental learner
limeLocal interpretable model-agnostic explanations (LIME)
lossRegression error for support vector machine regression model
partialDependenceCompute partial dependence
plotPartialDependenceCreate partial dependence plot (PDP) and individual conditional expectation (ICE) plots
predictPredict responses using support vector machine regression model
shapleyShapley values
updateUpdate model parameters for code generation

Examples

collapse all

Reduce the size of a full support vector machine (SVM) regression model by removing the training data. Full SVM regression models (that is, RegressionSVM models) hold the training data. To improve efficiency, use a smaller model.

Load the carbig data set. Specify Horsepower and Weight as the predictor variables (X) and MPG as the response variable (Y).

load carbig
X = [Horsepower,Weight];
Y = MPG;

Train a full SVM regression model. Standardize the predictor data.

Mdl = fitrsvm(X,Y,Standardize=true)
Mdl = 
  RegressionSVM
             ResponseName: 'Y'
    CategoricalPredictors: []
        ResponseTransform: 'none'
                    Alpha: [311×1 double]
                     Bias: 22.9635
         KernelParameters: [1×1 struct]
                       Mu: [104.4694 2.9776e+03]
                    Sigma: [38.4912 849.4026]
          NumObservations: 398
           BoxConstraints: [398×1 double]
          ConvergenceInfo: [1×1 struct]
          IsSupportVector: [398×1 logical]
                   Solver: 'SMO'


  Properties, Methods

Mdl is a RegressionSVM model object.

Reduce the size of the SVM regression model.

compactMdl = compact(Mdl)
compactMdl = 
  CompactRegressionSVM
             ResponseName: 'Y'
    CategoricalPredictors: []
        ResponseTransform: 'none'
                    Alpha: [311×1 double]
                     Bias: 22.9635
         KernelParameters: [1×1 struct]
                       Mu: [104.4694 2.9776e+03]
                    Sigma: [38.4912 849.4026]
           SupportVectors: [311×2 double]


  Properties, Methods

compactMdl is a CompactRegressionSVM model object.

Display the amount of memory used by each regression model.

whos("Mdl","compactMdl")
  Name            Size            Bytes  Class                                          Attributes

  Mdl             1x1             39210  RegressionSVM                                            
  compactMdl      1x1             10765  classreg.learning.regr.CompactRegressionSVM              

The full model (Mdl) is larger than the compact model (compactMdl).

References

[1] Nash, W.J., T. L. Sellers, S. R. Talbot, A. J. Cawthorn, and W. B. Ford. "The Population Biology of Abalone (Haliotis species) in Tasmania. I. Blacklip Abalone (H. rubra) from the North Coast and Islands of Bass Strait." Sea Fisheries Division, Technical Report No. 48, 1994.

[2] Waugh, S. "Extending and Benchmarking Cascade-Correlation: Extensions to the Cascade-Correlation Architecture and Benchmarking of Feed-forward Supervised Artificial Neural Networks." University of Tasmania Department of Computer Science thesis, 1995.

[3] Clark, D., Z. Schreter, A. Adams. "A Quantitative Comparison of Dystal and Backpropagation." submitted to the Australian Conference on Neural Networks, 1996.

[4] Lichman, M. UCI Machine Learning Repository, [http://archive.ics.uci.edu/ml]. Irvine, CA: University of California, School of Information and Computer Science.

Extended Capabilities

expand all

Version History

Introduced in R2015b

expand all