Next Article in Journal
Recognition System of Human Fatigue State Based on Hip Gait Information in Gait Patterns
Previous Article in Journal
A Fuzzy Entropy-Based Thematic Classification Method Aimed at Improving the Reliability of Thematic Maps in GIS Environments
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Using Deep Learning Techniques in Forecasting Stock Markets by Hybrid Data with Multilingual Sentiment Analysis

1
Ph.D. Program in Strategy and Development of Emerging Industries, National Chi Nan University, 1 University Rd., Puli, Nantou 54561, Taiwan
2
Department of Information Management, National Chi Nan University, 1 University Rd., Puli, Nantou 54561, Taiwan
*
Author to whom correspondence should be addressed.
Electronics 2022, 11(21), 3513; https://doi.org/10.3390/electronics11213513
Submission received: 26 September 2022 / Revised: 24 October 2022 / Accepted: 25 October 2022 / Published: 28 October 2022
(This article belongs to the Special Issue Artificial Intelligence for Data Analysis)

Abstract

:
Electronic word-of-mouth data on social media influences stock trading and the confidence of stock markets. Thus, sentiment analysis of comments related to stock markets becomes crucial in forecasting stock markets. However, current sentiment analysis is mainly in English. Therefore, this study performs multilingual sentiment analysis by translating non-native English-speaking countries’ texts into English. This study used unstructured data from social media and structured data, including trading data and technical indicators, to forecast stock markets. Deep learning techniques and machine learning models have emerged as powerful ways of coping with forecasting problems, and parameter determination greatly influences forecasting models’ performance. This study used Long Short-Term Memory (LSTM) models employing the genetic algorithm (GA) to select parameters for predicting stock market indices and prices of company stocks by hybrid data in non-native English-speaking regions. Numerical results revealed that the developed LSTMGA model with hybrid multilingual sentiment data generates more accurate forecasting than the other machine learning models with various data types. Thus, the proposed LSTMGA model with hybrid multilingual sentiment analysis is a feasible and promising way of forecasting the stock market.

1. Introduction

Many studies have pointed out that when investigating social issues, data on social media behaviors are more reflective of people’s real thinking than questionnaire data. In addition, the time to collect data from social media is very close to real-time [1]. Numerous studies showed that considering fundamental analysis data, such as financial web news or posts on social media platforms, could effectively improve the performance of the forecasting stock price. Furthermore, roughly one-third to two-thirds of investors used social media in their investment decisions for collecting and learning information about concerned companies. Therefore, social media comments have a certain degree of impact on stock prices [2]. Wu et al. [3] used historical stock data, technical indicators, and non-traditional data, such as stock posts and financial news, to predict the stock price with long short-term memory. The non-traditional data was employed in the convolutional neural network to calculate investors’ sentiment index. The experimental results showed that the proposed method could provide more accurate values than the single data source. Ko and Chang [4] applied the natural language processing tool to recognize the sentiment of the text of news and PTT bulletin board system (BBS) forum discussion. The long short-term memory approach was used to forecast the stock prices. Numerical results illustrated that using news and PPT attributes did improve forecasting accuracy. Ren et al. [5] employed support vector machines with financial market data and sentiment indexes extracted from news to forecast stock market movements. The day-of-week effect was considered in this study. Thus, the exponential time function was used to increase the influence of recent news. Empirical results showed that the proposed method could raise forecasting accuracy after considering the sentiment features. Gupta et al. [6] integrated the Indian Stock Market historical data and sentiment data from Twitter to predict stock prices by long short-term memory. Textblob, a Python library for processing textual data, measured the sentiment data. This study reported that movements in stock prices and news publications had a strong correlation. Jing et al. [7] developed a hybrid model integrating deep learning techniques and sentiment analysis to predict stock prices. The convolutional neural network model was first employed to classify investors’ sentiments. Then, long short-term memory networks were used to conduct forecasts by technical indicators and sentiment features. Numerical results indicated that the presented method could generate more accurate results than the models without data. Wang et al. [8] used the stock comments from Easy Money to develop a sentiment classifier for analyzing stock markets by the long short-term memory model. Numerical results revealed that t the online sentiments of investors had significant impacts on both trading volumes and stock returns. To collect sentiment features, Shi et al. [9] designed a sentiment analysis system with three classification models, including convolutional neural networks, recurrent neural networks, and logistic regression. Then, support vector machines were used to forecast the movements of stock markets. The empirical results indicated that the hybrid data of stock trading and sentiment information could generate satisfactory forecasting results.
In addition, technical indicators play an essential role in analyzing stock markets. Chung and Shin [10] employed five technical indicators, including a simple 10-day moving average, weighted 10-day moving average, relative strength index, stochastic K%, and stochastic D%, and five historical values, including high price, low price, opening price, closing price, and trading volume, as input variables to perform forecasting tasks in stock markets. The forecasting method used is a deep learning approach with the genetic algorithm. Numerical results showed that the designed model could obtain smaller error measurement values than previous studies. Fischer and Krauss [11] utilized long short-term memory network stocks to predict the movement directions of S&P 500 stock markets. This study indicated that the proposed model outperformed the other three memory-free classification methods. Kamara et al. [12] designed a boosted hybrid model of deep learning and technical analysis for forecasting stock prices. Two networks were employed to do the feature extraction task: the attention-based convolutional neural network and the contextual bidirectional long short-term memory. A multilayer perceptron neural network then used extracted features to forecast stock prices. This study claimed that the proposed hybrid model was superior to the other seven approaches regarding forecasting accuracy. Lu et al. [13] developed a deep-learning forecasting method with eight features to predict one-day-ahead closing prices. The convolutional neural network was employed to extract features of the previous 10 days. Then, the collected feature data and stock trading data were used to train the long short-term memory model. This study revealed that the designed deep learning model was superior to the other five neural network models in forecasting accuracy. Jin et al. [14] proposed a revised long short-term memory model with an attention mechanism that enables the model to focus on the more critical information to predict closing prices. The input variables considered trading data and sentiment tendency. This study concluded that the emotional tendency of investors is a critical factor in improving forecasting performance.
Moreover, the selection of multilingual sentiment analysis tools is crucial for evaluating non-native English-speaking investors’ attitudes. Some transformer-based methods for multilingual tasks have been commonly used, such as XLM (cross-lingual language models) [15], XLM-R (XLM-RoBERTa) [16], mBART (multilingual BART) [17]. Palomino and Ochoa-Luna [18] proposed a transformer-based method for multilingual sentiment analysis. BERT and ULMFiT were combined to forecast the polarity of multilingual tweets. Pei et al. [19] developed an Uyghur sentiment analysis tool by integrating the BiLSTM layer in the language-agnostic BERT Sentence Embedding (LaBSE). LaBSE was employed to encode the input data, and then BiLSTM can learn more information from the input context. The empirical results pointed out that the developed model can yield wonderful performance. Araújo et al. [20] investigated the performance of the language-specific sentiment analysis compared to the existing sentiment analysis methods for English content. This study pointed out that translating the text expressed in different languages into English. Then, using existing English sentiment analysis tools can generate better results than employing the language-specific technique directly in evaluating the sentiment of multilingual text.
Deep learning techniques demonstrated promising capabilities in capturing non-linear characteristics and thus can result in accurate predictions for stock market forecasting. Luo et al. [21] presented a long short-term memory model to forecast stock market profits. The adaptive shuffled frog-leaping algorithm was developed to search for appropriate hyper-parameters. This study illustrated the superiority of the proposed model by performing comparisons with artificial neural networks, support vector machines, gray models, and basic long short-term memory. Kanwal et al. [22] designed a hybrid deep learning model, namely BiCuDNNLSTM-1dCNN, integrating a Bidirectional Cuda Deep Neural Network Long Short-Term Memory and a one-dimensional Convolutional Neural Network to conduct stock price predictions. Two datasets were employed to examine forecasting performances, including individual stock items and the stock market’s performance indices. This investigation pointed out that the presented models can generate accurate forecasting results helpful in decision-making in stock market investments. Wang et al. [23] utilized the Transformer model to forecast the stock market indices of the CSI 300, S&P 500, Hang Seng Index, and Nikkei 225. More underlying rules can be described by encoder-decoder architecture and multi-head attention mechanism. This study indicated that the Transformer outperformed other classic techniques and was useful to investors. Gao et al. [24] employed the evidential rule and the genetic algorithm on recurrent neural networks to predict daily movement directions of the S&P 500 index, Dow Jones Industrial Average index, and NASDAQ 100 index. The numerical results indicated that the designed model effectively improved classification performances. Kumar et al. [25] presented a long short-term memory network and adaptive particle swarm optimization (PSO)-based hybrid deep learning model to forecast the stock prices in Sensex, S&P 500, and Nifty 50. PSO was used to provide initial weights of the long short-term memory and the fully connected layer. This investigation revealed that the proposed model could generate accurate forecasting results. Aldhyani and Alzahrani [26] developed a hybrid convolutional neural network with long short-term memory (CNN-LSTM) to predict the closing prices of stock markets. Stock close prices of two corporations, namely Tesla, Inc. and Apple, Inc., were utilized to measure the forecasting performances of the proposed model. This study indicated that the CNN-LSTM model is superior to the basic LSTM model in forecasting accuracy. Ratchagit and Xu [27] presented a two-delay way for three deep learning techniques, including MLP, CNN, and LSTM. Stock data of three companies, namely Microsoft Corporation, Johnson & Johnson, and Pfizer Inc., were used to investigate forecasting performances. Numerical results illustrated that the proposed two-delay model outperformed other linear combination forecasting techniques.
Table 1 lists the recent related literature in 2022 regarding data types, problem types, and stock markets. Most previous studies employed unique structured data or unstructured data individually in analyzing stock markets. Therefore, this study attempted to exploit the unique strength of the structured and unstructured data in enhancing the capabilities of LSTMGA models for predicting corporations’ stock prices and stock market indices in a regression way. Additionally, in this study, multilingual social media posts were translated into English by Google Translation, and then the SentiStrength was used to evaluate the sentiment of the posts in English. Google Translation was used to translate multilingual social media posts. The other four forecasting methods, backpropagation neural networks (BPNN), least square support vector regression (LSSVR), random forest (RF), and extreme gradient boosting (XGBoost), were employed to conduct forecasting tasks with the same data; and the genetic algorithm was used to determine parameters of models. The forecasting performances were measured by the mean absolute percentage error (MAPE), and the root mean square error (RMSE).
The rest of this study is organized as follows. Section 2 introduces the long short-term memory networks. Section 3 illustrates the architecture of this study for forecasting stock prices with sentiment analysis. Section 4 depicts the experimental results of the proposed models. Conclusions are provided in Section 5.

