Predict resubstitution response of support vector machine regression model
yfit = resubPredict(mdl)
yfit— Predicted response
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
'abalone.data'. Read the data into a
tbl = readtable('abalone.data','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.
 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.
 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.
 Clark, D., Z. Schreter, A. "Adams. A Quantitative Comparison of Dystal and Backpropagation." submitted to the Australian Conference on Neural Networks, 1996.
 Lichman, M. UCI Machine Learning Repository, [http://archive.ics.uci.edu/ml]. Irvine, CA: University of California, School of Information and Computer Science.