Main Content


Class: RegressionSVM

Predict resubstitution response of support vector machine regression model


yfit = resubPredict(mdl)


yfit = resubPredict(mdl) returns a vector of predicted response values, yfit, for the trained support vector machine (SVM) regression model mdl using the predictor data stored in mdl.X.

Input Arguments

expand all

Full, trained SVM regression model, specified as a RegressionSVM model returned by fitrsvm.

Output Arguments

expand all

Predicted responses, returned as a vector of numeric values. The length of yfit is equal to the number of observations in the training data, mdl.NumObservations.

For details about how to predict responses, see Equation 1 and Equation 2 in Understanding Support Vector Machine Regression.


expand all

This example shows how to train an SVM regression model, then use the model to generate predicted response values from the training data.

This example uses the abalone data from the UCI Machine Learning Repository. Download the data and save it in your current directory with the name ''. Read the data into a table.

tbl = readtable('','Filetype','text','ReadVariableNames',false);
rng default  % for reproducibility

The sample data contains 4177 observations. All of the predictor variables are continuous except for sex, which is a categorical variable with possible values 'M' (for males), 'F' (for females), and 'I' (for infants). The goal is to predict the number of rings on the abalone, and thereby determine its age, using physical measurements.

Train an SVM regression model to the data, using a Gaussian kernel function with an automatic kernel scale. Standardize the data.

mdl = fitrsvm(tbl,'Var9','KernelFunction','gaussian','KernelScale','auto','Standardize',true);

Use the trained model to predict response values based on the original data.

yfit = resubPredict(mdl);

Display the first ten predicted responses alongside the actual response values.

ans =

   15.0000    8.1836
    7.0000    8.3545
    9.0000   10.9383
   10.0000    9.3446
    7.0000    6.4042
    8.0000    7.7910
   20.0000   13.8275
   16.0000   11.7959
    9.0000    9.5724
   19.0000   13.6909

The left column shows the actual response and the right column shows the corresponding predicted response.


[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, []. Irvine, CA: University of California, School of Information and Computer Science.

Version History

Introduced in R2015b