2. Long Short-Term Memory Networks

Long short-term memory networks (LSTM), proposed by Hochreiter and Schmidhuber [28], recently had been successfully applied in various forecasting fields, such as stock price movements [11], pandemic [29], rainfall [30], sea levels [31], energy consumptions [32], and sales [33]. LSTM coped with the problem of gradient vanishing and hard-to-capture long-term dependencies in recurrent neural networks when processing long sequences. The cell states are added into the long short-term memory to store the long-term memory. Hence, the essential information can be stored for a long time, and the earlier information can be connected with current tasks. Figure 1 illustrates the memory cell of long short-term memory networks [34,35,36].
The long short-term memory network is composed of the forget gate ( xf t ), the input gate (including x i t and c t ˜ ), the output gate ( xo t ), and the cell state ( C t ). The forget gate controls what information will be discarded and how much information will be added to the next cell’s memory. The input gate determines whether the new information enters the memory. Instead, the output gate defines whether the updated information should be transferred to the next layer of networks. The long short-term memory network calculation is expressed in a way from the input sequence { x } to the output sequence { y } , represented by Equations (1) and (2), respectively:
{ x } = ( x t 1 ,   x t ,   x t + 1 ,   ,   x t + n ) ,
{ y } = ( y t 1 ,   y t ,   y t + 1 ,   ,   y t + n ) ,
In the first step, the long short-term memory regulates whether the information should be discarded or stored from the previous cell state c t 1 . Thus, the forget gate ( xf t ) is constructed by Equation (3), calculated based on the current input and the hidden state at time t − 1:
xf t =   σ   ( W xf · x t +   U xf · h t 1 +   b xf )
where σ represents the activation function and maps the variable to values between 1 and 0; x t is the input vector to the LSTM unit, W is the weight matrix of the input process, U is the weight matrix of the state transitions, and b is the bias vector. Then, the input gate, which includes xi t and c t ˜ , controls information added to the network, represented by Equations (4) and (5), respectively.
xi t =   σ   ( W xi · x t +   U xi · h t 1 +   b xi )
c t ˜ =   tan h   ( W   c ˜ · x t +   U   c ˜ · h t 1 +   b   c ˜ )
where the tan h   ( · ) represents the activation function and maps the variable to values between 1 to −1; c t ˜ and xf t are employed to produce the new state of the memory cell C t , which can be expressed by Equation (6):
C t =   xf t · c t 1 +   xi t · c t ˜
the cell state vector C t is utilized to calculate the output gate xo t , which is demonstrated in Equation (7).
xo t =   σ   ( W xo · x t +   U xo · h t 1 +   b xo )
Finally, the output vector h t of long short-term memory networks is expressed by Equation (8).
h t =   xo t · tan h ( C t )
The cell state and activation vector are used to generate the output in the output gate, and the weights and bias terms are adjusted to minimize the loss of objective function in the training phase. The vanishing gradient problems have been successfully solved by the long short-term memory network architecture [11,28,37].

3. The Proposed Architecture for Predicting Stock Markets

Influences of social media on stock market prices have been investigated in English contexts, but studies in non-native English-speaking countries were not explored widely. This study intended to forecast closing values of stock market indices and stock prices in five non-native English-speaking countries. It has been pointed out that fundamental analysis, including sentiment in social media and technical analysis containing technical indices, is essential in forecasting stock prices [38,39]. Figure 2 depicts the architecture of this study. The fundamental analysis has influences on stock prices. Thus, tweets and posts related to the stock market information collected from social media platforms, including Twitter and PTT, were employed as the fundamental data in this study. In addition, technical indicators and trading data served as the technical analysis impacting stock prices. In the data collection phase, fundamental data and technical data were gathered. Thus, two parts comprise the architecture: data collection and preprocessing; models training and testing. In the data collection and preprocessing phase, the multilingual posts collected from Twitter and PTT were transformed into sentiment scores, the stock trading data from Yahoo Finance were gathered, and technical indicators were generated. In this study, three datasets, dataset A, dataset B, and dataset C, were used for forecasting stock markets individually, and forecasting performances generated by three datasets were compared. Dataset A was structured data, dataset B was unstructured data, and dataset C was a hybrid dataset consisting of dataset A and dataset B. Finally, each dataset was divided into a training dataset and a testing dataset individually with percentages of 80% and 20% roughly.

