Introduction

With the increased population, the increase in energy use, the development of the industry, traffic density, and the type and form of the fuel used cause air pollution. Air pollutants are examined in two groups, gas and particulates. Gaseous pollutants are usually classified according to their sulfur and nitrogen content. The most known sulfur-containing pollutants are sulfur oxides (SOx) and hydrogen sulfide (H2S). The main sources of SOx are power generation plants, oil refineries, transportation, and industrial facilities. SOx contains many oxidized compounds, and the most important among them is sulfur dioxide (SO2). Another gas, NOx, emerges as NO and NO2. These gases can originate from fossil fuel combustion plants and are also released into the atmosphere from various chemical industries producing nitric acid. NOx is a parameter that should be considered since it causes acid rains by creating nitric acid in the atmosphere and leading to ozone formation in the troposphere (Grano 1995). Particulate matters among air pollutant parameters are named according to their aerodynamic diameters. PM10 particulates are air pollution monitoring parameters with aerodynamic diameters smaller than 10 µm, and PM2.5 particulates are air pollution monitoring parameters with aerodynamic diameters smaller than 2.5 µm. These particles floating in the air are called dust, steam, fog, smoke, and spray, depending on their grain size and chemical structure. The air being filled with natural or artificial particulate matters causes shortened visibility, changes in the energy flow at the wavelengths of the sun’s rays, and adverse effects on human, animal, and plant health. According to the data obtained from Turkey, PM10 and PM2.5 are the most important air pollutant parameters exceeding the limit values. These particulate matters (PM10 and PM2.5) contain heavy metals, such as mercury, lead, and cadmium, and carcinogenic chemicals and pose a significant threat to health. These toxic and carcinogenic chemicals combine with moisture and turn into acid, causing an increase in cancer, heart problems, respiratory disease, and infant mortality rates (Tosun 2017).

Air pollutant parameters have various adverse effects on the ecosystem, climate change, economy, cultural heritage and structures, and primarily human health. Impacts on human health include disorders, such as bronchitis, joint rheumatism, rickets and various heart diseases, burning eyes, blurred vision, shortness of breath, loss of appetite, blood poisoning, and especially respiratory system and lung diseases. Impacts on the ecosystem impair the ecosystem’s natural balance by affecting the vegetation cover directly and water and soil resources indirectly. Impacts on climate change are that fossil fuels such as coal, petroleum and petroleum derivatives, and natural gas and activities causing the release of carbon dioxide into the air from thermal power plants to cattle farms lead to air pollution and global warming. This warming causes unusual climate events by melting glaciers and creating a greenhouse effect (Türkeş et al. 2000). Impacts on cultural heritage and structures are that air pollutant parameters cause damage such as corrosion, biodegradation, and soiling. The structural deterioration of architectural structures under the influence of air pollution causes blackening and wear of the outer parts of buildings, such as roofs and walls, especially under the effect of acid rains. In the “Air Quality Assessment and Management Regulations” dated 06.06.2008 and numbered 26,898 in Turkey, the daily and annual average PM10 standards were determined to be 50 μg/m3 and 40 μg/m3, respectively, the daily and annual average SO2 standards were determined to be 125 μg/m3 and 20 μg/m3, respectively, the hourly and annual average NO2 standards were determined to be 200 μg/m3 and 40 μg/m3, respectively, and the annual average NOx standard was determined to be 30 μg/m3 (Ministry of Environment and Forestry 2008).

The most important measures to reduce the impact of these pollutants are to control the emissions released into the atmosphere due to various human activities, keep them under a certain level using new technologies, and make healthy predictions for the future. In this direction, studies obtaining objective and more sensitive air pollution results are carried out using deep learning technologies nowadays. Deep learning, one of the artificial intelligence methods used, is a machine learning method that generates solutions by creating a deep network consisting of a large number of processing layers based on artificial neural networks and performing various transformations and abstractions from the available data and that uses supervised and unsupervised learning methods (Deng and Yu 2013; Lecun et al. 2015; Goodfellow et al. 2016). Increasing data size and producing high-performance processors and video cards capable of processing data of this size are the main reasons for deep learning systems to obtain successful results. In this way, deep learning systems can analyze more data in a shorter time and model the available data in a deep learning system.

Deep learning systems produce models using deep learning architectures. The most common deep learning architectures used in deep learning systems can be listed as deep neural networks (DNN) (Bengio 2009; Schmidhuber 2015), convolutional neural networks (CNN) (LeCun et al. 2010; Huang and Kuo 2018), deep autoencoder (DAE) (Lange and Riedmiller 2010; Hong et al. 2015), and recurrent neural networks (RNN) (Graves 2013; Che et al. 2018). Each deep learning architecture produces successful results in a certain specialized application. For example, while CNN is successful in analyzing and classifying image data, RNN generates successful results in analyzing and classifying time-based data.

