# EL-MTSA: Stock Prediction Model Based on Ensemble Learning and Multimodal Time Series Analysis
## 3 Model Construction
### Feature Extraction Module  
In this study, we propose a feature extraction module that employs a discrete wavelet transform (DWT) and a variational autoencoder (VAE) as independent components. During the data preprocessing stage, the DWT is applied to denoise the stock data, effectively removing noise while preserving critical information. This highlights the importance of the DWT in analyzing non-stationary signals. Additionally, the DWT serves as a powerful feature extraction tool, leveraging its multi-resolution analysis capability to capture localized features within the data. In parallel, during the training phase, the VAE is utilized to encode input sentiment data into latent representations, enabling the extraction of meaningful features for subsequent analysis. The architecture of the proposed feature extraction module is depicted in Figure 2, where Figure 2a illustrates the model structure without sentiment indicators (six features), and Figure 2b presents the model structure incorporating sentiment indicators (seven features). Figure 1: Structure illustration of the proposed EL-MTSA model. Let \(X=[X_{1},X_{2},X_{3},\cdots,X_{t}]\) be the input data. The discrete wavelet transform (DWT) is defined as follows to perform the decomposition operation:  
\[D_{X_{i}}(j,k)=a^{-\frac{1}{2}}\int\limits_{-\infty}^{+\infty}X_{i}(t)\psi_{j,k }^{*}(t)dtj,k\in Z \tag{1}\]  
where \(a\) is the scale factor, \(a=a_{0}j\), and \(\psi_{j,k}^{*}(t)\) is the conjugate negative number of \(\psi_{j,k}(t)\), and \(\psi_{j,k}(t)\) is the wavelet basis function, which is defined as follows:  
\[\psi(t)_{j,k}={a_{0}}^{-\frac{j}{2}}\psi({a_{0}}^{-j}t-k) \tag{2}\]  
For threshold processing, this paper chooses the hard threshold function as follows:  
\[w_{j,k}=\left\{ \begin{array}{c}w_{j,k}\left|w_{j,k}\right|\geq\lambda\\ 0_{t}\left|w_{j,k}\right|<\lambda\end{array} \right. \tag{3}\]  
The determination principle of the threshold is to ensure that the size of the threshold is just greater than the amplitude level of the noise. Generally speaking, the threshold value is estimated by the statistical characteristics of the wavelet coefficients. In this paper, the global threshold proposed by [PERSON] and [PERSON] is chosen as follows:  
\[\lambda=\sigma\sqrt{2\ln N} \tag{4}\]  
\[\sigma=Median(\left|w_{j,k}\right|)/0.6475 \tag{5}\]  
where \(\sigma\) denotes the standard deviation of the noise and \(N\) is the signal length. After threshold processing, an inverse discrete wavelet transform (iDWT) is used to realize the reconstruction of the denoised signal; that is, the denoised signal is obtained. Figure 2: Illustration of feature extraction module. The variational autoencoder (VAE) consists of an encoder and a decoder. Unlike traditional autoencoders, the VAE introduces a probabilistic latent space with latent variables, capturing diverse patterns in the input data. Sampling from this space allows the generation of new, continuous data samples. The VAE employs a loss function linking the encoder and decoder, enabling the model to learn the data's underlying probability distribution. By maximizing the likelihood of the observed data, the VAE effectively captures input data characteristics, learning meaningful latent representations and generating samples with strong generalization capabilities. We treat each observed data point as a sample \(x=\{x_{1},x_{2},x_{3},\ldots,x_{N}\}\), and its corresponding representation in the high-dimensional space as \(z=\{z_{1},z_{2},z_{3},\ldots,z_{N}\}\). The VAE model architecture consists of two main components: an encoder and a decoder. The encoder maps the input data \(x\) to the distribution of the latent variables \(q(z|x)\), while the decoder maps the latent variables \(z\) back to the distribution of the reconstructed data \(p(x^{\prime}|z)\).