Figures
Abstract
Background
Reasonable and accurate forecasting of outpatient visits helps hospital managers optimize the allocation of medical resources, facilitates fine hospital management, and is of great significance in improving hospital efficiency and treatment capacity.
Methods
Based on conjunctivitis outpatient data from the First Affiliated Hospital of Xinjiang Medical University Ophthalmology from 2017/1/1 to 2019/12/31, this paper built and evaluated Long Short-Term Memory (LSTM) and Gated Recurrent Unit (GRU) models for outpatient visits prediction.
Citation: Wang Y, Yi X, Luo M, Wang Z, Qin L, Hu X, et al. (2023) Prediction of outpatients with conjunctivitis in Xinjiang based on LSTM and GRU models. PLoS ONE 18(9): e0290541. https://doi.org/10.1371/journal.pone.0290541
Editor: Mahmud Iwan Solihin, UCSI University Kuala Lumpur Campus: UCSI University, MALAYSIA
Received: November 3, 2022; Accepted: August 10, 2023; Published: September 21, 2023
Copyright: © 2023 Wang et al. This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.
Data Availability: All relevant data are within the paper and its Supporting information files.
Funding: Name: Xijian Hu number: 11961065 Name: Kai Wang number: 11961071 Name: Kai Wang number: 2020D14020 Xijian Hu and Kai Wang Participated in the design of the study and Decision to publish. The funders had no role in study design, data collection and analysis, decision to publish, or preparation of the manuscript.
Competing interests: The authors have declared that no competing interests exist.
1. Introduction
Conjunctivitis is a general term for an acute or chronic inflammatory reaction in the conjunctival tissue caused by various causes. Conjunctivitis is the most common eye disease, as well as one of the causes of serious health and economic burdens worldwide. It is caused mainly by various viral, bacterial, or allergic substances as well as by self-inflammatory allergies [1]. Its sufferers are usually contagious, and outbreaks of infectious diseases can lead to serious morbidity. Due to the increase in the number of patients and the growing complexity of their health conditions, the pressure on the outpatient department, which is the hospital’s external service window, increases every year [2]. The hospital outpatient department is an important part of the hospital organization and has the function of diagnosing, treating, and protecting the health of patients. Thus, forecasting outpatient visits is a necessity for hospital management. Accurate forecasting of outpatient visits can improve outpatient services, make more efficient use of assets, plan operations more effectively, reduce costs and increase revenue [3].
A number of studies have proposed different prediction methods for conjunctivitis. Seo et al. [4] developed a multi-level prediction model to predict conjunctivitis outpatient rates in Korea. Youn et al. [5] used a general regression model to predict the incidence of Dry Eye Syndrome (DES) in South Korea. Qiu et al. [6] used the exponential smoothing model and the seasonal autoregressive integrated moving average (SARIMA) model to analyze and predict acute hemorrhagic conjunctivitis(AHC) incidence in Chongqing. Liu et al. [7] constructed SARIMA and exponential smoothing (ETS) models to predict the trend in incidence in mainland China and provided evidence for the government to formulate policies regarding acute hemorrhagic conjunctivitis (AHC) prevention. With the development of artificial intelligence (AI), machine learning algorithms have shown their advantages in predictions and recognitions [8–10]. Chen et al. [11] compared the ability of seven machine learning methods to predict the number of patients due to conjunctivitis (Lasso penalized linear model, Decision tree, Boosting regression, Bagging regression, Random forest, Support vector, and Neural network). These models cannot describe the stochastic and non-linear nature of outpatient volumes, and they do not better simulate and capture the non-linear characteristics of the data when dealing with non-linear data, resulting in less stable prediction results [12,13].
To overcome the limitations mentioned above, a number of methods related to deep learning have been used by many researchers to build predictive models. Many studies have compared deep learning methods with traditional methods and they have found that deep learning methods are more accurate than traditional methods [14–16]. In deep learning, Recurrent Neural Networks (RNN) have been introduced [17]. However, a long-term dependency caused by the vanishing or explosive gradient problem cannot be handled by RNN [18]. Therefore, the Long Short-Term Memory (LSTM) method is proposed. This method adds gating structures and memory units to the RNN, allowing the network to decide the information to forget and the information to propagate backward. It has the ability to resolve gradient explosion and gradient disappearance [19]. In recent years, LSTM has been quietly applied in many fields, such as stock prices [20], speech recognition [21], and disease prediction (e.g. hand, foot and mouth disease [12,15], COVID-19 [16], and HIV [22]).
GRU networks are proposed on the basis of LSTM networks, which also take into account long-term dependencies. Compared to the LSTM, the GRU has one less gate function and requires fewer parameters, therefore a shorter training time is required [23]. There are similarities and differences between LSTM and GRU methods, but it is impossible to judge theoretically which method is better. Bahdanau et al [24] showed that based on their preliminary experiments on machine translation, the two methods performed comparably. However, it is not known whether this task applies to other areas, so many scholars have made empirical comparisons, such as stock prediction [25], traffic flow prediction [26], short-term runoff prediction [27], and temperature forecast [28].
To date, there is literature on the use of LSTM for disease prediction, but there has not been a comparison of LSTM and GRU models to study the number of conjunctivitis patients. This study intends to identify the best model for predicting the number of patients due to conjunctivitis in Xinjiang by comparing the LSTM and GRU models, based on the daily incidence of conjunctivitis from 2017 to 2019 in Xinjiang.
The paper is structured as follows. Section 2 includes the theoretical background, which describes the methods involved in this paper. Then, the results and discussion are shown in Sections 3 and 4, respectively.
2. Materials & methods
2.1 Data collection
Data on outpatient visits for conjunctivitis from January 1, 2017, to December 31, 2019, were collected from the Department of Ophthalmology of The First Affiliated Hospital of Xinjiang Medical University, which is one of the largest ophthalmology clinics in Xinjiang Uyghur Autonomous Region. Information on patients with conjunctivitis (non-specific) was collected daily, in addition to visits to the emergency department, and there are no missing data (Fig 1). The data are true and reliable.
This study was approved by the Ethics Committee of the First Affiliated Hospital of Xinjiang Medical University (K202205-08) and followed the tenets of the Declaration of Helsinki.
2.2 model and method
2.2.1 LSTM model.
The LSTM model takes into account the continuity of the time series and can effectively solve the problem of gradient disappearance during the gradient descent of the neural network. It uses forgetting gates, input and output gates to filter and control incoming information, and introduces "memory cell states" to store information for long periods of time. Its structure is shown in Fig 2. More detailed introduction of LSTM algorithm can be found in Hochreiter et al [29].
The training and prediction of the LSTM model can be divided into three steps. First, the data is normalized. Next, a two-layer stacked LSTM structure was built. The neuron options for the hidden layer are 8/16/32/64/72/128. Adaptive Moment Estimation (Adam), Stochastic Gradient Descent (SGD), and Root Mean Square Prop (RMSprop) are optional optimization functions. The epochs are set at 50,100,150,200 or 250 during the learning process. The best model was selected based on the minimum RMSE of the test set.
2.2.2 GRU model.
The GRU neural network and the LSTM neural network have very similar network structures. CHO et al [30] created the GRU network by combining the input and forgetting gates of the LSTM network and defining them as update gates, while adding reset gates. Compared to LSTM, GRU has fewer hyperparameters and is less computationally intensive. Its structure is shown in Fig 3. More detailed introduction of GRU algorithm can be found in CHO et al.
The time step, neuron, epoch, and optimization function for the GRU model training and prediction process are the same as for the LSTM model training and prediction process.
2.2.3 One step ahead rolling forecast.
In reality, new daily outpatient observations are available every day and are used to predict the next day’s outpatient volume. The rolling forecast scenario, also known as walk-forward model validation, is the same. The method combines time steps to obtain observations from the test set and then provides the values to the next time step for prediction [31]. It also means that the prediction is made by the time step. With rolling forecasts, we can keep pace with changes in outpatient volumes and quickly adjust outpatient resources. Therefore, the method will make the predictions more accurate.
2.2.4 Evaluation indicators.
The performance of the forecasting model is calculated using the Mean Absolute Error (MAE), Root Mean Squared Error (RMSE) and the coefficient of determination(R2).
Where yi is the observed daily incidence of conjunctivitis on the i(i = 1, …, n) day,
is the predict daily number of outpatient visits, and the
is the mean value of the observed number of outpatient visits. If the values of RMSE and MAE are smaller, then the prediction error is smaller and the model is more accurate. The R2 value range is [0, 1].
3. Results
3.1 Results for LSTM and GRU models
The daily outpatient visits for conjunctivitis at the First Affiliated Hospital of Xinjiang Medical University from January 2017 to November 2019 were used as the training data set, and the data from December 2019 were used as the test set to build the prediction model. Ten alternative LSTM models and ten GRU models are listed in Tables 1 and 2. The results show that in the training set, Adam’s lstm model with 128 neurons has an RMSE of 0.99 for the training set, while RMSProp’s model with 64 neurons and GRU has an RMSE of 0.98 for the training set, and the optimal R of the LSTM and GRU models are consistent. The model with 32 neurons and the Adam of LSTM had the lowest RMSE for test set (RMSE = 2.86) in comparison with the models using other parameters. The model with 8 neurons and the RMSprop of GRU had the lowest RMSE for the test set (RMSE = 2.60) in comparison with models using other parameters.
3.2 Prediction performance comparison
The prediction outputs are shown in Table 3 and Fig 4. Of the two models, the GRU model was better at predicting the number of outpatient visits for conjunctivitis over the next 31 days, with the smallest values for RMSE (2.60), MAE (1.99) and R2 (0.81). Compared to the LSTM model, the MAE accuracy of the GRU model is improved by 9.09%, the RMSE accuracy is improved by 16.74%, and the R2 accuracy is improved by 15.71%. Both metrics improved by a certain percentage point. That is, the GRU model is more accurate and precise in its predictions.
4. Discussion
In this paper, we compare the effects of the LSTM and GRU prediction models on the number of conjunctivitis outpatient visits at the First Affiliated Hospital of Xinjiang Medical University. The results show that GRU is a better predictor and can provide a reference model for hospitals to predict outpatient visits. The finding that GRU achieved higher accuracy than LSTM is also consistent with previous studies [13,32–34].
There are a number of important parameters that need to be considered in the LSTM and GRU models when making predictions. The values of these parameters affect the model’s fit, training time, generalization ability, etc. In order to make the results comparable, the parameters in both models have been adjusted equally in this paper. Four different combinations of parameters were evaluated. These parameters were the time steps, the number of neurons, the number of training epochs, and the optimizer. The results show that the GRU model is the best model when the time step is 7, the neuron is 8, the epoch is 200 and the optimizer is RMSprop. Performance gets worse when the number of cells is less than 8, suggesting that too few units may lead to severe underfitting. But more cells do not necessarily lead to better results either, again due to phenomena such as overfitting. Within the epoch range set in this paper, the performance of the model improves as the training epoch gets larger. Such a change is consistent with the findings of Zhang et al [15]. The three compared optimizers were Adam SGD and RMSprop, Both RMSprop and Adam are optimization algorithms for SGD, RMSprop can solve the problem of sharply declining learning rates. Adam adds bias-correction and momentum to RMSprop. RMSprop and Adam are very similar algorithms and perform well in similar situations [35,36]. It can be seen from Table 1 that the results of the Adam and RMSprop optimizers in this paper do not differ significantly and they outperform SGD. The parameters were selected based on the value of the RMSE and the GRU model with the lowest RMSE on the test set was selected as the most optimal model in this study.
In conclusion, this paper suggests the use of the GRU method for predicting conjunctivitis data in the outpatient ophthalmology clinic of the First Affiliated Hospital of Xinjiang Medical University, and the method may provide a reference model that can be used to predict outpatient visits to the hospital. It also provides support for the management and allocation of medical resources, the arrangement of medical and nursing staff, and the study of consultation pathways; it provides an important theoretical basis for intelligent, detailed, and efficient hospital treatment.
Admittedly, this study has some limitations. The incidence of conjunctivitis is affected by air pollution, natural environment, and socioeconomic factors, however, due to data availability, and the focus on time series, these factors were not considered in this study. The next step in the study will be to incorporate more factors influencing outpatient volume, such as holidays, air quality, weather, etc., into the prediction model. Better integrated prediction models will be built to provide more accurate predictions in order to further delve into the practical applications of medical time-series data.
References
- 1. Azari AA, Arabi A. Conjunctivitis: A Systematic Review. J Ophthalmic Vis Res 2020;15:372–395. pmid:32864068
- 2. Hadavandi E, Shavandi H, Ghanbari A, Abbasian-Naghneh S. Developing a hybrid artificial intelligence model for outpatient visits forecasting in hospitals. Appl Soft Comput 2012;12:700–711.
- 3. Luo L, Luo L, Zhang X, He X. Hospital daily outpatient visits forecasting using a combinatorial model based on ARIMA and SES models. BMC Health Serv Res 2017;17:469. pmid:28693579
- 4. Seo JW, Youn JS, Park S, Joo CK. Development of a Conjunctivitis Outpatient Rate Prediction Model Incorporating Ambient Ozone and Meteorological Factors in South Korea. Front Pharmacol 2018;9:1135. pmid:30356707
- 5. Youn J-S, Seo J-W, Park W, Park S, Jeon K-J. Prediction Model for Dry Eye Syndrome Incidence Rate Using Air Pollutants and Meteorological Factors in South Korea: Analysis of Sub-Region Deviations. International Journal of Environmental Research and Public Health 2020; 17:4969. pmid:32664192
- 6. Qiu H, Zeng D, Yi J, Zhu H, Hu L, Jing D, et al. Forecasting the incidence of acute haemorrhagic conjunctivitis in Chongqing: a time series analysis. Epidemiol Infect 2020;148:e193. pmid:32807257
- 7. Liu H, Li C, Shao Y, Zhang X, Zhai Z, Wang X, et al. Forecast of the trend in incidence of acute hemorrhagic conjunctivitis in China from 2011–2019 using the Seasonal Autoregressive Integrated Moving Average (SARIMA) and Exponential Smoothing (ETS) models. J Infect Public Health 2020;13:287–294. pmid:31953020
- 8. Dong X, Si W, Huang W. ECG-based identity recognition via deterministic learning. Biotechnology & Biotechnological Equipment 2018;32, 769–777.
- 9. Yao Y, Cao Y, Ding X, Zhai J, Liu J, Luo Y, et al. A paired neural network model for tourist arrival forecasting. Expert Systems with Application 2018;114, 588–614.
- 10. Kucukoglu I, Simsek B, Simsek Y. Multidimensional Bernstein polynomials and Bezier curves: Analysis of machine learning algorithm for facial expression recognition based on curvature. Applied Mathematics and Computation 2019; 344, 150–162.
- 11. Chen J, Cheng Y, Zhou M, Ye L, Wang N, Wang M, et al. Machine learning prediction on number of patients due to conjunctivitis based on air pollutants: a preliminary study. Eur Rev Med Pharmacol Sci 2020;2:10330–10337. pmid:33155188
- 12. Gu J, Liang L, Song H, Kong Y, Ma R, Hou Y, et al. A method for hand-foot-mouth disease prediction using GeoDetector and LSTM model in Guangxi, China. Sci Rep 2019;9:17928. pmid:31784625
- 13.
R Fu, Z Zhang, L Li. Using LSTM and GRU neural network methods for traffic flow prediction. 2016 31st Youth Academic Annual Conference of Chinese Association of Automation (YAC) 2016, pp. 324–328.
- 14.
S. Siami-Namini, N. Tavakoli, A. Siami Namin. A Comparison of ARIMA and LSTM in Forecasting Time Series. 2018 17th IEEE International Conference on Machine Learning and Applications (ICMLA) 2018;1394–1401.
- 15. Kim M, Cao B, Mau T, Wang J. Speaker-Independent Silent Speech Recognition from Flesh-Point Articulatory Movements Using an LSTM Neural Network. IEEE/ACM Trans. Audio Speech Lan 2017, 25, 2323–2336.
- 16. Zhang R, Guo Z, Meng Y, Wang S, Li S, Niu R, et al. Comparison of ARIMA and LSTM in Forecasting the Incidence of HFMD Combined and Uncombined with Exogenous Meteorological Variables in Ningbo, China. Int J Environ Res Public Health 2021;18:6174. pmid:34200378
- 17. Shewalkar A, Nyavanandi D, Ludwig S. Performance Evaluation of Deep Neural Networks Applied to Speech Recognition: RNN, LSTM and GRU. Journal of Artificial Intelligence and Soft Computing Research 2019;9, 235–245.
- 18. Don M, Grumbach L. A hybrid distribution feeder long-term load forecasting method based on sequence prediction. IEEE Trans. Smart Grid 2019;11, 470–482.
- 19.
Ilya Sutskever, Oriol Vinyals, Quoc V. Le. Sequence to sequence learning with neural networks. In Proceedings of the 27th International Conference on Neural Information Processing Systems 2014; 3104–3112.
- 20. Taewook K, Ha YK. Forecasting stock prices with a feature fusion LSTM-CNN model using different representations of the same data. PLoS ONE 2019, 14, e0212320. pmid:30768647
- 21. Kırbaş İ, Sözen A, Tuncer AD, Kazancıoğlu FŞ. Comparative analysis and forecasting of COVID-19 cases in various European countries with ARIMA, NARNN and LSTM approaches. Chaos Solitons Fractals 2020; 138:110015. pmid:32565625
- 22. Wang G, Wei W, Jiang J, et al. Application of a long short-term memory neural network: A burgeoning method of deep learning in forecasting HIV incidence in Guangxi, China. Epidemiol. Infect 2019; 147, e194. pmid:31364559
- 23. Chi DJ, Chu CC. Artificial Intelligence in Corporate Sustainability: Using LSTM and GRU for Going Concern Prediction. Sustainability 2021; 13(2111631).
- 24.
Dzmitry B, Kyunghyun C, Yoshua B. Neural machine translation by jointly learning to align and translate. Technical report, arXiv preprint arXiv:1409.0473, 2014.
- 25.
Ya G, Rong W, Enmin Z. Stock Prediction Based on Optimized LSTM and GRU Models. Scientific Programming 2021; 1058–9244.
- 26.
Fu R, Zhang Z, Li L. Using LSTM and GRU neural network methods for traffic flow prediction. 2016 31st Youth Academic Annual Conference of Chinese Association of Automation (YAC) 2016; 324–328.
- 27. Gao S, Huang Y, Zhang S, Han J, Wang G, Zhang M, Lin Q. Short-term runoff prediction with GRU and LSTM networks without requiring time step optimization during sample generation. Journal of Hydrology 2020;125188,0022–1694.
- 28. Godoy-Rojas D.F, Leon-Medina J.X, Rueda B. Attention-Based Deep Recurrent Neural Network to Forecast the Temperature Behavior of an Electric Arc Furnace Side-Wall. Sensors 2022; 22, 1418. pmid:35214318
- 29. HOCHREITER S, SCHMIDHUBER J. Long short-term memory. Neural Computation 1997; 9: 1735–1780. pmid:9377276
- 30.
Cho K, Merriënboer BV, Gulcehre C, Bahdanau D, Bougares F, Schwenk H, et al. Learning phrase representations using RNN encoder-decoder for statistical machine translation. Proceedings of the 19th Conference on Empirical Methods in Natural Language Processing (EMNLP) 2014; 1724–1734.
- 31. Liu L, Luan R.S, Yin F, Zhu X.P, Lu Q. Predicting the incidence of hand, foot and mouth disease in Sichuan province, China using the ARIMA model. Epidemiol. Infect 2016; 144, 144–151. pmid:26027606
- 32.
Chung J, Gulcehre C, Cho K, Bengio Y. Empirical evaluation of gated recurrent neural networks on sequence modeling. In NIPS 2014 Workshop on Deep Learning, December 2014.
- 33.
Kumar S, Hussain L, Banarjee S, Reza M. Energy Load Forecasting using Deep Learning Approach-LSTM and GRU in Spark Cluster. In Proceedings of the Fifth International Conference on Emerging Applications of Information Technology (EAIT) 2018; pp. 1–4.
- 34. 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. pmid:32839642
- 35.
Diederik PK, Jimmy LB. Adam: a Method for Stochastic Optimization. International Conference on Learning Representations 2015; 1–13.
- 36.
Kingma D, Ba J. Adam: A Method for Stochastic Optimization. arXiv preprint arXiv: 1412.6980,2014.