In this study, PM10, SO2, NO2, NO, and NOX concentration values obtained from seven locations in Ankara, the capital of Turkey, for 2012–2018 were used. Deep learning system is trained with using air pollutant parameters for 2012–2017 and generated predictions for the year of 2018. Time-based LSTM model was used, and values of the air pollutant parameters for 2018 were predicted with this model. The values predicted for 2018 and the actual values for that year were compared, and in this way, the performance and error rates of the deep learning architecture used were determined.

In the literature, the air pollutant parameter (PM10) of Ankara is analyzed using machine learning methods with regional analysis (Bozdağ et al. 2020). The PM10 concentrations of 6 stations in Ankara for the previous years were given as input, and the PM10 concentrations of the seventh station for 2018 were predicted. Unlike the literature, in this study, data for previous years were trained with deep learning (LSTM) using many air pollutant parameters PM10, SO2, NO2, NO, and NOX, whereas future predictions were performed separately for each region. While making future predictions, prediction values were produced over a one-year period. Although a relatively long-term prediction was made, it was observed that the LSTM model used could make very successful predictions and could produce the values that the air pollutant parameters might take for a year. While the data range in most recent studies is 2–5 years, the data for 7 years were used in this study.

Data and methods

Site and datasets

The city of Ankara, which was selected as the study area, is located in the Central Anatolia Region of Turkey. Since it has a large surface area, it has different climatic conditions; however, the terrestrial climate is generally dominant. Because it is the capital of Turkey, it has gradually increasing population and urbanization. As of 2019, its population is 5,639,076 (Turkish Statistical Institute 2019). With the increasing population and urbanization, the increase in organized industrial facilities established in these regions causes air pollution, one of the environmental problems. Within the scope of the study, data obtained from locations with high urban population were used. The map of these locations is given in Fig. 1.

Fig. 1
figure 1

Study area overview

The measurement data were recorded from the National Air Quality Monitoring Network. This network (VPN) monitors and simultaneously transmits data via GSM modems. In the literature, the air quality of Ankara is examined with regional analysis using machine learning (Bozdağ et al. 2020). In this study, the PM10, SO2, NO2, NO, and NOX concentration data of 7 locations in Ankara city for 2012–2018 were used.

Method

In this section, firstly, basic information about recurrent neural networks (RNN) and long short-term memory (LSTM) was given, and then a deep learning-based method, which was suggested for predicting quality index parameters, was presented.

Recurrent neural networks

Recurrent neural networks (RNNs) are deep learning architectures used to process and model large-scale sequential information (Rumelhart et al., 1986). In conventional neural networks, all input and output parameters are assumed to be independent of each other. However, for many problems such as natural language processing, voice recognition, and time series analysis, this assumption adversely affects the accuracy of the results of RNNs which use inputs of the current time slice and hidden layers and outputs of previous time slices to calculate the output at time t. In this way, for example, depending on the weather on previous days, the weather forecast for the next day can be made more accurate. The RNN architecture in Fig. 2 is shown in an iterative and opened in time way (Graves 2013).

Fig. 2
figure 2

Recurrent neural network architecture

LSTM is an improved version of the RNN deep learning architecture proposed for solving long-term dependency and exploding and vanishing gradient problems in RNN (Hochreiter and Schmidhuber 1997; Graves 2013). In LSTM, input, forget, and output gates are proposed to process input data in the hidden layer. Each of these gates determines how much of the information that passes through it should pass to the next layer, thus prevents long-term dependencies. A basic LSTM cell is demonstrated in Fig. 3 (Greff et al. 2017).

Fig. 3
figure 3

Basic LSTM block structure

The LSTM model

In this study, air quality index parameter values of seven locations in Ankara city between 2012 and 2018 are used for prediction model using the LSTM deep learning architecture. The prediction model predicts the future values of the air quality index parameters in the relevant locations. The flow chart of the LSTM model is presented in Fig. 4.

Fig. 4
figure 4

Flow chart of the LSTM model

As can be seen in Fig. 4, the data set of the air quality index parameters of PM10, SO2, NO2, NO, and NOX concentration is taken. Afterward, the data set is preprocessed, and the data set is made ready for LSTM. Then, the data set is divided into two groups, training and test data. In this study, the parameter values for the period between 2012 and 2017 were used for training, and the parameter values for 2018 were used for testing. Each air quality index parameter is used separately for prediction of the values of 2018. Afterward, a prediction model was produced by giving the training data to the LSTM architecture. The success of the LSTM prediction model of the air quality index parameters and the performance of the results produced by the model were analyzed by applying the prediction model to the test data.