3.1. Data Collection and Preprocessing

In this study, both unstructured data and structured data were collected for stock market forecasting. The unstructured data included posts on Twitter and PTT. Selenium and BeautifulSoup were utilized to crowd the users’ posts from 1 January 2019 to 31 December 2019 in five non-native English-speaking countries with one stock market and one cooperation for each country. One keyword was used for collecting social media data for each stock market or company. Thus, ten keywords in total were utilized to gather multilingual posts, the number of original posts and the number of posts after data processing are illustrated in Table 2. Table 3 illustrates the example of the four main steps of data cleaning. The data of the posting contains the posting UTC time (Coordinated Universal Time) and the content of the post. Firstly, adjusting the time of each post to be interrelated with the stock trading data for each country. Secondly, remove the posts with the same content, the day without any tweet, and the paragraph notations for each tweet. Thirdly, Araújo et al. [20] revealed that translating the input text into English and then performing the existing sentiment analysis tool can yield more encouraging results. Thus, the GOOGLETRANSLATE function [40,41,42] for multilingual text translation in Google Sheets was used to translate all posts into English. Finally, the refined posts were calculated by SentiStrength [43,44,45] to generate sentiment scores. Studies pointed out that SentiStrength is a promising tool for sentiment analysis [43,46,47]. In addition, SentiStrength is a lexicon-based technique and outperforms conventional machine learning techniques in sentiment analysis [48]. Thus, in this study, SentiStrength was employed to evaluate the sentiment of posts. The SentiStrength divides posts into positive and negative sentiment polarities with five levels. The positive polarity is from 1 to 5, and the negative polarity is from −1 to −5. The level of 0 does not exist. Each post has one positive level and one negative level. In this study, daily scores were the accumulations of each post’s levels on that day. Table 2 lists countries, languages, codes, keywords, number of posts, and names of stock markets and corporations for five countries collected from Yahoo Finance from 1 January 2019 to 31 December 2019. Trading data and technical indicators served as the other 12 independent variables lustrated in Table 4. Trading data consisted of open, high, low, close, adjusted close, and volume. Technical indicators included K%, D%, William R%, RSI, MACD, PSY, MA, and BIAS; and were computed by the historical stock market data gathered from Yahoo Finance. Trading data and the technical indicators were integrated into dataset B. The trading data and technical indicators were denoted from x 11 to x 14 and from x 15 to x 22 , respectively. Finally, two datasets were combined into dataset C. Table 4 and Table 5 show all independent variables and three datasets, respectively.

3.2. The Training and Testing of Models

Three datasets were divided into training data and testing data. In addition, the portions of the training and testing data were approximately 80% and 20%. Table 6 lists training and testing data periods for stock markets and corporation stocks. The training data were used to train forecasting models, and the testing data were employed to evaluate the performances of forecasting models.
Trial and error methods [49,50] and meta-heuristics [51,52,53] are two major ways of determining the parameters of machine learning models. The trial and error methods rely heavily on users’ experiences. As the number of parameters increases, the difficulty of parameter determination arises. Thus, the metaheuristic has been an effective and useful way of determining parameters with a relatively mitigated computational burden. In this study, the genetic algorithm was used to select the parameters of forecasting models. Developed by John H. Holland [54,55], the genetic algorithm was used to cope with optimization problems in a directed search way to find a near-optimal or optimal solution. The details of the genetic algorithm are presented in Figure 3. The first step is to generate the initial population randomly. The population includes chromosomes, and each chromosome consists of genes. Then, the fitness is calculated to measure the quality of the chromosome. The chromosomes with higher values of fitness are selected and left. Sequentially, operations of crossover and mutation are conducted to reproduce the next generation with updated generated chromosomes. For the long short-term memory model, the genetic algorithm tuned three hyper-parameters, including the dropout rate, the learning rate, and the batch size. The genetic algorithm was used with a population size of 20 while the maximum generation was set at 100, and the crossover and mutation ratios used were 0.8 and 0.2.
Thus, multilingual fundamental data collected from social media platforms and technical data, including historical trading data and technical indicators, were employed to train the five forecasting models with the genetic algorithm to predict stock indices and corporations’ stock prices.

4. Numerical Results

This study used the LSTMGA model to forecast stock indices and corporations’ stock closing prices in the stock market. Forecasting results were compared with four other methods, including BPNNGA, LSSVRGA, RFGA, and XGBoostGA. The long short-term memory network model used in this study concluded 50 neurons. The time stamp, epoch, and optimizer were set as 1, 100, and Nadam, respectively. Table 7 and Table 8 list the parameters of the forecasting models for dataset A, dataset B, and dataset C of five stock market indices and corporations’ stock prices. Two measurements, MAPE and RMSE, were used to demonstrate the performances of forecasting models and illustrated in Equations (9) and (10).
MAPE   ( % ) = t = 1 N | A t F t A t | × 100 N
RMSE = 1 N t = 1 N ( A t F t ) 2
where N is the number of the forecasting periods. A t and F t are the actual value at time t and the forecasting value at time t, respectively. The MAPE value is independent of the data scale and is used to compare the performances of forecasting models with various data scales. The RMSE is one of the commonly used measurements to evaluate forecasting accuracy. However, the RMSE values are influenced by data scales theoretically [56]. Figure 4 and Figure 5 illustrate the MAPE and RMSE of three datasets in forecasting models for stock indices. Figure 6 and Figure 7 present the MAPE and RMSE of three datasets according to forecasting models for corporations’ stock prices. LSTMGA models with hybrid dataset C can generate the smallest values of MAPE and RMSE in all individual cases and average values. For dataset A and dataset B, LSTMGA models were more accurate than the other forecasting models according to the average values of MAP. They were superior to the other forecasting models in most individual cases. Table 9 illustrates MAPE and RMSE values of forecasting models with three datasets, and the best results for each dataset in individual cases and on average were in bold. Numerical results indicated that LSTMGA models were superior to the other four machine learning models in forecasting accuracy using hybrid data. MAPE is expressed in a percentage way, and not difficult to compare forecasting performance between datasets while scales vary. RMSE values are easily influenced by data scales. Furthermore, according to Lewis’s MAPE forecasting accuracy levels [57], LSTMGA models provided excellent prediction results with MAPE values less than 5% by using dataset C for all forecasting cases in this study.
The nonparametric statistical Wilcoxon signed–rank test [58] was used to measure the performances of LSTMGA models with three different datasets. Based on the null hypothesis that the median of differences between dataset C and dataset A or dataset B equals 0, Table 10 illustrates the Wilcoxon signed–rank test results in dataset C to dataset A and dataset C to dataset B. The Wilcoxon signed–rank test of LSTMGA models is used to verify the statistical significance between the hybrid data, dataset C, and each single-type dataset, dataset A and dataset B. Testing results show that z values are greater than critical values and p values indicate significance levels of 0.025. This shows that employing dataset C by LSTMGA models can generate more statistically and significantly accurate results than using dataset A or dataset B.
Boxplots can reveal unusual data, data distributions, and likelihoods of data dispersions [59,60,61]. Figure 8 and Figure 9 show boxplots of absolute errors for forecasting models of stock market indices and corporations’ stock prices correspondingly. It can be observed that LSTMGA models resulted in smaller and more dense absolute errors for various datasets. Figure 10 and Figure 11 plot point-to-point graphs and make comparisons of actual values and predicted values of various forecasting models with three datasets. The plots indicated that the hybrid data could capture trends of stock markets and corporations’ stock prices more than individual data in most forecasting models. In addition, the LSTMGA model with hybrid dataset C performed the best in all cases.

