# Stream Data Load Prediction for Resource Scaling Using Online Support Vector Regression
## 4 Improved Online SVR for Stream Data Load Time Series Prediction
The Lagrange equation makes partial derivatives for \(w\), \(b\), while \(\tau_{i}\) and \(\tau_{i}^{*}\) make it zero:  
\[\frac{\partial L}{\partial W}=w-\sum\limits_{i=1}^{n}\left(\alpha_{i}^{*}- \alpha_{i}\right)x_{i}=0 \tag{4}\]  
\[\frac{\partial L}{\partial b}=\sum\limits_{i=1}^{n}\left(\alpha_{i}^{*}- \alpha_{i}\right)=0 \tag{5}\]  
\[\frac{\partial L}{\partial\tau_{i}}=C\lambda_{i}-\beta_{i}-\alpha_{i}=0 \tag{6}\]  
\[\frac{\partial L}{\partial\tau_{i}^{*}}=C\lambda_{i}-\beta_{i}^{*}-\alpha_{i}^ {*}=0 \tag{7}\]  
Considering feature mapping and introducing kernel functions, formula (4) will be shaped as  
\[w=\sum\limits_{i=1}^{l}\left(\alpha_{i}^{*}-\alpha_{i}\right)K(x_{i},x_{j}) \tag{8}\]Here, kernel function \(K(*)=\phi(*)\phi(*)^{T}\) is introduced, which makes the function solution bypass the feature space and obtain the function directly in the input space, and avoid the simplified calculation of the nonlinear mapping \(\phi(*)\). Substituting (4)-(7) into (3) to obtain the duality problem of the problem:  
\[ \begin{array}{l}\max\sum\limits_{i=1}^{l}y_{i}(\alpha_{i}^{*}-\alpha_{i})-p^ {i}\varepsilon(\alpha_{i}^{*}+\alpha_{i})-\frac{1}{2}\sum\limits_{i,j=1}^{l} \left(\alpha_{i}-\alpha_{i}^{*}\right)(\alpha_{j}-\alpha_{j}^{*})K(x_{i},x_{j} )\\ s.t.\left\{\begin{array}{l}0\leq\alpha_{i},\alpha_{i}^{*}\leq\lambda_{i}C\\ \sum\limits_{i=1}^{l}\left(\alpha_{i}-\alpha_{i}^{*}\right)=0\end{array}\right. \end{array}  \tag{9}\]  
The conversion of dual problems needs to meet KKT conditions:  
\[\left\{ \begin{array}{l}\alpha_{i}(w^{T}\phi(x_{i})-p^{i}\varepsilon-y_{i}- \tau_{i})=0\\ \alpha_{i}^{*}(y_{i}-w^{T}\phi(x_{i})-p^{i}\varepsilon-\tau_{i}^{*})=0\\ \alpha_{i}\alpha_{i}^{*}=0,\tau_{i}\tau_{i}^{*}=0\\ (\lambda_{i}C-\alpha_{i})\tau_{i}=0,(\lambda_{i}C-\alpha_{i}^{*})\tau_{i}^{*}=0 \end{array} \right. \tag{10}\]  
According to the KKT conditions, when \(0\leq\alpha_{i},\alpha_{i}^{*}\leq\lambda_{i}C\), \(\tau_{i}=0\), then  
\[b=y_{i}+p^{i}\varepsilon-\sum\limits_{i=1}^{l}\left(\alpha_{i}^{*}-\alpha_{i} \right)K(x_{i},x_{j}) \tag{11}\]  
Improving the initialization model parameters of online SVR is the key point to complete the follow-up prediction work. The improved online SVR model is initialized after the solution is completed. Through model training, the boundary support vector function of sample \(x_{i}\) at the time point \(i\) is defined as:  
\[h(x_{i})=f(x)^{*}-y_{i} \tag{12}\]  
We set \(\theta_{i}=\alpha_{i}-\alpha_{i}^{*}\), based on Equation (5) to (8):  
\[\left\{ \begin{array}{l}h(x_{i})\geq p^{i}\varepsilon,\theta_{i}=-\lambda_{i }C\\ h(x_{i})=p^{i}\varepsilon,\theta_{i}\in[-\lambda_{i}C,0]\\ h(x_{i})\in[-p^{i}\varepsilon,p^{i}\varepsilon],\theta_{i}=0\\ h(x_{i})=-p^{i}\varepsilon,\theta_{i}\in[0,\lambda_{i}C]\\ h(x_{i})\leq-p^{i}\varepsilon,\theta_{i}=\lambda_{i}C\end{array} \right. \tag{13}\]  
According to the formula (13), the stream data training set can be divided into three subsets, namely, the error support vector set E, the support vector set \(S\) and the preserved sample set \(R\):  
\[ \begin{array}{l}S=\left\{i\big{|}(\theta_{i}\in[0,\lambda_{i}C]\wedge h(x_{ i})=-p^{i}\varepsilon)\vee(\theta_{i}\in[-\lambda_{i}C,0]\wedge h(x_{i})=p^{i} \varepsilon)\right\}\\ E=\left\{i\big{|}(\theta_{i}=\lambda_{i}C\wedge h(x_{i})\geq p^{i}\varepsilon) \vee(\theta_{i}=\lambda_{i}C\wedge h(x_{i})\leq p^{i}\varepsilon)\right\}\\ R=\left\{i\big{|}(\theta_{i}=0\wedge h(x_{i})\leq p^{i}\varepsilon)\right\} \end{array}  \tag{14}\]  
When the stream data is updated online, the new stream data payload value \(x_{c}\) is added to the training set. Now \(\theta_{c}\) is added, and the \(\theta_{i}\), \(\theta_{c}\) of the three subsets of the training set are updated directly so as to get the updated values \(\Delta\theta_{i}\) and \(\Delta\theta_{c}\), then it is still satisfying (13) and an online SVR regression model with an online dynamic update is obtained. \[f(x)=\sum\limits_{i=1}^{m}\left(\alpha_{i}-\alpha_{i}^{*}\right)K(x_{i},x_{j} )+b \tag{15}\]