The LSTM model used in this study consists of an input layer, 2 LSTM layers, 1 hidden dense layer, and an output layer. In the first layer, the air quality index parameters are given as input to the LSTM architecture. Two LSTM layers model sequential input data. In these layers, 300 LSTM units were used. The merging of the LSTM layer results was performed in the hidden dense layer. Finally, the results predicted by the model in the output layer were given as output.

Performance metrics

Two performance metrics, R2 and RMSE were selected for the performance analysis of the LSTM architecture-based prediction model of the air quality index parameters. R2 measures the success of the model on test data that are generated with training data. RMSE (root mean squared error) is an error metric that measures the difference between the actual and predicted values of test data.

Results and discussion

Table 1 shows the prediction performance of the LSTM model for different locations selected from Ankara city and the error rate of the actual values and the predicted values. As is seen in Table 1, the LSTM model performed very well in almost all locations and for all air quality index parameters. According to the obtained performance criteria, it can be said that the use of the LSTM model in predicting air quality index parameters is useful and it can work successfully.

Table.1 The R2 performance and RMSE error rate of the LSTM model for different locations in Ankara city

Upon evaluating the results in Table 1, the highest R2 value and the lowest RMSE value were observed for PM10 in Sıhhıye, for SO2 in Bahçelievler, for NO in Siteler, and for NO2 and NOX in Sincan. Performance lower than expected was determined for the SO2 parameter in Demetevler and Sıhhiye locations. The LSTM prediction model could not exhibit high performance in the locations with the R2 value of 0.61 and 0.68, respectively.

The distribution of the locations from which continuous data were obtained in the city of Ankara is given in Fig. 1. The locations are situated in the city centers with dense housing and traffic and industrialized urban areas. There are no locations in other parts of the city, or there is a discontinuous data type in the present locations. The data on the air quality index parameters (PM10, SO2, NO2, NO, and NOX) from the seven locations determined for 2012–2017 were collected. The LSTM prediction model of the air quality index parameters was created using the data collected. With the help of this model, the concentration values of the air quality parameters were predicted for 2018. While analyzing the performance accuracy of the results of this model for 2018, RMSE distributions are important for each parameter. RMSE distributions are an error scale between the actual value and the predicted value. In this study, RMSE distributions at the locations were mapped for each parameter. This mapping was provided with the Kriging interpolation function using the ArcGIS 10.6 software with the help of Geographic Information Systems (GIS). The RMSE error metric of the locations for each parameter was examined on the map. Furthermore, the graphs of the predicted and actual data for 2018 were plotted in the figures. Since R2 values are very good in all locations and in all of the examined air quality parameters, intersections are observed in the graphs. Moreover, the closer the RMSE value is to 0, the better it performs. There are no high values in the obtained RMSE values, and low RMSE values indicate that the error rate between the measurement values and the predicted values is very low while predicting the air quality parameters of deep learning.

The daily and annual average PM10, SO2, NO, NO2, and NOx measurement results of the stations evaluated within the scope of the study, given in Fig. 5, were examined. It is observed that it exceeds 50 μg/m3, which is the daily limit value specified for PM10 in the “Air Quality Evaluation and Management Regulation,” at all stations, especially on the days that coincide with the winter months. While the daily limit value of 125 μg/m3 specified for SO2 is not exceeded at all stations, the annual limit value specified for NO2 and NOx is 40 and 30 μg/m3, respectively, at all stations; it is seen that the limit value given is exceeded when the annual average is taken. In all stations, this concentration has increased due to the excess of business centers and the increase in traffic in some stations (Tolga and Aysen 2004). The variation of air pollutant concentrations between regions, especially in big cities, is shaped by the characteristics of the regions. The levels of NOx concentrations vary according to the rates of pollutants originating from transportation, industrial, domestic, and commercial settlements. In particular, the high level of NO concentration indicates the proximity of the pollutant source.

Fig. 5
figure 5figure 5figure 5figure 5figure 5

Mapping of the values predicted and observed in 2018 and RMSE values of each air quality parameter

Whereas it impossible to compare the results with the results obtained in other studies since various data sets were utilized, the results must also not be dismissed. Due to Turkey’s increasing pollution, the present research was conducted in Ankara, one of the most important cities in Turkey. Zhao et al. (2019) investigated the long short-term memory-fully connected (LSTM-FC) neural network. They predicted PM2.5 contamination at a particular air quality monitoring station during 48 h by utilizing historical air quality data, weather forecast data, and meteorological data. The researchers evaluated thirty-six air quality monitoring stations in China. They compared the artificial neural network (ANN) and long short-term memory (LSTM) models on an identical dataset. The LSTM-FC neural network model performed better. Freeman et al. (2018) investigated deep learning techniques in predicting air quality time series events. The training of RRN with LSTM was performed on time series air pollutant and weather data obtained from an air monitoring station in Kuwait to predict 8-h average O3 over various prediction horizons. RMSE was all the time biased more significantly in comparison with the MAE measurement. The same data set was compared with ARIMA and a multilayer FFNN. RNN performed considerably better. Chaudhary et al. (2018) investigated a deep learning-based LSTM model to predict the future air pollutant’s concentration in India. They conducted a series of experiments validating the suggested solution approach and presenting pieces of evidence with the aim of demonstrating the efficiency of the suggested framework with an average RMSE of pollutants for the next 12, 6, and hour prediction. The researchers compared the model accuracy with real-time data fetched from the Central Pollution Control Board. Perez et al. (2000) proposed predicting PM2.5 concentration for the following 24 h with an extreme learning machine model. He and Deng (2012) utilized the air quality data for Changsha in China in their research. They monitored the daily average concentration of PM10. They developed a hybrid methodology to forecast PM10. They used the ARIMA and ANN models. They stated that the hybrid model might be efficient for increasing the PM10 forecasting accuracy in comparison with a single ARIMA model. Roy (2012) investigated an ANN model to assess air pollutants. This study suggested a multilayer feed-forward network for the prediction of the PM10 concentration by utilizing meteorological data. Reddy (2017) investigated the usage of an LSTM-RNN as a framework to predict future pollution on the basis of time series pollutant and meteorological data in the Beijing region. They predicted for 5 to 10 h into the future from a single time step. Li et al. (2017) suggested a new LSTM model for the prediction of the hourly PM2.5 concentration based on previous air pollution data, meteorological data, and time information and compared their suggested model with various statistical and machine learning algorithms. As a result, they determined that the suggested LSTM model performed better. Biancofiore et al. (2017) predicted PM10 and PM2.5 densities for 1–3 days using multiple linear regression and recursive neural network methods and showed that the recursive neural network yielded a better result. Athira et al. (2018) predicted the PM10 parameter using RNN, LSTM, and GRU (Gated Recurrent Unit) architectures on the AirNet data and stated that GRU performed better than the others with a small difference. Xiuwen Yi et al. (2018) predicted the air quality for the next 48 h using air quality data, meteorological data, and weather forecast values with a DNN-based approach including a spatial and deep distributed fusion network. Sun et al. (2019) used the spatial–temporal GRU-based prediction framework to predict the hourly PM2.5 concentration. Ma et al. (2019) proposed the transferred bi-directional long short-term memory (TL-BLSTM) model for the prediction of the PM2.5 parameter and showed that the proposed model could make a 1-year PM2.5 prediction with a lower error rate. Li et al. (2019) used the pre-trained DNN architecture with multitask learning and DBN to improve the prediction performance of air pollutant concentrations. Navares and Aznarte (2020) examined the performances of LSTM architectures with different inputs on air pollutant parameters and showed that the best result could be produced by giving each parameter separately to the LSTM architecture. Pak et al. (2020) predicted the value of the daily average PM2.5 parameter for the next day in Beijing using the spatial–temporal CNN and LSTM hybrid model. As a result, it was observed that LSTM could predict air quality parameters in the form of time series successfully and with high accuracy. In our study, the 1-year concentrations of 5 different air pollutant parameters were estimated. In other studies, shorter-term predictions and fewer data sets were used.

Conclusion

In this study, PM10, SO2, NO2, NO, and NOX concentration values obtained from seven locations in Ankara, the capital of Turkey, for 2012–2018 were taken. Using the 6-year air pollutant parameters for 2012–2017, it was predicted which values they could take for 1 year in 2018. To this end, time-based LSTM deep learning model was used, and the performance and error rates of the deep learning architecture used were determined by comparing the values predicted for 2018 and the actual values for that year with the help of this model. Accordingly, the LSTM model performed very well for all air pollutant parameters PM10 (R2 = 0.95, RMSE = 7.94), SO2 (R2 = 0.99, RMSE = 0.35), NO (R2 = 0.98, RMSE = 5.03), NO2 (R2 = 0.98, RMSE = 2.32), and NOX (R2 = 0.98, RMSE = 6.86) in almost all locations. Although a relatively long future prediction was made, it was observed that the used LSTM architecture could predict quite successfully and could produce values that air pollutant parameters could take for a year. The contribution of this study to the literature is that short-term predictions were made in other studies using less data. This study obtained 1-year data with high accuracy using 6-year data of 5 different air pollutant parameters.