5. Conclusions

Sentiment data and analysis have been applied to many fields and obtained promising results when integrated with classical structured data. For stock market analysis and prediction, numerous studies indicated that investors’ sentiments significantly influence stock markets. This study used three types of data, namely social media data, trading data, and hybrid data, to forecast stock market indices and corporations’ stock prices. The posts of investors in non-native English-speaking countries were translated into English, and then sentiment analysis was performed. Five forecasting models were employed to forecast stock market indices and corporations’ stock prices in a one-step-ahead policy. The genetic algorithm was utilized to determine the appropriate parameters of all forecasting models. The findings of this study can be illustrated as follows. First, more accurate results can be obtained by using hybrid data rather than single social media data or single trading data individually. In addition, the LSTMGA models outperformed the other four forecasting models in terms of forecasting accuracy with hybrid data. The numerical results also indicated that all 10 cases could generate outstanding forecasting results with MAPE values less than 5%, illustrated in Table 9, using the proposed LSTMGA model. Thus, the proposed LSTMGA model can provide feasible, effective, and promising results in forecasting stock market indices and corporations’ stock prices with multilingual sentiment analysis.
For future works, data collected from other countries or regions can be included to examine the robustness and feasibility of the developed LSTMGA model. Secondly, the other transformer-based machine learning natural language processing tools, such as bidirectional encoder representations from transformers (BERT), can be implemented to compare the forecasting accuracy. In addition, more deep learning techniques and simple neural network methods can be used to perform forecasting tasks and compare performances. Thirdly, real-time forecasting can be performed by embedding well-trained models into a system. The system can collect real-time data for forecasting stock markets. Therefore, high-frequency data can be used to reexamine the performance of the proposed models in intraday trading. Finally, using sentiment analysis tools directly to forecast stock markets in English contexts and comparing results with non-native English data is a possible direction for future study.

Author Contributions

