You are not really doing time-series prediction. You are trying to predict each element of Y from a single element of X, which means that you are just solving a standard kernelized regression problem.

Another problem is when computing the RBF kernel over a range of vectors [[0],[1],[2],...], you will get a band of positive values along the diagonal of the kernel matrix while values far from the diagonal will be close to zero. The test set portion of your kernel matrix is far from the diagonal and will therefore be very close to zero, which would cause all of the SVR predictions to be close to the bias term.

For time series prediction I suggest building the training test set as

 x[0]=Y[0:K]; y[0]=Y[K]
 x[1]=Y[1:K+1]; y[1]=Y[K+1]
 ...

that is, try to predict future elements of the sequence from a window of previous elements.

Answer from user1149913 on Stack Overflow
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ machine learning โ€บ time-series-forecasting-with-support-vector-regression
Time Series Forecasting with Support Vector Regression - GeeksforGeeks
July 23, 2025 - Support Vector Regression (SVR) is a supervised learning technique in SVMs that aims to find the hyperplane in a high-dimensional feature space that best fits the training data and minimizes the prediction error for regression tasks.
๐ŸŒ
GitHub
github.com โ€บ microsoft โ€บ ML-For-Beginners โ€บ blob โ€บ main โ€บ 7-TimeSeries โ€บ 3-SVR โ€บ README.md
ML-For-Beginners/7-TimeSeries/3-SVR/README.md at main ยท microsoft/ML-For-Beginners
Support Vector Regressor (SVR): A type of SVM, to find the best fit line (which in the case of SVM is a hyperplane) that has the maximum number of data points. In the last lesson you learned about ARIMA, which is a very successful statistical ...
Author ย  microsoft
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 48715867 โ€บ support-vector-regression-time-series-forecasting-python
scikit learn - support vector regression time series forecasting - python - Stack Overflow
I have a dataset of peak load for a year. Its a simple two column dataset with the date and load(kWh). I want to train it on the first 9 months and then let it predict the next three months . I ...
Top answer
1 of 3
20

In the context of support vector regression, the fact that your data is a time series is mainly relevant from a methodological standpoint -- for example, you can't do a k-fold cross validation, and you need to take precautions when running backtests/simulations.

Basically, support vector regression is a discriminative regression technique much like any other discriminative regression technique. You give it a set of input vectors and associated responses, and it fits a model to try and predict the response given a new input vector. Kernel SVR, on the other hand, applies one of many transformations to your data set prior to the learning step. This allows it to pick up nonlinear trends in the data set, unlike e.g. linear regression. A good kernel to start with would probably be the Gaussian RBF -- it will have a hyperparameter you can tune, so try out a couple values. And then when you get a feeling for what's going on you can try out other kernels.

With a time series, an import step is determining what your "feature vector" will be; each is called a "feature" and can be calculated from present or past data, and each , the response, will be the future change over some time period of whatever you're trying to predict. Take a stock for example. You have prices over time. Maybe your features are a.) the 200MA-30MA spread and b.) 20-day volatility, so you calculate each at each point in time, along with , the (say) following week's return on that stock. Thus, your SVR learns how to predict the following week's return based on the present MA spread and 20-day vol. (This strategy won't work, so don't get too excited ;)).

If the papers you read were too difficult, you probably don't want to try to implement an SVM yourself, as it can be complicated. IIRC there is a "kernlab" package for R that has a Kernel SVM implementation with a number of kernels included, so that would provide a quick way to get up and running.

2 of 3
1

My personal answer to the question as asked is "yes". You may view it as a pro or a con that there are an infinite number of choices of features to describe the past.Try to pick features that correspond to how you might concisely describe to someone what the market has just done [eg "the price is at 1.4" tells you nothing if it is not related to some other number]. As for the target of the SVM, the simplest are the difference in prices and the ratio of prices for two consecutive days. As these correspond directly to the fate of a hypothetical trade, they seem good choices.

I have to pedantically disagree with the first statement by Jason: you can do k-fold cross-validation in situations like that described by raconteur and it is useful (with a proviso I will explain). The reason it is statistically valid is that the instances of the target in this case have no intrinsic relationship: they are disjoint differences or ratios. If you choose instead to use data at higher resolution than the scale of the target, there would be reason for concern that correlated instances might appear in the training set and validation set, which would compromise the cross-validation (by contrast, when applying the SVM you will have no instances available whose targets overlap the one you are interested in).

