# resubPredict

Class: RegressionSVM

Predict resubstitution response of support vector machine regression model

## Syntax

```yfit = resubPredict(mdl) ```

## Description

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

## Examples

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 `'abalone.data'`. Read the data into a `table`.

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

`[mdl.Y(1:10),yfit(1:10)]`
```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.

## References

 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, Ph.D. thesis, Computer Science Department, University of Tasmania, 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.
{"ft_lang_label":"__label__en","ft_lang_prob":0.7116014,"math_prob":0.78651154,"size":1090,"snap":"2020-45-2020-50","text_gpt3_token_len":298,"char_repetition_ratio":0.09668508,"word_repetition_ratio":0.0,"special_character_ratio":0.23944955,"punctuation_ratio":0.27272728,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.97609204,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-10-20T09:35:30Z\",\"WARC-Record-ID\":\"<urn:uuid:97adc1f2-8b43-4c14-8203-0a4636e16d96>\",\"Content-Length\":\"73461\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:870576e2-7118-4597-bf50-e09e45bde3ce>\",\"WARC-Concurrent-To\":\"<urn:uuid:436570c1-4d69-465e-852d-bf7333d9d354>\",\"WARC-IP-Address\":\"23.223.252.57\",\"WARC-Target-URI\":\"https://la.mathworks.com/help/stats/regressionsvm.resubpredict.html\",\"WARC-Payload-Digest\":\"sha1:HJCIJ6P6ZXIZGC7PKGEDIJRU7Z25PNGT\",\"WARC-Block-Digest\":\"sha1:2M2EBWH53EHVLEKXIWXNLJPC4IQ627OF\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-45/CC-MAIN-2020-45_segments_1603107871231.19_warc_CC-MAIN-20201020080044-20201020110044-00245.warc.gz\"}"}