Main Content

Cross-validated kernel model for regression

`RegressionPartitionedKernel`

is a set of kernel
regression models trained on cross-validated folds. To obtain a cross-validated, kernel
regression model, use `fitrkernel`

and
specify one of the cross-validation options. You can estimate the predictive quality of the
model, or how well the linear regression model generalizes, using one or more of these “kfold”
methods: `kfoldPredict`

and
`kfoldLoss`

.

Every “kfold” method uses models trained on
*training-fold* observations to predict the response for
*validation-fold* observations. For example, suppose that you
cross-validate using five folds. In this case, the software randomly assigns each observation
into five groups of equal size (roughly). The *training fold* contains
four of the groups (that is, roughly 4/5 of the data) and the *validation
fold* contains the other group (that is, roughly 1/5 of the data). In this case,
cross-validation proceeds as follows:

The software trains the first model (stored in

`CVMdl.Trained{1}`

) using the observations in the last four groups and reserves the observations in the first group for validation.The software trains the second model (stored in

`CVMdl.Trained{2}`

) using the observations in the first group and the last three groups. The software reserves the observations in the second group for validation.The software proceeds in a similar fashion for the third through the fifth models.

If you validate by calling `kfoldPredict`

, it
computes predictions for the observations in group 1 using the first model, group 2 for the
second model, and so on. In short, the software estimates a response for every observation
using the model trained without that observation.

**Note**

`RegressionPartitionedKernel`

model objects do not store
the predictor data set.

Create a `RegressionPartitionedKernel`

object using the `fitrkernel`

function. Use one of the `'CrossVal'`

, `'CVPartition'`

,
`'Holdout'`

, `'KFold'`

, or
`'Leaveout'`

name-value pair arguments in the call to
`fitrkernel`

. For details, see the `fitrkernel`

function reference page.

`kfoldLoss` | Regression loss for cross-validated kernel regression model |

`kfoldPredict` | Predict responses for observations in cross-validated kernel regression model |