The thing that does reduce the effectiveness of cross-validation is if the behavior of the market is changing over time. There are two possible ways to deal with this. The first is to incorporate time as a feature (I've not found this very useful, perhaps because the values of this feature in the future are all new). A well-motivated alternative is to use walk-forward validation (which means testing your methodology on a sliding window of time, and testing it on the period just after this window. If behaviour is changing over time, the saying attributed to Niels Bohr "Prediction is very difficult, especially about the future" is especially appropriate. There is some evidence in the literature that the behaviour of financial markets does change over time, generally becoming more efficient, which typically means that successful trading systems deteriorate in performance over time.

Good luck!

๐ŸŒ
Medium
medium.com โ€บ @hassanishaq โ€บ time-series-forecasting-with-support-vector-regression-svr-aab08da8cd77
Time Series Forecasting with Support Vector Regression (SVR) | by Hassan Ishaq | Medium
July 9, 2023 - Support Vector Regression is an extension of SVMs that can be used for solving regression problems. SVR aims to find a function that approximates the mapping from input features to the target variable.
๐ŸŒ
Medium
medium.com โ€บ @niousha.rf โ€บ support-vector-regressor-theory-and-coding-exercise-in-python-ca6a7dfda927
From Theory to Practice: Implementing Support Vector Regression for Predictions in Python | by Niousha Rasifaghihi | Medium
November 14, 2023 - From Theory to Practice: Implementing Support Vector Regression for Predictions in Python Are you looking to gain a deeper understanding of Support Vector Regression (SVR) and how it can be โ€ฆ
๐ŸŒ
PLOS
journals.plos.org โ€บ plosone โ€บ article
Financial time series forecasting using twin support vector regression | PLOS One
March 13, 2019 - Financial time series forecasting is a crucial measure for improving and making more robust financial decisions throughout the world. Noisy data and non-stationarity information are the two key factors in financial time series prediction. This paper proposes twin support vector regression for ...
Find elsewhere
๐ŸŒ
Springer
link.springer.com โ€บ home โ€บ knowledge enterprise: intelligent strategies in product design, manufacturing, and management โ€บ conference paper
Support Vector Regression for Financial Time Series Forecasting | Springer Nature Link
Recently, Support Vector Regression (SVR) has been a popular tool in financial time series forecasting. This study deals with the application of Support Vector Regression in stock composite index forecasting. A preprocessing method for accelerating support vector...
๐ŸŒ
IEOM
ieomsociety.org โ€บ proceedings โ€บ 2021indonesia โ€บ 574.pdf pdf
Support Vector Regression (SVR) Model for Seasonal Time Series Data
Support Vector Regression is a Support Vector Machine (SVM) method use in regression cases with a large number ยท of data inputs. SVM is a very popular artificial intelligence-based method. SVM tries to find the best hyperplane ยท (dividing line) between classes.
๐ŸŒ
Trace
trace.tennessee.edu โ€บ cgi โ€บ viewcontent.cgi pdf
Support Vector Regression for Non-Stationary Time Series
DSpace-CRIS is a comprehensive, free and open-source Research Information Management System (CRIS/RIMS). It is based on DSpace, providing broader functionality and an expanded data model, relying on its large community. It is compliant with and supports key international standards, facilitating ...
๐ŸŒ
Scialert
scialert.net โ€บ fulltext
A Comparison of Time Series Forecasting using Support Vector Machine and Artificial Neural Network Model
April 30, 2010 - The ability of SVM to solve nonlinear regression estimation problems makes SVM successful in time series forecasting. It has become a hot topic of intensive study due to its successful application in classification and regression tasks.
๐ŸŒ
Springer
link.springer.com โ€บ home โ€บ artificial neural networks โ€” icann'97 โ€บ conference paper
Predicting time series with support vector machines | Springer Nature Link
We make use of two different cost functions for Support Vectors: training with (i) an e insensitive loss and (ii) Huber's robust loss function and discuss how to choose the regularization parameters in these models. Two applications are considered: data from (a) a noisy (normal and uniform noise) Mackey Glass equation and (b) the Santa Fe competition (set D).
๐ŸŒ
Springer
link.springer.com โ€บ content โ€บ pdf โ€บ 10.1007 โ€บ 0-387-34403-9_115.pdf pdf
SUPPORT VECTOR REGRESSION FOR FINANCIAL TIME ...
Providing access to millions of research articles and chapters from Science, Technology and Medicine, and Humanities and Social Sciences
๐ŸŒ
SAPUB
article.sapub.org โ€บ 10.5923.j.statistics.20140401.03.html
Using Support Vector Machines in Financial Time Series Forecasting
where w is a vector of all parameters and g(.) is a function determined by the network structure and connection weights. For more detailed information on the use and application of ANN for a time series, see Okasha & Yassin[26], and Tseng, Yu & Tzeng[27]. SVM is used for a variety of purposes, particularly classification and regression problems. SVM can be especially useful in time series forecasting, from the stock market to chaotic systems[28]. The method by which SVM works in time series is similar to classification: Data is mapped to a higher-dimensional space and separated using a maximum-margin hyperplane.
๐ŸŒ
Smola
alex.smola.org โ€บ papers โ€บ 1997 โ€บ MulSmoRatSchetal97.pdf pdf
Predicting Time Series with Support Vector Machines
CEO Boson AI 4677 Old Ironsides Dr Suite 190 Santa Clara, CA 95054 ยท I co-founded Boson AI in 2023 and serve as CEO. We are building frontier AI systems