This topic describes the support vector regression (SVR) algorithm.

Overview

SVR is an application branch of support vector machine (SVM). SVR can be used to find a regression plane from which all data elements in a set have the shortest distance.

Scenarios

SVR is a regression model that is primarily used to fit values and in scenarios with sparse features and a small number of features.

For example, an SVR model can be used to predict the temperature of a city. The input includes many features, such as the average temperature of the city within a period, greening rate, the number of lakes, and the date. The temperature of the city within a period can be used to train the model.

Parameters

The parameters in the following table are the values of the model_parameter parameters in the CREATE MODEL statement for creating a model. You can select the values based on your needs.

ParameterDescription
kernelThe kernel function, which is used to map low-dimensional data to high-dimensional space. Default value: rbf. Valid values:
  • rbf: the radial basis function. It can be used to map a sample to a high-dimensional space.
  • linear: the linear kernel function. It is mainly used in linear separation. The feature space has the same dimensions as the input space. It requires fewer parameters and provides higher speed.
  • poly: polynomial kernel function. It can be used to map low-dimensional input space to a high-dimensional feature space. It requires more parameters.
  • sigmoid: has a similar effect to that of a multi-layer neural network.
cThe penalty coefficient of the relaxation coefficient. It is a floating-point number greater than 0 and can be left empty. Default value: 1.
Note If the data quality is poor, you can appropriately decrease the value of the c parameter.
epsilonThe threshold of the SVR loss function. When the difference between the predicted value and the actual value is equal to the threshold, the loss of the sample is calculated. Default value: 0.1.
max_iterThe maximum number of iterations. Valid values: positive integer and -1. Default value: -1.
Note If this parameter is set to -1, the iteration continues until it converges to the epsilon value.

Examples

Create a model and an offline training task.
/*polar4ai*/
CREATE MODEL svr1 WITH
( model_class = 'svr', x_cols = 'dx1,dx2', y_cols='y',
 model_parameter=(kernel='rbf')) AS (select * from db4ai.testdata1)
Use the model for prediction.
/*polar4ai*/select dx1,dx2 FROM
PREDICT(MODEL svr1, select * from db4ai.testdata1 limit 10)
WITH (x_cols = 'dx1,dx2', y_cols='')
Note The columns in x_cols and y_cols must use floating-point or integer data.