SVM is not only applicable to classification but also to regression. The steps are mostly the same as in the case of classification. We just need very slight modification in the syntax.

Again, we will use the diamonds dataset as we did in the classification.

If we’d like to use the default settings, we can use svm() .

But if we would like to run the combination of the variables, we then can use tune()  as we did in classification. The only small difference is that we also need to add an epsilon value as it is used in the regression calculation.

Next, we need to fit a separate model from svm()  as predict()  is not applicable to the tune class.