Conceptualization, P.-F.P.; data curation; Y.-L.L.; formal analysis, Y.-L.L. and P.-F.P.; funding acquisition, P.-F.P.; methodology, Y.-L.L. and P.-F.P.; software, Y.-L.L.; visualization, Y.-L.L. and C.-J.L.; writing—original draft, Y.-L.L., C.-J.L. and P.-F.P., review and editing, P.-F.P. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the Ministry of Science and Technology, Taiwan, under the Contract Number MOST 109-2410-H-260-023.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Oliveira, N.; Cortez, P.; Areal, N. The impact of microblogging data for stock market prediction: Using twitter to predict returns, volatility, trading volume and survey sentiment indices. Expert Syst. Appl. 2017, 73, 125–144. [Google Scholar] [CrossRef] [Green Version]
  2. Broadstock, D.C.; Zhang, D. Social-media and intraday stock returns: The pricing power of sentiment. Financ. Res. Lett. 2019, 30, 116–123. [Google Scholar] [CrossRef]
  3. Wu, S.; Liu, Y.; Zou, Z.; Weng, T.-H. Silstm: Stock price prediction based on multiple data sources and sentiment analysis. Connect. Sci. 2022, 34, 44–62. [Google Scholar] [CrossRef]
  4. Ko, C.-R.; Chang, H.-T. Lstm-based sentiment analysis for stock price forecast. PeerJ Comput. Sci. 2021, 7, e408. [Google Scholar] [CrossRef] [PubMed]
  5. Ren, R.; Wu, D.D.; Liu, T. Forecasting stock market movement direction using sentiment analysis and support vector machine. IEEE Syst. J. 2018, 13, 760–770. [Google Scholar] [CrossRef]
  6. Gupta, I.; Madan, T.K.; Singh, S.; Singh, A.K. Hisa-smfm: Historical and sentiment analysis based stock market forecasting model. arXiv 2022, arXiv:2203.08143. [Google Scholar]
  7. Jing, N.; Wu, Z.; Wang, H. A hybrid model integrating deep learning with investor sentiment analysis for stock price prediction. Expert Syst. Appl. 2021, 178, 115019. [Google Scholar] [CrossRef]
  8. Wang, G.; Yu, G.; Shen, X. The effect of online investor sentiment on stock movements: An lstm approach. Complexity 2020, 2020, 4754025. [Google Scholar] [CrossRef]
  9. Shi, Y.; Zheng, Y.; Guo, K.; Ren, X. Stock movement prediction with sentiment analysis based on deep learning networks. Concurr. Comput. Pract. Exp. 2021, 33, e6076. [Google Scholar] [CrossRef]
  10. Chung, H.; Shin, K.-S. Genetic algorithm-optimized long short-term memory network for stock market prediction. Sustainability 2018, 10, 3765. [Google Scholar] [CrossRef] [Green Version]
  11. Fischer, T.; Krauss, C. Deep learning with long short-term memory networks for financial market predictions. Eur. J. Oper. Res. 2018, 270, 654–669. [Google Scholar] [CrossRef]
  12. Kamara, A.F.; Chen, E.; Pan, Z. An ensemble of a boosted hybrid of deep learning models and technical analysis for forecasting stock prices. Inf. Sci. 2022, 594, 1–19. [Google Scholar] [CrossRef]
  13. Lu, W.; Li, J.; Li, Y.; Sun, A.; Wang, J. A cnn-lstm-based model to forecast stock prices. Complexity 2020, 2020, 6622927. [Google Scholar] [CrossRef]
  14. Jin, Z.; Yang, Y.; Liu, Y. Stock closing price prediction based on sentiment analysis and lstm. Neural Comput. Appl. 2020, 32, 9713–9729. [Google Scholar] [CrossRef]
  15. Conneau, A.; Lample, G. Cross-lingual language model pretraining. Adv. Neural Inf. Process. Syst. 2019, 32, 7059–7069. [Google Scholar]
  16. Conneau, A.; Khandelwal, K.; Goyal, N.; Chaudhary, V.; Wenzek, G.; Guzmán, F.; Grave, É.; Ott, M.; Zettlemoyer, L.; Stoyanov, V. Unsupervised cross-lingual representation learning at scale. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, Online, 5–10 July 2020; pp. 8440–8451. [Google Scholar]
  17. Liu, Y.; Gu, J.; Goyal, N.; Li, X.; Edunov, S.; Ghazvininejad, M.; Lewis, M.; Zettlemoyer, L. Multilingual denoising pre-training for neural machine translation. Trans. Assoc. Comput. Linguist. 2020, 8, 726–742. [Google Scholar] [CrossRef]
  18. Palomino, D.; Ochoa-Luna, J. Palomino-ochoa at semeval-2020 task 9: Robust system based on transformer for code-mixed sentiment classification. In Proceedings of the Fourteenth Workshop on Semantic Evaluation, Barcelona (Online), Spain, 12–13 December 2020; pp. 963–967. [Google Scholar]
  19. Pei, Y.; Chen, S.; Ke, Z.; Silamu, W.; Guo, Q. Ab-labse: Uyghur sentiment analysis via the pre-training model with bilstm. Appl. Sci. 2022, 12, 1182. [Google Scholar] [CrossRef]
  20. Araújo, M.; Pereira, A.; Benevenuto, F. A comparative study of machine translation for multilingual sentence-level sentiment analysis. Inf. Sci. 2020, 512, 1078–1102. [Google Scholar] [CrossRef] [Green Version]
  21. Luo, J.; Zhu, G.; Xiang, H. Artificial intelligent based day-ahead stock market profit forecasting. Comput. Electr. Eng. 2022, 99, 107837. [Google Scholar] [CrossRef]
  22. Kanwal, A.; Lau, M.F.; Ng, S.P.; Sim, K.Y.; Chandrasekaran, S. Bicudnnlstm-1dcnn—a hybrid deep learning-based predictive model for stock price prediction. Expert Syst. Appl. 2022, 202, 117123. [Google Scholar] [CrossRef]
  23. Wang, C.; Chen, Y.; Zhang, S.; Zhang, Q. Stock market index prediction using deep transformer model. Expert Syst. Appl. 2022, 208, 118128. [Google Scholar] [CrossRef]
  24. Gao, R.; Cui, S.; Xiao, H.; Fan, W.; Zhang, H.; Wang, Y. Integrating the sentiments of multiple news providers for stock market index movement prediction: A deep learning approach based on evidential reasoning rule. Inf. Sci. 2022, 615, 529–556. [Google Scholar] [CrossRef]
  25. Kumar, G.; Singh, U.P.; Jain, S. An adaptive particle swarm optimization-based hybrid long short-term memory model for stock price time series forecasting. Soft Comput. 2022, 26, 12115–12135. [Google Scholar] [CrossRef] [PubMed]
  26. Aldhyani, T.H.; Alzahrani, A. Framework for predicting and modeling stock market prices based on deep learning algorithms. Electronics 2022, 11, 3149. [Google Scholar] [CrossRef]
  27. Ratchagit, M.; Xu, H. A two-delay combination model for stock price prediction. Mathematics 2022, 10, 3447. [Google Scholar] [CrossRef]
  28. Hochreiter, S.; Schmidhuber, J. Long short-term memory. Neural Comput. 1997, 9, 1735–1780. [Google Scholar] [CrossRef]
  29. Shahid, F.; Zameer, A.; Muneeb, M. Predictions for covid-19 with deep learning models of lstm, gru and bi-lstm. Chaos Solitons Fractals 2020, 140, 110212. [Google Scholar] [CrossRef]
  30. Li, W.; Kiaghadi, A.; Dawson, C. High temporal resolution rainfall–runoff modeling using long-short-term-memory (lstm) networks. Neural Comput. Appl. 2021, 33, 1261–1278. [Google Scholar] [CrossRef]
  31. Accarino, G.; Chiarelli, M.; Fiore, S.; Federico, I.; Causio, S.; Coppini, G.; Aloisio, G. A multi-model architecture based on long short-term memory neural networks for multi-step sea level forecasting. Future Gener. Comput. Syst. 2021, 124, 1–9. [Google Scholar] [CrossRef]
  32. Jin, N.; Yang, F.; Mo, Y.; Zeng, Y.; Zhou, X.; Yan, K.; Ma, X. Highly accurate energy consumption forecasting model based on parallel lstm neural networks. Adv. Eng. Inform. 2022, 51, 101442. [Google Scholar] [CrossRef]
  33. He, Q.-Q.; Wu, C.; Si, Y.-W. Lstm with particle swam optimization for sales forecasting. Electron. Commer. Res. Appl. 2022, 51, 101118. [Google Scholar] [CrossRef]
  34. Chen, H.; Li, X.; Wu, Y.; Zuo, L.; Lu, M.; Zhou, Y. Compressive strength prediction of high-strength concrete using long short-term memory and machine learning algorithms. Buildings 2022, 12, 302. [Google Scholar] [CrossRef]
  35. Lipton, Z.C.; Berkowitz, J.; Elkan, C. A critical review of recurrent neural networks for sequence learning. arXiv 2015, arXiv:1506.00019. [Google Scholar]
  36. Almalaq, A.; Edwards, G. A review of deep learning methods applied on load forecasting. In Proceedings of the 2017 16th IEEE International Conference on Machine Learning and Applications (ICMLA), Cancun, Mexico, 18–21 December 2017; pp. 511–516. [Google Scholar]
  37. Li, Z.; Luo, X.; Liu, M.; Cao, X.; Du, S.; Sun, H. Short-term prediction of the power of a new wind turbine based on iao-lstm. Energy Rep. 2022, 8, 9025–9037. [Google Scholar] [CrossRef]
  38. Puneeth, K.; Rudagi, S.; Namratha, M.; Patil, R.; Wadi, R. Comparative study: Stock prediction using fundamental and technical analysis. In Proceedings of the 2021 IEEE International Conference on Mobile Networks and Wireless Communications (ICMNWC), Tumkur, Karnataka, India, 3–4 December 2021; pp. 1–4. [Google Scholar]
  39. Nti, I.K.; Adekoya, A.F.; Weyori, B.A. A systematic review of fundamental and technical analysis of stock market predictions. Artif. Intell. Rev. 2020, 53, 3007–3057. [Google Scholar] [CrossRef]
  40. Ma, J.; Li, L. Data augmentation for chinese text classification using back-translation. J. Phys. Conf. Ser. 2020, 1651, 012039. [Google Scholar]
  41. Schnaider, K.; Schiavetto, S.; Meier, F.; Wasson, B.; Allsopp, B.B.; Spikol, D. Governmental response to the covid-19 pandemic-a quantitative ethnographic comparison of public health authorities’ communication in denmark, norway, and Sweden. In International Conference on Quantitative Ethnography; Springer: Berlin, Germany, 2021; pp. 406–421. [Google Scholar]
  42. Fuentes-Moraleda, L.; Diaz-Perez, P.; Orea-Giner, A.; Munoz-Mazon, A.; Villace-Molinero, T. Interaction between hotel service robots and humans: A hotel-specific service robot acceptance model (sram). Tour. Manag. Perspect. 2020, 36, 100751. [Google Scholar] [CrossRef]
  43. Leppert, K.; Saliterer, I.; Korać, S. The role of emotions for citizen engagement via social media—A study of police departments using twitter. Gov. Inf. Q. 2022, 39, 101686. [Google Scholar] [CrossRef]
  44. Thelwall, M.; Buckley, K.; Paltoglou, G. Sentiment strength detection for the social web. J. Am. Soc. Inf. Sci. Technol. 2012, 63, 163–173. [Google Scholar] [CrossRef] [Green Version]
  45. Thelwall, M.; Buckley, K.; Paltoglou, G.; Cai, D.; Kappas, A. Sentiment strength detection in short informal text. J. Am. Soc. Inf. Sci. Technol. 2010, 61, 2544–2558. [Google Scholar] [CrossRef] [Green Version]
  46. Li, X.; Xu, M.; Zeng, W.; Tse, Y.K.; Chan, H.K. Exploring customer concerns on service quality under the covid-19 crisis: A social media analytics study from the retail industry. J. Retail. Consum. Serv. 2022, 70, 103157. [Google Scholar] [CrossRef]
  47. Singh, S.P.; Adhikari, A.; Majumdar, A.; Bisi, A. Does service quality influence operational and financial performance of third party logistics service providers? A mixed multi criteria decision making-text mining-based investigation. Transp. Res. Part E Logist. Transp. Rev. 2022, 157, 102558. [Google Scholar] [CrossRef]
  48. Stieglitz, S.; Dang-Xuan, L. Emotions and information diffusion in social media—sentiment of microblogs and sharing behavior. J. Manag. Inf. Syst. 2013, 29, 217–248. [Google Scholar] [CrossRef]
  49. Liu, H.; Chen, C. Spatial air quality index prediction model based on decomposition, adaptive boosting, and three-stage feature selection: A case study in china. J. Clean. Prod. 2020, 265, 121777. [Google Scholar] [CrossRef]
  50. Samal, K.K.R.; Babu, K.S.; Das, S.K. Multi-output spatio-temporal air pollution forecasting using neural network approach. Appl. Soft Comput. 2022, 126, 109316. [Google Scholar] [CrossRef]
  51. Yang, L.; Shami, A. On hyperparameter optimization of machine learning algorithms: Theory and practice. Neurocomputing 2020, 415, 295–316. [Google Scholar] [CrossRef]
  52. Manna, A.K.; Rahman, M.S.; Shaikh, A.A.; Bhunia, A.K.; Konstantaras, I. Modeling of a carbon emitted production inventory system with interval uncertainty via meta-heuristic algorithms. Appl. Math. Model. 2022, 106, 343–368. [Google Scholar] [CrossRef]
  53. Tondut, J.; Ollier, C.; Di Cesare, N.; Roux, J.; Ronel, S. An automatic kriging machine learning method to calibrate meta-heuristic algorithms for solving optimization problems. Eng. Appl. Artif. Intell. 2022, 113, 104940. [Google Scholar] [CrossRef]
  54. Holland, J.H. Adaptation in Natural and Artificial Systems; The University of Michigan Press: Ann Arbor, MI, USA, 1975. [Google Scholar]
  55. Holland, J.H. Genetic algorithms. Sci. Am. 1992, 267, 66–73. [Google Scholar] [CrossRef]
  56. Hyndman, R.J.; Koehler, A.B. Another look at measures of forecast accuracy. Int. J. Forecast. 2006, 22, 679–688. [Google Scholar] [CrossRef] [Green Version]
  57. Lewis, C.D. Industrial and Business Forecasting Methods: A Practical Guide to Exponential Smoothing and Curve Fitting; Butterworth-Heinemann: Oxford, UK, 1982. [Google Scholar]
  58. Wilcoxon, F. Individual comparisons by ranking methods. In Breakthroughs in Statistics; Springer: Berlin, Germany, 1992; pp. 196–202. [Google Scholar]
  59. Tukey, J.W. Exploratory Data Analysis; Sage: Reading, MA, USA, 1977; Volume 2. [Google Scholar]
  60. Nuzzo, R.L. The box plots alternative for visualizing quantitative data. PM&R 2016, 8, 268–272. [Google Scholar]
  61. Moeini, B.; Haack, H.; Fairley, N.; Fernandez, V.; Gengenbach, T.R.; Easton, C.D.; Linford, M.R. Box plots: A simple graphical tool for visualizing overfitting in peak fitting as demonstrated with x-ray photoelectron spectroscopy data. J. Electron Spectrosc. Relat. Phenom. 2021, 250, 147094. [Google Scholar] [CrossRef]
