Support Vector Regression (SVR) is a regression algorithm built on support vector machine (SVM). SVR finds a regression plane from which all data elements in a set have the shortest distance. SVR is well-suited for datasets with sparse features or a small number of input features.
Use cases
SVR works well for numerical prediction tasks where:
The dataset has sparse features or a small number of input features
The relationship between inputs and output may be non-linear (use
rbforpolykernel)The data contains noise and you want the model to tolerate small prediction errors
Example: Predict the temperature of a city using input features such as historical average temperature over a period, greenery coverage percentage, number of nearby lakes, and the date.
Parameters
All parameters are passed as model_parameter values in the CREATE MODEL statement.
| Parameter | Description | Default |
|---|---|---|
kernel | The kernel function used to map input data to a higher-dimensional space. See Choose a kernel for guidance. Valid values: rbf, linear, poly, sigmoid. | rbf |
c | Penalty coefficient of the relaxation coefficient. Must be a floating-point number greater than 0; can be left empty. For noisy or low-quality data, reduce this value. | 1 |
epsilon | Defines the epsilon-tube: predictions within epsilon of the actual value are not penalized in the loss function. Only predictions outside this margin contribute to the loss. Default value: 0.1. | 0.1 |
max_iter | Maximum number of training iterations. Valid values: positive integer and -1. Set to -1 for no limit — training continues until convergence within epsilon. | -1 |
Choose a kernel
| Kernel | Best for | Trade-off |
|---|---|---|
rbf | Non-linear data (most use cases) | Default; handles a wide range of data distributions |
linear | Linearly separable data | Fewer parameters, faster training; feature space matches input space |
poly | Polynomial relationships between features | Requires more parameters |
sigmoid | — | Similar effect to a multi-layer neural network |
Examples
All three examples use the /*polar4ai*/ comment prefix to route queries through the polar4ai engine.
Create an SVR model
/*polar4ai*/CREATE MODEL svr1 WITH
( model_class = 'svr', x_cols = 'dx1,dx2', y_cols='y',
model_parameter=(kernel='rbf')) AS (SELECT * FROM db4ai.testdata1);Evaluate the model
/*polar4ai*/SELECT dx1,dx2 FROM EVALUATE(MODEL svr1,
SELECT * FROM db4ai.testdata1 LIMIT 10) WITH
(x_cols = 'dx1,dx2',y_cols='y',metrics='r2_score');Run predictions
/*polar4ai*/SELECT dx1,dx2 FROM
PREDICT(MODEL svr1, SELECT * FROM db4ai.testdata1 LIMIT 10)
WITH (x_cols = 'dx1,dx2');x_cols and y_cols must be floating-point or integer data types.