# hLSTM-Aging: A Hybrid LSTM Model for Software Aging Forecast
## 4 hLSTM-Aging: A Hybrid LSTM Model  
According to [PERSON] et al. [6], combining probabilistic approaches and LSTM networks improves prediction power for time series in the context of software aging. The Conv-LSTM network and the moving average (MA) model are used in our suggested technique, which combines two highly accurate predictors. These two models were chosen after conducting exploratory studies on all of the LSTM architectures and probabilistic models. In our studies, both MA and Conv-LSTM performed better overall. Intuitively, this combination makes a lot of sense. The MA can provide accurate but noisy forecasts. We may select the most significant properties using Conv-LSTM convolutions without sacrificing integrity to the real data pattern, making it meaningful to forecast a time series in the context of software aging. This combination is designed as follows:  
Given a time series, represented by \(T\), and with n points in time:  
\[T= \begin{bmatrix}t_{1}&t_{2}&t_{3}&t_{4}&t_{5}&t_{6}&...&t_{n}\end{bmatrix}  \tag{4}\]  
To generate a new \(P\) time-series representation, we employ the moving average model. To do so, we train the MA model on the \(T\) series, and after training, the MA model predicts a value for each \(T\)-value. The MA model's output is the new representation of what we term \(P\). \[P= \begin{bmatrix}p_{1}&p_{2}&p_{3}&p_{4}&p_{5}&p_{6}&...&p_{n}\end{bmatrix}  \tag{5}\]  
The \(P\) time series must then be restructured for the prediction procedure. The size of the time-series subsets, which will serve as \(X\) inputs in the prediction job, is first specified. Then, using the information from sub-sequence \(X\), a second number is picked to specify how far forward in the time series the suggested approach should anticipate. As an example, if the value of points ahead is one and the size of the sub-sequence is four, we will have an \(X_{initial}\) input and \(Y_{initial}\) target in the following formats. \[X_{initial}= \begin{bmatrix}p_{0}&p_{1}&p_{2}&p_{3}&p_{4}\end{bmatrix}  \tag{6}\]  
\[Y_{initial}=P_{5} \tag{7}\]  
In this data format with defined sets \(X\) and Y, simple LSTM models could already give the final prediction of the data. However, since we chose to use Conv-LSTM, all the points \(X_{i}\) of \(X\) must be in an \(m\times m\) format that resembles an image. For this example, we picked four as the sub-sequence size number for the \(X\) points on purpose because these sub-sequences must be transformed into \(m\times m\) matrices, where the size of the sub-sequence must equal the square of \(m\). So, in this case, \(m=2\). Furthermore, as a general rule:  
\[SS=m^{2} \tag{8}\]  
where \(SS\) stands for sub-sequence size. Figure 1 shows how a point with size four, predicting one point ahead in the time series, is structured for the Conv-LSTM model. The Conv-LSTM model has a straightforward structure (Figure 2). To make a prediction, we first employ a layer using the Conv-LSTM and 64 filters, followed by a dense layer in the output. After defining the Conv-LSTM, we utilize the model to fit the time series \(P\). Then, using the Conv-LSTM, we anticipate the original time series, completing the flow of the suggested technique. The complete workflow is illustrated in Figure 3.  
Algorithm 1 below displays the proposed method structure. Given a time series \(T\), an MA model is trained and then fed with the same time series \(T\), generating a time series of errors \(P\). As stated before, \(P\) and \(T\) need a restructure operation before the ConvLSTM workflow. Therefore, by training ConvLSTM with error time series \(P\) and predicting with the original series \(T\), we have \(F\) as the final time series predicted by the hybrid method. ```
Input:\(T\) Output:\(F\) \(MA.fit(T)\) \(P\leftarrow\)\(MA.predict(T)\) \(P\leftarrow\)\(reshape(P)\) \(T\leftarrow\)\(reshape(T)\) \(ConvLSTM.fit(P)\) \(F\leftarrow\)\(ConvLSTM.predict(T)\)
```  
**Algorithm 1** The hLSTM algorithm  
Figure 1: Data structure for Conv-LSTM model. Figure 3: hLSTM-Aging prediction process.