# Improved Particle Swarm Optimization for Sea Surface Temperature Prediction
## 3 The Proposed DSL Method
### Generation and Trend Prediction  
In order to mine the similar trend to the current SST from the historical SST, we need to generate the reference and the analog patterns. The reference pattern represents the recent trend, whereas the analog pattern represents the historical trend. Based on the persistence and similarity of SST, we can calculate the similarity between reference pattern and analog pattern to mine the historical trends that are close to the current trends, and then use historical trends to predict current trends. Algorithm 1 specifies the process  
point \(w_{2}=(a,c)\) for the path to satisfy \(a-a_{1}\geq 0\) and \(c-c_{1}\geq 1\). The shortest path distance that satisfies the above constraints is the DTW distance, which can be expressed by Equation (2). \[DTW(A,C)=\min\left\{\sum_{k=1}^{K}w_{k}\right\} \tag{2}\]  
Through the above steps, the DTW distance between each analog pattern and the reference pattern can be calculated. The smaller the DTW distance, the more similar the two patterns are. So far, we have obtained analog patterns similar to reference patterns from \(F\), showing how to use these analog patterns to predict the SST for the next five days. AC is calculating the average of the SST for the next five days that corresponds to these analog patterns in \(F\) as the SST prediction value for the next five days. Yet, this method does not make full use of the information obtained through data mining, which leads to low prediction accuracy. In response to this problem, this paper uses these analog patterns to establish prediction modes. Because these analog patterns have a small sample size, they can only be modeled using small sample prediction methods to maximize information utilization. Although Back Propagation (BP) neural networks [35] can be used for small-sample prediction, model training is difficult and prone to failing during the training process. SVM is suitable for processing small samples and nonlinear problems, and has good robustness and high prediction accuracy. Considering that SST has nonlinear features, this paper combines SVM with DTW to construct a predictive model. In this paper, the analog patterns similar to the reference patterns are the input of the SVM, and the SST of the next five days corresponding to these analog patterns in F is used as the output of the SVM. Through training, we obtain a predictive SVM model and then use the reference model as the model input to get the SST for the next five days. The training samples of the SVM are \((X_{i},Y_{i})\), \(i=1,2,...,k\), where \(X_{i}\in R^{m}\) is the input, \(Y_{i}\in R^{n}\) is the output, and \(m\) and \(n\) are the dimensions of the variable, and \(k\) is the number of samples. The goal of the SVM is to build the following regression function:  
\[f(X)=W\varphi(X)+b=\left[ \begin{array}{c}W_{1}\varphi(X)+b_{1}\\ \vdots\\ W_{n}\varphi(X)+b_{n}\end{array} \right] \tag{3}\]  
\(\varphi(X)\) can map data from the original space to the high-dimensional space, which can transform the nonlinear problem in the original space into a problem that can be solved in high-dimensional space. \(W\) and \(b\) are weights and offsets, respectively. To determine \(W\) and \(b\) we proceed with the minimization (4). \[\min\frac{1}{2}\sum_{j=1}^{n}\|W\|\ \ +C\sum_{j=1}^{n}\sum_{i=1}^{k}L_{j}(f_{j}(X _{i}),Y_{i}^{j}) \tag{4}\]  
where \(C\) is the balance factor,\(L_{j}()\) is the loss function, and \(j\) is the dimension of the output variable. The loss function is usually defined as follows:  
\[L_{j}(f_{j}(X_{i}),Y_{i}^{j})=\left\{ \begin{array}{c}0,f_{j}(X_{i})-Y_{i}^{ j}<\epsilon_{j},\epsilon_{j}{>}0,\\ f_{j}(X_{i})-Y_{i}^{j}-\epsilon_{j},\textit{otherwise}.\end{array} \right. \tag{5}\]  
The multivariate nonlinear regression SVM model can be finally expressed by the Lagrangian method as:  
\[f_{j}(X)=\sum_{i=1}^{k}\left(a_{i}^{j}-a_{i}^{j*}\right)K(X_{i},X)+b_{j} \tag{6}\]where \(a_{i}^{j},a_{i}^{j*}\) are Lagrangian multipliers, and \(K(X_{i},X)\) is a kernel function.