# The Modeling of Time Series Based on Least Square Fuzzy Cognitive Map
## 4 Modeling Time Series Using LSFCM
### Constructing the LSFCM Model  
In this section, the scheme of the proposed time series modeling and prediction approach based on LSFCM and fuzzy c-means clustering is detailed. When we attempt to model time series with FCMs, the numeric time series should be mapped to a fuzzy time series first. Suppose that the FCM has \(c\) concepts and \(\mathbf{X}=\{\mathbf{x}(t)\}\), \(t=1,2,..n\) is a numeric time series, then one numerical datum \(\mathbf{x}(t)\) is mapped to a fuzzy set which has \(c\) elements in the domain, i.e., \(f_{\rm c}:\mathbf{x}\rightarrow<\mathbf{v},\mathbf{u}>\), where \(\mathbf{v}=[v_{1},v_{2},\cdots,v_{\rm c}]\) is the matrix of the concepts and \(\mathbf{u}=[u_{1},u_{2},\cdots,u_{\rm c}]\) is the fuzzy membership degree of the \(\mathbf{x}\) corresponding to \(c\) concepts. Then the numeric datum can be present in the fuzzy set form,  
Figure 2: The outline of proposed method for the time series model. \[U_{i}=\frac{u_{i1}}{v_{1}}+\frac{u_{i2}}{v_{2}}+\ldots+\frac{u_{ic}}{v_{c}} \tag{16}\]  
Let the given time series \(\mathbf{X}=\left\{\mathbf{x}(t)\right\},\ t=1,2,..n\) normalize to [0,1]. The normalized time series is redefined as \(\overline{\mathbf{X}}=\left\{\overline{x}(t)|\overline{x}(t)\in[0,\mathbf{1}]\right\},t=1,2,..n\). The time series \(\overline{X}\) is divided into the training set and test set. The training set containing the \(L\) datum is used to establish the FCM model; the test set containing the \(\mathrm{n}-L\) datum is used to estimate the models. In order to fuzzify the time series, a fuzzy c-means clustering algorithm is used to obtain clustering centers and the fuzzy memberships, the number of the cluster center \(\mathbf{c}\) is predefined, and the clustering centers are taken as the concepts. We have the concepts' vectors \(\mathbf{V}=[v_{1},v_{2},\cdots,v_{c}]^{T}\) and the corresponding fuzzy membership matrix \(\mathbf{U}=[\mathbf{u}_{1i},\mathbf{u}_{2i},\cdots,\mathbf{u}_{c}],i=1,2,\ldots n\). Then the fuzzy membership matrix is used to construct the FCM. There is an internal fuzzy logical relationship between the neighbors of the partition matrix \(\mathbf{U}\), viz. \(U(\mathrm{t})\to U(\mathrm{t}+1)\). Accordingly, we have \(n-1\) input-output data pairs, as shown,  
\[\left( \begin{array}{c}\mathbf{u}_{i1}\\ \mathbf{u}_{i2}\\ \vdots\\ \mathbf{u}_{i4}\end{array} \right)^{T}\rightarrow\left( \begin{array}{c}\mathbf{u}_{ i2}\\ \mathbf{u}_{i2}\\ \vdots\\ \mathbf{u}_{i2}\end{array} \right)^{T};\left( \begin{array}{c}\mathbf{u}_{i2}\\ \mathbf{u}_{i2}\\ \vdots\\ \mathbf{u}_{i2}\end{array} \right)^{T}\rightarrow\left( \begin{array}{c}\mathbf{u}_{ i3}\\ \mathbf{u}_{i3}\\ \vdots\\ \mathbf{u}_{i3}\end{array} \right)^{T};\cdots,\left( \begin{array}{c}\mathbf{u}_{i( 1-1)}\\ \mathbf{u}_{i2(-1)}\\ \vdots\\ \mathbf{u}_{i(-1)}\end{array} \right)^{T}\rightarrow\left( \begin{array}{c}\mathbf{u }_{i2}\\ \vdots\\ \mathbf{u}_{i2}\end{array} \right)^{T} \tag{17}\]  
Referring to (4), the fuzzy logical relationship between \(U(\mathrm{t}+1)\) and \(U(\mathrm{t})\) can be described as follows,  
\[U_{(t+1)i}=f\left(\sum_{j=1}^{c}U_{ij}w_{ji}\right);t=1,2,\cdots n-1\,i=1,2, \cdots c \tag{18}\]  
The formula can be expressed in vector form,  
\[U_{t+1}=f(U_{t}\mathrm{W}) \tag{19}\]  
According to the LSFCM construction process, the concepts \(V\) and the fuzzy membership matrix \(U\) are used as raw material to construct FCM and the least square method is used to learn the FCM. According to Algorithm 1, the weight matrix \(W\) can be calculated by the following equation,  
\[W=(\overline{U}^{T}\overline{U})^{-1}\overline{U}^{T}\overline{\
abla}, \tag{20}\]  
where \(\overline{U}=[U_{1},U_{2},\ \cdots U_{n-1}]^{T}\) and \(\overline{\
abla}_{i}=-\lambda^{-1}\ln\left(U_{i(t+1)}{}^{-1}-1\right),\ t=1,2, \cdots n-1\). The elements of the weight matrix can be restricted to the given interval by adjusting the values of \(\lambda\). After the processes above, we can obtain a fuzzy cognitive map model of the given time series.