Figure 1. The architecture of a long short-term memory network.
Figure 1. The architecture of a long short-term memory network.
Electronics 11 03513 g001
Figure 2. The flowchart of this study.
Figure 2. The flowchart of this study.
Electronics 11 03513 g002
Figure 3. The flowchart of the genetic algorithm.
Figure 3. The flowchart of the genetic algorithm.
Electronics 11 03513 g003
Figure 4. MAPE values of forecasting models for stock market indices with different datasets.
Figure 4. MAPE values of forecasting models for stock market indices with different datasets.
Electronics 11 03513 g004
Figure 5. RMSE values of forecasting models for stock market indices with different datasets.
Figure 5. RMSE values of forecasting models for stock market indices with different datasets.
Electronics 11 03513 g005
Figure 6. MAPE values of forecasting models for corporations’ stock prices with different datasets.
Figure 6. MAPE values of forecasting models for corporations’ stock prices with different datasets.
Electronics 11 03513 g006
Figure 7. RMSE values of forecasting models for corporations’ stock prices with different datasets.
Figure 7. RMSE values of forecasting models for corporations’ stock prices with different datasets.
Electronics 11 03513 g007
Figure 8. Boxplots in terms of absolute errors for forecasting models with three datasets of stock market indices.
Figure 8. Boxplots in terms of absolute errors for forecasting models with three datasets of stock market indices.
Electronics 11 03513 g008
Figure 9. Boxplots in terms of absolute errors for forecasting models with three datasets of corporations’ stocks.
Figure 9. Boxplots in terms of absolute errors for forecasting models with three datasets of corporations’ stocks.
Electronics 11 03513 g009
Figure 10. Point-to-point plots of actual values and predicted values of stock market indices.
Figure 10. Point-to-point plots of actual values and predicted values of stock market indices.
Electronics 11 03513 g010
Figure 11. Point-to-point plots of actual values and predicted values of corporations’ stock prices.
Figure 11. Point-to-point plots of actual values and predicted values of corporations’ stock prices.
Electronics 11 03513 g011
Table 1. The summary of recent literature in 2022 and the proposed LSTMGA model in data types, problem types, and stock markets.
Table 1. The summary of recent literature in 2022 and the proposed LSTMGA model in data types, problem types, and stock markets.
Ref.The Proposed Deep Learning Method Data TypesProblem TypesStock Markets
StructuredUnstructuredRegressionClassificationCorporations’ Stock PriceStock Market Index
Wu et al. [3]LSTMvvv v
Gupta et al. [6]LSTMvv vv
Kamara et al. [12]EHTS (AB-CNN and CB-LSTM)v v v
Luo et al. [21]LSTM+ SFLAv v v
Kanwal et al. [22]BiCuDNNLSTM-1dCNNv v vv
Wang et al. [23]Transformerv v v
Gao et al. [24]RNN-ER-GAvv v v
Kumar et al. [25]PSO-LSTMv v v
Aldhyani & Alzahrani [26]CNN-LSTMv v v
Ratchagit and Xu [27]LSTM-DEv v v
This studyLSTMGAvvv vv
Note: EHTS = An Ensemble of a Boosted Hybrid of Deep Learning Models and Technical Analysis for Forecasting Stock Prices; AB-CNN = Attention-Based CNN; CB-LSTM = Contextual Bidirectional LSTM; SFLA = shuffled frog leaping algorithm; BiCuDNNLSTM-1dCNN = Bidirectional Cuda Deep Neural Network Long Short-Term Memory—one-dimensional Convolutional Neural Network; RNN-ER-GA = recurrent neural network—evidential reasoning—genetic algorithm; PSO = particle swarm optimization; DE = differential evolution.
Table 2. The codes, keywords, and names of stock markets and corporations.
Table 2. The codes, keywords, and names of stock markets and corporations.
CountriesLanguageCodesNamesKeywordsNumber of Posts
JapanJapanese^N225Nikkei 225“日経”6468
6501.THitachi, Ltd.“日立 株”1360
FranceFrench^FCHICAC 40“CAC”2563
SAN.PASanofi“Sanofi action”304
TaiwanTraditional Chinese^TWIITSEC weighted index“台股”13,686
2330.TWTaiwan Semiconductor Manufacturing Company Limited“台積電 股票”21,649
TurkeyTurkishXU100.ISBIST 100“xu100”18,143
THYAO.ISTürk Hava Yollari Anonim Ortakligi“THYAO”21,398
BrazilPortuguese^BVSPIBOVESPA“Ibovespa”34,949
PETR4.SAPetróleo Brasileiro S.A.—Petrobras“PETR4”9611
Table 3. The example steps of data cleaning.
Table 3. The example steps of data cleaning.
Created at (UTC)T Diff.TR-Date TimeTextTranslationPositiveNegative
16 January 2019 20:573:0016 January 2019 11:57 p.m.herkes biliyor ANCAK; Neden yeni kişiler gelmek istemiyor veya çekiniyor bu DERSE?
Bilgi var…
Heyecan var…
Para var…
Bilgiyi paylaşan lider var.
everyone knows but; Why do new people don’t want or hesitate to come?<br>There is information. <br>There is excitement. <br>There is money.<br>There is a leader who shares the information.<br>Have fear.<br> Our timid nation is a hundred were given a hundred.<br>#bist# bist100#usdtry# Xu100# 3−4
KORKU var. çekingen milletimiz, yüz verildi mi de başa çıkılmaz.
#bist
#bist100
#usdtry
#XU100
#𝒷𝑒𝓁𝑒𝓃𝓈𝒶𝓎
17 January 2019 05:003:0017 January 2019 8:00 a.m.#XU100 mb kararina cok fazla anlam yuklenmis gibi bi his var icimde#XU100 MB DECINE COK COK IN I COULD BI FISH LIKE MEANING2−1
Note: T diff. = time difference; TR-date time = Turkey local time (=UTC+3:00); Text = local posts from twitter; Translation = translated into English via GOOGLE TRANSLATE function; Positive = the score of positive polarity; Negative = the score of negative polarity.
Table 4. Independent variables used in this study.
Table 4. Independent variables used in this study.
Independent
Variables
Sentiment Scores
of Posts
Independent
Variables
Trading Data and Technical Indicators
x 1 Score −5 x 11 Open
x 2 Score −4 x 12 High
x 3 Score −3 x 13 Low
x 4 Score −2 x 14 Volume
x 5 Score −1 x 15 K%
x 6 Score +1 x 16 D%
x 7 Score +2 x 17 William R%
x 8 Score +3 x 18 RSI
x 9 Score +4 x 19 MACD
x 10 Score +5 x 20 PSY
x 21 MA
x 22 BIAS
Table 5. Three datasets used in this study.
Table 5. Three datasets used in this study.
DatasetsContent of DataVariables
Data ASentiment scores of posts x 1 x 10
Data BTrading data and technical indicators x 11 x 22
Data CSentiment scores of posts, trading data, and technical indicators x 1 x 22
Table 6. Periods of training data and testing data for stock market indices and corporation stock prices.
Table 6. Periods of training data and testing data for stock market indices and corporation stock prices.
Stock Market Indices/Corporation StocksPeriods of Training Data
(Date/Month/Year)
Periods of Testing Data
(Date/Month/Year)
N225from 7 January 2019 to 23 October 2019from 24 October 2019 to 30 December 2019
FCHIfrom 3 January 2019 to 17 October 2019from 18 October 2019 to 31 December 2019
TWIIfrom 3 January 2019 to 25 October 2019from 28 October 2019 to 31 December 2019
XU100.ISfrom 3 January 2019 to 18 October 2019from 21 October 2019 to 30 December 2019
BVSPfrom 3 January 2019 to 16 October 2019from 17 October 2019 to 30 December 2019
6501.Tfrom 7 January 2019 to 25 October 2019from 29 October 2019 to 30 December 2019
SAN.PAfrom 9 January 2019 to 14 October 2019from 16 October 2019 to 31 December 2019
2330.TWfrom 3 January 2019 to 25 October 2019from 28 October 2019 to 31 December 2019
THYAO.ISfrom 3 January 2019 to 21 October 2019from 22 October 2019 to 30 December 2019
PETR4.SAfrom 3 January 2019 to 16 October 2019from 17 October 2019 to 30 December 2019
Table 7. Parameters of forecasting models for datasets A, B, and C of stock market indices.
Table 7. Parameters of forecasting models for datasets A, B, and C of stock market indices.
Stock Market IndicesN225FCHITWIIXU100.ISBVSP
ModelsParametersDatasets
ABCABCABCABCABC
BPNNGAlearning rate0.820.340.470.480.900.830.590.540.620.690.530.170.460.810.59
momentum0.560.890.740.220.630.790.470.850.780.890.890.630.640.500.53
LSSVRGAgamma430.52340.01379.89139.26400.66462.75439.74450.04486.97254.08498.83327.74360.79252.90475.74
sigma1.231.612.111.071.172.311.271.531.521.901.232.211.013.361.01
RFGAntree *225336454113418170178102217156188213125236361
mtry *9112010920101010101118101014
nodesize *374355333333333
samplesize *61119291931218871971111
maxnodes *885690948360877598918181976193
XGBoostGAcolsample_bytree *0.970.960.870.950.810.770.960.920.960.980.940.810.930.770.75
subsample *0.870.930.820.890.930.870.970.910.820.890.970.970.890.980.90
max_depth *108610109101078910986
eta *0.090.090.090.100.090.080.090.090.100.100.080.090.090.100.10
gamma0.170.020.000.250.270.020.200.110.140.970.050.370.250.070.18
min_child_weight *3.685.863.533.643.143.623.113.453.583.913.613.053.183.993.86
lambda *0.620.510.700.790.881.041.001.310.860.580.990.800.680.591.37
LSTMGAdropout rate0.000.140.080.020.000.050.310.130.110.370.070.000.580.000.08
learning rate0.000.010.010.010.080.050.000.000.000.000.090.000.000.090.06
batch size953143776456891114645781716757
*: ntree = the number of trees to grow; mtry = the number of variables used at each split; nodesize = the minimum size of terminal nodes; samplesize = the sample sizes to draw; maxnodes = the maximum number of terminal nodes trees in the forest can have; colsample_bytree = subsample percentage of columns while generating new trees; subsample = the subsample ration of training cases; max_depth = the maximum depth of the tree; eta = the learning rate; min_child_weight = the minimum sum of weights related to child nodes; lambda = the L2 regularization term of weights.
Table 8. Parameters of forecasting models for datasets A, B, and C of corporations’ stock prices.
Table 8. Parameters of forecasting models for datasets A, B, and C of corporations’ stock prices.
Datasets of Country Stocks6501.TSAN.PA2330.TWTHYAOPETR4
ModelParametersDatasets
ABCABCABCABCABC
BPNNGAlearning rate0.660.020.440.160.320.150.290.400.170.340.380.150.830.640.38
momentum0.750.610.690.780.600.890.750.040.800.190.690.900.550.730.84
LSSVRGAgamma488.82491.46388.61375.15344.13490.07315.27460.89467.67469.70386.07465.42243.43362.72477.66
sigma1.251.542.111.681.283.101.081.503.821.121.062.781.161.051.77
RFGAntree *102115266315131303185241171154376392396258133
mtry *88167122181017101113101119
nodesize *3533334310334344
samplesize *69264208512851010214
maxnodes *996375955161905751928998978782
XGBoostGAcolsample_bytree *0.990.960.830.980.880.920.900.750.820.960.930.710.930.950.98
subsample *0.970.740.950.840.960.790.970.720.900.890.880.870.820.790.75
max_depth *109981067108108101099
eta *0.100.090.090.100.070.100.100.070.100.100.100.100.090.080.09
gamma0.140.270.020.370.000.030.360.000.070.000.000.010.130.000.01
min_child_weight *3.943.263.733.823.664.763.913.853.103.404.764.613.543.543.44
lambda *0.520.580.670.670.930.980.680.610.521.350.700.700.510.540.59
LSTMGAdropout rate0.000.050.110.790.010.000.530.000.000.000.240.260.000.120.00
learning rate0.010.050.010.000.010.020.010.010.000.010.010.000.010.090.07
batch size8175774810180738281389123765512
*: ntree = the number of trees to grow; mtry = the number of variables used at each split; nodesize = the minimum size of terminal nodes; samplesize = the sample sizes to draw; maxnodes = the maximum number of terminal nodes trees in the forest can have; colsample_bytree = subsample percentage of columns while generating new trees; subsample = the subsample ration of training cases; max_depth = the maximum depth of the tree; eta = the learning rate; min_child_weight = the minimum sum of weights related to child nodes; lambda = the L2 regularization term of weights.
Table 9. MAPE and RMSE values for forecasting models with three datasets.
Table 9. MAPE and RMSE values for forecasting models with three datasets.
ResultDataset ADataset BDataset C
ModelBPNNLSSVRRFXGBoostLSTMBPNNLSSVRRFXGBoostLSTMBPNNLSSVRRFXGBoostLSTM
With GAWith GAWith GA
MAPE
N2258.75%8.65%8.79%8.58%8.45%3.04%8.76%4.35%4.62%3.45%3.13%9.13%4.29%4.56%0.90%
FCHI8.51%7.64%7.89%7.32%6.16%2.39%7.97%4.31%4.15%3.08%2.15%7.82%3.95%4.11%1.37%
TWII9.48%9.86%8.87%8.80%8.34%3.23%8.96%3.69%3.53%2.84%3.14%9.42%3.99%3.83%2.37%
XU100.IS7.21%7.30%7.22%6.99%7.85%3.01%6.59%3.57%3.70%2.82%2.91%6.58%3.59%3.69%2.59%
BVSP10.01%9.99%10.15%10.17%10.01%4.10%8.49%4.97%5.11%6.42%2.88%9.90%4.96%5.21%2.26%
6501.T14.01%13.01%12.62%12.66%8.45%3.24%8.72%3.63%3.75%2.38%2.63%9.70%3.69%3.78%1.52%
SAN.PA9.55%9.60%9.28%8.98%8.05%2.47%7.61%3.22%3.67%3.21%1.82%7.23%3.30%3.14%1.77%
2330.TW23.85%23.08%21.59%22.48%21.90%4.28%19.47%8.42%7.77%2.92%3.00%18.07%8.62%7.66%1.40%
THYAO6.11%12.52%7.48%8.27%9.41%3.24%4.26%1.44%1.49%2.27%2.50%3.80%1.36%1.61%1.34%
PETR410.05%9.80%10.19%10.08%10.59%7.23%10.14%5.64%5.67%4.60%5.16%10.17%5.65%6.16%3.67%
AVG10.75%11.15%10.41%10.43%9.92%3.62%9.10%4.32%4.34%3.40%2.93%9.18%4.34%4.37%1.92%
RMSE
N2252080.832218.852109.202090.462029.31762.592112.661069.201138.02827.54777.422172.701055.811117.88257.77
FCHI513.78514.42498.57498.82386.41155.94498.54276.65268.09201.42146.00489.88256.68263.9493.59
TWII1151.801256.761102.661120.831009.56420.711138.81495.34477.41355.72436.831145.30525.35509.01306.86
XU100.IS9278.799993.839339.839335.929727.603977.338816.534967.545089.793927.513843.388959.344986.335049.843636.73
BVSP11,476.1312,223.4911,792.5911,890.4211,631.265518.0810,345.526177.336366.207545.214296.9811,449.876183.926464.433368.77
6501.T679.32625.10611.66642.74474.37187.02468.72225.58232.39123.53147.92499.02227.59233.5592.86
SAN.PA8.848.818.608.717.762.567.573.814.063.092.137.353.853.671.84
2330.TW83.5076.8671.4675.6671.5917.7967.2731.2728.9810.5712.2262.4631.7228.815.84
THYAO0.942.151.131.361.440.530.640.250.260.380.440.590.240.280.24
PETR43.133.183.203.213.322.393.211.851.841.501.673.211.852.001.27
AVG2527.712692.342553.892566.812534.261104.492345.951324.881360.701299.65966.502478.971327.331367.34776.58
Note: AVG = average; GA = the genetic algorithm.
Table 10. The Wilcoxon signed–rank test of LSTMGA models in terms of dataset C to dataset A and dataset C to dataset B.
Table 10. The Wilcoxon signed–rank test of LSTMGA models in terms of dataset C to dataset A and dataset C to dataset B.
Pairwise ComparisonNegative
Numbers
Positive
Numbers
Z ValueSig.
= 0.025
Negative
Numbers
Positive
Numbers
Z ValueSig.
= 0.025
Dataset C vs. Dataset ADataset C vs. Dataset B
N225470−5.968Yes470−5.968Yes
FCHI500−6.154Yes446−5.565Yes
TWII360−5.232Yes315−4.540Yes
XU100.IS427−5.695Yes3613−3.019Yes
BVSP490−6.093Yes490−6.093Yes
6501.T394−5.530Yes3013−2.826Yes
SAN.PA230−4.197Yes212−3.711Yes
2330.TW360−5.232Yes288−3.692Yes
THYAO.IS472−5.993Yes409−5.078Yes
PETR4.SA481−6.083Yes3712−3.606Yes
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Lin, Y.-L.; Lai, C.-J.; Pai, P.-F. Using Deep Learning Techniques in Forecasting Stock Markets by Hybrid Data with Multilingual Sentiment Analysis. Electronics 2022, 11, 3513. https://doi.org/10.3390/electronics11213513

AMA Style

Lin Y-L, Lai C-J, Pai P-F. Using Deep Learning Techniques in Forecasting Stock Markets by Hybrid Data with Multilingual Sentiment Analysis. Electronics. 2022; 11(21):3513. https://doi.org/10.3390/electronics11213513

Chicago/Turabian Style

Lin, Ying-Lei, Chi-Ju Lai, and Ping-Feng Pai. 2022. "Using Deep Learning Techniques in Forecasting Stock Markets by Hybrid Data with Multilingual Sentiment Analysis" Electronics 11, no. 21: 3513. https://doi.org/10.3390/electronics11213513

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop