The Use of Artiﬁcial Neural Networks and Decision Trees to Predict the Degree of Odor Nuisance of Post-Digestion Sludge in the Sewage Treatment Plant Process

: This paper presents the application of artiﬁcial neural networks and decision trees for the prediction of odor properties of post-fermentation sludge from a biological-mechanical wastewater treatment plant. The input parameters were concentrations of popular compounds present in the sludge, such as toluene, p-xylene, and p-cresol, and process parameters including the concentration of volatile fatty acids, pH, and alkalinity in the fermentation sludge. The analyses revealed that the implementation of artiﬁcial neural networks allowed the prediction of the values of odor intensity and the hedonic tone of the post-fermentation sludge at the level of 30% mean absolute percentage error. Application of the decision tree made it possible to determine what input parameters the fermentation feed should have in order to arrive at the post-fermentation sludge with an odor intensity < 2 and hedonic tone > − 1. It was shown that the aforementioned phenomenon was inﬂuenced by the following factors: concentration of p-xylene, pH, concentration of volatile fatty acids, and concentration of p-cresol.


Introduction
The presence of odorous compounds in ambient air is a serious problem, especially for the residents of areas directly adjacent to municipal plants, such as wastewater treatment ones [1,2]. The odorous compounds can have an influence on the deterioration of life quality, causing symptoms associated with long-term exposure, including headaches, nausea, problems with concentration, a loss of appetite, stress, insomnia, and discomfort [3]. Taking into account the unit processes in wastewater treatment plants, it was found that the operations connected with sludge processing constituted the main source of odorous substance emissions [4,5]. Stuetz and Frechen, based on investigations in wastewater treatment plants in Germany and France, revealed that the operations connected with sludge thickening, dewatering, and processing contributed to ca. 62% of the total emission of odorous compounds [6].
A regulation implemented in 2016, according to which the disposal of municipal wastewater sludge on a landfill is banned, resulted in an increased interest in other, more pro-ecological methods of sludge management [7]. The most popular methods of sludge management include use in agriculture complex dependences of a given process, without taking into account detailed mechanisms of particular processes [23]. Artificial neural networks have already been used with the anaerobic fermentation process, for example, for prediction of the biogas production rate [24,25]. However, these papers did not take into account odor properties of the sludge before and after the fermentation process. The importance of the issue of further processing of the post-fermentation sludge is highlighted in the works of Ricón et al. In [26], it was demonstrated that the composting of post-fermentation sludge generates emissions in the range of app. 30 ou E per gram of the initial content of the composted matter. This is a relatively high odor concentration, which could be significantly reduced by carefully controlling the parameters of the fermentation process. In a different study [27], the composting of post-fermentation sludge was investigated using sensory and instrumental methods. It was shown that the post-fermentation sludge continues to carry a large odorogenic load and that the use of instrumental methods can not only reduce the cost of olfactometric measurements, but also simplify the process of odor concentration monitoring. Based on just the above developments, two distinct scientific problems and application challenges can be formulated. These are the adjustment of the process parameters in such a way as to minimize the odor nuisance of the post-fermentation sludge, and the use of the lowest possible number of instruments for measurements in order to reduce the cost of process control. The former issue can be solved by using combinatory techniques for odor analysis, such as sensory and instrumental methods [26,27].
The aim of the present investigation was verification of the possibility of artificial neural network implementation for the prediction of odor properties of the wastewater sludge subjected to anaerobic fermentation. The input data were as follows: (i) concentrations of three odorous compounds from the volatile organic compounds group (toluene, p-xylene, p-cresol) present in the sludge; (ii) values of the parameters describing the odor character of the investigated samples, namely odor intensity and hedonic tone; and (iii) 3 the most important parameters characterizing the methane fermentation process (volatile fatty acids, pH, and alkalinity), the values of which differed during successive measurement cycles. Additionally, decision trees were used to determine what input parameters the fermentation feed should have in order to arrive at the post-fermentation sludge characterized by a low odor intensity and hedonic quality. Instrumental and sensory techniques were employed in the measurements. The possibility of the prediction of odor nuisance caused by post-fermentation sludge is a significant added value because it can define further sludge management in different fields of human activity. Moreover, process control and maintaining the process parameters at a proper level will not only enable the reduction of odor nuisance caused by post-fermentation sludge, but also reduce the costs associated with its further processing and the end product's odor nuisance.

Plant Description and Sampling Methodology
Two wastewater treatment plants localized in Pomorskie voivodship (Poland) were selected to perform the investigations. Both plants employ mechanical-biological treatment with a methane fermentation process and biogas recovery. Plant No. 1 treats a larger amount of sewage (55,000 m 3 /day) than plant No. 2 (10,000 m 3 /day), which results in more sludge production (31 tons/day versus 6 tons/day, respectively).
In order to measure the concentration of selected compounds from the volatile organic compounds group, the sludge samples were collected before and after the fermentation process. The samples were taken from nine fermentation cycles. For each cycle, 12 sludge samples were collected prior to the fermentation and 12 samples were obtained following the fermentation, in order to execute sensory measurements. Instrumental measurements involved three samples collected before the fermentation and three samples collected after the fermentation. The sludge was placed in the 500 mL glass bottles and transported to the laboratory. The investigations involved 135 samples of sludge collected before the fermentation and 135 sludge samples after the fermentation, which gives 270 samples from each treatment plant; a total of 540 samples of sludge were examined during the studies. The samples were stored at +4 • C in sealed bottles between the sampling day and analysis day.

Chemicals, Reagents, and Sample Preparation
All chemical reagents used in this investigation were supplied by Sigma-Aldrich (St. Louis, MO, USA): toluene, p-xylene, and p-cresole. Methanol (HPLC grade) used as a solvent in stock solutions was obtained from Merck (Darmstadt, Germany), and sodium chloride (NaCl) powder was obtained from POCH (Gliwice, Poland).
For each analysis, 5 g of sludge were weighed into a 15 mL headspace vial. Subsequently, 2 g of NaCl was added for each sample. Then, the headspace (HS) vial was sealed with a septum lined cap, and the samples were mixed for 30 s in order to homogenize the mixture. After this operation, the samples were placed in an autosampler and analysed by HS-GC-MS/MS.
For quantification, stock solutions were prepared in MeOH by diluting the certified standard solution to 2 mg/mL. Stock solutions were stored at −20 • C until analysis. Fresh stock solutions were made each week.

HS-GC-MS/MS Conditions
For chromatographic separation, a Shimadzu GC-2010 PLUS system (Kyoto, Japan) equipped with an AOC-20s autosampler was used. Separation of the analytes was performed on a Phenomenex ZB-WAX (30 m × 0.25 mm i.d., 0.25 µm film thickness) capillary column. As a carrier gas, helium (purity ≥99.999%) was applied, with a constant flow rate of 1 mL/min. The sludge samples were placed in 15 mL sealed vials, heated, and agitated. The incubation temperature was kept at 70 • C, with an incubation time of 15 min. The injector port was kept at 240 • C, in split mode (10:1), while the headspace syringe temperature was maintained at 85 • C. The injection volume was 500 µL in the split injection mode. The oven temperature gradient program was as follows: 40 • C (held for 3 min), ramp to 90 • C at 10 • C/min, and then to 240 • C (held for 2 min) at 30 • C/min.
A Shimadzu TQ8050 triple quadrupole mass spectrometer equipped with a highly sensitive and stable ion source (Kyoto, Japan) was used in the study. The MS was operated in electron impact (EI) mode with an electron energy of 70 eV and the temperatures of the ion source and MS interface were 220 and 235 • C, respectively. Argon (purity ≥99.999%) was applied as the collision-induced dissociation (CID) gas with a scan range that covered 30-250 m/z. The instrument was operated in the multiple reaction monitoring mode (MRM).

Evaluation of Odor of Wastewater Sludge Samples
The samples of wastewater sludge were subjected to sensory analysis by a team of assessors trained in olfactometric analysis, including two men and two women aged 25-30. The assessors evaluating the odor of the samples by the determination of odor intensity and hedonic tone fulfilled the requirements specified in the European standard PN-EN 13725:2007. For at least 30 min prior the the evaluation, members of the team did not consume any meals and they did not drink anything, except water. Sensory analyses were performed in the laboratory. Odor intensity and hedonic tone were determined during the analyses according to the classification described in the German standard VDI 3940 (The Association of German Engineers). Evaluation of odor intensity was carried out using a 6-degree scale (particular intensity was assigned a value from 0 to 6, where 0 means no odor and 6 corresponds to extremely strong odor). Hedonic tone determination employed a scale in which different odor categories were assigned with a value from −4 (extremely unpleasant odor), through 0 (neutral odor), to +4 (extremely pleasant odor). Each assessor was given a datasheet to write down the grades. The members of the team could not make contact with each other in order to avoid an exchange of information about the sensations associated with odor evaluations. The assessors were also obliged to take some breaks during the investigations to minimize the risk of olfactory adaptation.
The results obtained during the sensory analyses were treated as the data to design a model taking into account odor properties of the sludge samples before and after methane fermentation.
The proposed network structure is dedicated to a problem of the regression of a single property determined at the output of the dataset. The neurons in a network's layer are connected with all neurons of the previous and following layers. The conical structure of the neural network was designed to strengthen generalization, which means better fitting of the network to new cases, unknown during a teaching process. The eight input parameters were selected based on their importance in process monitoring, as they can be relatively easily measured using available instruments. Since the number of variables was relatively low compared to the size of the dataset, we are confident that the risk of overfitting was low. Exploratory Data Analysis (EDA) with the Seaborn library and the pairplot function was performed prior to construction of the model, together with a pairwise analysis of the distribution of values and relationships. Since the training and application of the model did not require excessive computational power, there was no need to reduce the number of variables, and their impact was adjusted based on the loss function used.
Apart from the proposed network, the structures containing a larger number of neurons in each layer were also verified. However, they lost their ability of generalization to the expense of a better accuracy of regression for the cases defined in the teaching datasets. Mean absolute error (MAE) minimization was defined as a cost function during the teaching process. Teaching and testing of the neural network employed the k-fold technique. A dataset was divided into k equipotent datasets. Then, teaching procedures were defined, where k-1 folds were used in the neural network teaching process and the remaining 1 fold was employed in the testing process. The coefficient k = 10 was adopted in the investigations. Moreover, in the case of the data provided in k-1 folds, 80% of it was attributed to neural network teaching and the remaining 20% was used for model validation during teaching. Ten experiments were conducted for each model and the obtained results were averaged. The k-fold technique minimizes the problem of data bias, which could have an influence on the evaluation of designed models. The k-fold cross-validation is a common technique for the validation of machine learning models. One of the earliest references to its use in data analysis is reference [28].

Decision Trees Algorithm
The algorithm of decision tree teaching is a non-arbitrary algorithm. The tree was taught by dividing a training set into subsets based on an attribute value test. This process was repeated on every derivative subset in a recurrent way, named recurrent partitioning. Recursion is finished when a subset in the nod has the same values of the target variable or when division does not add any value to the prediction. The main advantages of decision trees are their non-parametric character, as well as the automatic identification of the most important variables conducted by the algorithm and the elimination of statistically insignificant variables. Moreover, mathematical transformation of one or more explanatory variables does not change the structure of a tree, which is only altered by the threshold values. A disadvantage is the fact that small modification of a training set (for example, removal of a few observations) can result in a radical change of the tree's structure. Additionally, in a single step, the tree can divide the space only with respect to one variable. In other words, division lines are always perpendicular to the division axis in variable space. The use of decision trees for the evaluation of processes such as biofiltration, wastewater treatment, or the analysis of data obtained from the electronic nose, has already been used, among others, in the works [29][30][31]. All calculations were performed in RStudio 1.1.463 using the 'rpart' library.

Concentration of Investigated Compounds in Sludge Samples
Application of the headspace fraction analysis technique coupled with gas chromatography and tandem mass spectrometry allowed the identification and quantitative measurement of the concentration of three chemical compounds present in the investigated sludge samples. A literature survey showed that the chosen compounds can be regarded as the most frequently identified volatile aromatic compounds released from wastewater sludge, which have a substantial influence on the perceived odor connected with sludge processing [32][33][34]. Table 1 presents the concentration ranges of particular substances, including the sampling sites (before and after the fermentation process) and the treatment plant, from which the sample was collected. Based on the data in Table 1, it can be seen that for the treatment plants No. 1 and 2, the content of toluene is higher in the sludge after fermentation than in the samples before that process. In the case of the remaining two compounds, their concentration is lower after the methane fermentation. This can be connected with the decomposition of complex chemical compounds during the fermentation process. Changes of toluene concentration in the sludge before and after fermentation are related to particular phases of the fermentation process. Earlier investigations reported that an increase in toluene concentration was observed during acetogenesis, whereas methanogenesis was associated with a decrease in toluene content [35]. Table 2 shows the minimum, maximum, and average values of the three most important parameters characterizing the methane fermentation process: the concentration of volatile fatty acids, pH, and alkalinity defined as CaCO 3 content per one liter of fermentation mass for both wastewater treatment plants.  Table 3 gathers average ranges of odor intensity and hedonic tone values determined for the wastewater sludge before and after the fermentation process, including the wastewater treatment plant, from which the samples were collected.
After the methane fermentation, the odor intensity and hedonic tone values associated with the sludge decreased (regardless of the treatment plant). This was caused by the fact that some odorous compounds (especially volatile ones) moved into the gas phase. Unfortunately, a relatively large load of unpleasant odors is combined with the post-fermentation sludge. The value of odor intensity of the sludge oscillates between 1 and 3, which corresponds to a clearly detectable odor intensity. In the case of hedonic tone, this parameter for the post-fermentation sludge varies from −3 to 0, which means that the odor characteristics cover the range from very unpleasant to neutral. The possibility of the prediction of odor intensity and hedonic tone values of the post-fermentation sludge by measurement of the concentration of only three basic aromatic compounds (toluene, p-xylene, p-cresol) in fermentation feed and fundamental parameters of the fermentation process makes it possible to decide about the further destination of sludge. Prediction can be carried out with many methods, but the authors employed artificial neural networks and decision trees. Figure 1 depicts the plots presenting the dependence between the determined (evaluated) value and predicted value for (a) odor intensity, (b) concentration of toluene, (c) concentration of p-xylene, (d) concentration of p-cresole, and (e) hedonic tone, for wastewater treatment plant No. 1. Figure 2 shows analogous dependences, but for treatment plant No. 2. Table 3. Average ranges of odor intensity and hedonic tone values determined by a team of assessors for wastewater sludge before and after the fermentation process.     Table 4 presents the values of two metrics describing the prediction level using artificial neural networks regarding the odor intensity, concentration of toluene, concentration of p-xylene, concentration of p-cresole, and hedonic tone of the post-fermentation sludge. Correctness of  Table 4 presents the values of two metrics describing the prediction level using artificial neural networks regarding the odor intensity, concentration of toluene, concentration of p-xylene, concentration of p-cresole, and hedonic tone of the post-fermentation sludge. Correctness of prediction was determined with mean absolute error (MAE) and mean absolute percentage error (MAPE). The information in Table 2 shows that the worst fitting is observed for odor intensity and hedonic tone (in the case of treatment plant No. 2, it is the concentration of toluene not odor intensity that was characterized by the worst fitting). Such a situation was expected because the odor mixture consisted of many components and our predictions were based on the information about the concentration of only three components and three parameters of the fermentation process. Accepting this limitation, it can be stated that the implementation of artificial neural networks provided satisfactory results as far as the prediction of odor intensity and hedonic tone of the post-fermentation sludge is concerned. The average MAPE value for both predicted parameters was at the level of 30%, which suggests good fitting. Additionally, the average MAE value for the odor intensity was at a satisfactory level of ca. 0.4 units. In the case of the average MAE value for hedonic tone of ca. 0.65 units, one can also speak of satisfactory prediction [36,37]. The application of artificial neural networks and minimum input from process measurements allows a satisfactory prediction of odor intensity and hedonic tone of the post-fermentation sludge. Such an approach reduces the time and cost connected with laboratory and olfactometric analyses, which require not only qualified personnel, but also a special laboratory fulfilling strictly defined rules concerning olfactory measurements. Routine measurements make it possible to assess odor nuisance with relatively good approximation via the evaluation of two fundamental properties of odor-its intensity and hedonic tone. This knowledge helps to decide about the further destination of post-fermentation sludge; whether it can be used in agriculture, for the cultivation of non-consumption crops and the production of compost, or directed to thermal utilization. Figure 3 illustrates a decision tree, which allows a prediction of the process parameters of the fermentation feed in order to obtain the post-fermentation sludge characterized by odor intensity below 2 (weak) and hedonic tone above −1 (slightly unpleasant).  Looking at the presented decision tree, it can be noticed that if the p-xylene concentration is higher than 15 ng/g of sludge and the pH of sludge exceeds 7.4, then the obtained post-fermentation sludge will be characterized by an odor intensity <2 and hedonic tone >−1. When the p-xylene concentration is lower than 15 ng/g of sludge, an odor intensity <2 and hedonic tone >−1 can be achieved if the concentration of volatile fatty acids is above 85 and the p-cresole concentration is below 15 ng/g of sludge, or if the concentration of volatile fatty acids is above 85, the p-cresole concentration is above 15, and the p-xylene concentration is below 12 ng/g of sludge. It is evident that in order to determine and predict the odor intensity and hedonic tone of post-fermentation sludge characterized by moderate odor nuisance, it is enough to know the concentration of p-xylene, concentration of p-cresole, pH, or concentration of volatile fatty acids. Obviously, the certainty level is limited to ca. 67% (0.45 × 0.12 + 0.45 × 0.78 × 0.95 + 0.45 × 0.78 × 0.95 × 0.85).
Proper control of the process and selection of the fermentation feed allows post-fermentation sludge with defined odor parameters to be obtained. Implementation of artificial neural networks Looking at the presented decision tree, it can be noticed that if the p-xylene concentration is higher than 15 ng/g of sludge and the pH of sludge exceeds 7.4, then the obtained post-fermentation sludge will be characterized by an odor intensity <2 and hedonic tone >−1. When the p-xylene concentration is lower than 15 ng/g of sludge, an odor intensity <2 and hedonic tone >−1 can be achieved if the concentration of volatile fatty acids is above 85 and the p-cresole concentration is below 15 ng/g of sludge, or if the concentration of volatile fatty acids is above 85, the p-cresole concentration is above 15, and the p-xylene concentration is below 12 ng/g of sludge. It is evident that in order to determine and predict the odor intensity and hedonic tone of post-fermentation sludge characterized by moderate odor nuisance, it is enough to know the concentration of p-xylene, concentration of p-cresole, pH, or concentration of volatile fatty acids. Obviously, the certainty level is limited to ca. 67% (0.45 × 0.12 + 0.45 × 0.78 × 0.95 + 0.45 × 0.78 × 0.95 × 0.85).
Proper control of the process and selection of the fermentation feed allows post-fermentation sludge with defined odor parameters to be obtained. Implementation of artificial neural networks and decision trees, with a simultaneous minimum measurement input (measurement of concentration of three basic aromatic hydrocarbons and three process parameters) gives the possibility to predict the odor intensity and hedonic tone of post-fermentation sludge and what parameters the fermentation process should have in order to arrive at post-fermentation sludge with defined odor intensity and hedonic tone values. Such an approach results in a reduction of the process control cost and allows post-fermentation sludge characterized by defined parameters and ready for further processing to be obtained. Furthermore, adhering to the process parameters established using decision trees facilitates a reduction of costs at further stages of the processing of the post-fermentation sludge into the end-product used in agriculture, composting, and thermal utilization.

Conclusions
This paper has presented the application of artificial neural networks and decision trees to the prediction of odor properties of post-fermentation sludge from two biological-mechanical treatment plants located in the north of Poland. The input parameters were concentrations of popular compounds present in wastewater sludge: toluene, p-xylene, and p-cresole. Additional parameters employed in the prediction process included the concentration of volatile fatty acids, pH, and alkalinity in the post-fermentation sludge. Performed analyses proved that implementation of the artificial neural network with the structure 8-4-2-1 allowed the prediction of odor intensity and hedonic tone values of the post-fermentation sludge at the level of ca. 30% in terms of the mean absolute percentage error (accordingly, MAE for the odor intensity of about 0.4 and for hedonic tone, 0.65). Taking into account the low number of input parameters used for the prediction of odor intensity and hedonic tone, the performed prediction can be regarded as satisfactory, especially as the analysed odor mixture consisted of many components, which influenced the perceived odor intensity and hedonic tone of the post-fermentation sludge. Utilization of the decision tree made it possible to determine what input parameters the fermentation feed should have in order to obtain post-fermentation sludge with an odor intensity <2 and hedonic tone >−1. It was found that these parameters involved the concentration of p-xylene, pH, concentration of volatile fatty acids, and concentration of p-cresole.
The authors realize that the presented studies should be continued to elaborate the optimum process conditions and to determine the minimum number of measurements allowing fast process control aimed at the evaluation of odor nuisance of the post-fermentation sludge. Nevertheless, it seems that the presented results are promising and can contribute to effective management of the post-fermentation sludge in different fields of human activity.