# A Machine Learning Predictive Model to Detect Water Quality and Pollution
## 4 Methodologies
### Data Labelling  
Since we could not find the existing label suitable for this study, we first conducted an extensive investigation on various environmental indicators based on Australia's official water quality guidelines and other research related to water pollution assessment, and preliminarily selected four most commonly used indicators whose assessment standards are different to enable a more comprehensive assessment of water quality. Then, as described in the Discussion section below, the pollution degree label generated according to the water quality assessment guidelines developed in this research is consistent with the actual situation. Therefore, we synthesized the target variable by utilising four pollution indicators: Igeo, EF, pollution load index (PLI) and potential ecological risk index (PER). The indicators are used to assess water quality based on various types of water sediment. Figure 1 illustrates the overall process of data labelling. Firstly, we compute the four indicators in accordance with their specifications. Among these results, Igeo and EF are calculated for each element in the water in the area, while PLI and PER are a comprehensive evaluation of all elements in the area. Because the number of levels among each indicator is not the same, it is necessary to systematically merge the label intervals among indicators.  
According to standard text descriptions of Igeo, EF, PLI, and PER, we use the following formulas to transform each indicator into a 25-point scale.  
For geoaccumulation indices (Igeo), the merger criteria are as follows:  
\[f_{\text{score}}(x_{\text{Igeo}})=\begin{cases}0&\text{if $x_{\text{Igeo}}<0$,}\\ 5x&\text{if $0\leq x_{\text{Igeo}}\leq 5$,}\\ 25&\text{if $x_{\text{Igeo}}>5$.}\end{cases} \tag{1}\]  
For the enrichment factors (EF), the merger criteria are as follows:  
\[f_{\text{score}}(x_{\text{ef}})=\begin{cases}0&\text{if $x_{\text{ef}}<2$,}\\ \frac{25(x-2)}{38}&\text{if $2\leq x_{\text{ef}}\leq 40$,}\\ 25&\text{if $x_{\text{ef}}>40$.}\end{cases} \tag{2}\]  
For the pollution load index (PLI), the merger criteria are as follows:  
\[f_{\text{score}}(x_{\text{pli}})=\begin{cases}0&\text{if $x_{\text{pli}}<1$,}\\ \frac{25(x-1)}{4}&\text{if $1\leq x_{\text{pli}}\leq 5$,}\\ 25&\text{if $x_{\text{pli}}>5$.}\end{cases} \tag{3}\]  
For the potential ecological risk index (PER), the merger criteria are as follows:  
\[f_{\text{score}}(x_{\text{per}})=\begin{cases}0&\text{if $x_{\text{per}}<40$,}\\ \frac{25(x-4)}{280}&\text{if $40\leq x_{\text{per}}\leq 320$,}\\ 25&\text{if $x_{\text{per}}>320$.}\end{cases} \tag{4}\]  
We add the pollution degree label to the dataset based on the total score of the above four indicators, as: score = 0 = A level (unpolluted), 0-16.8 = B level (light pollution), 16.8-54.48 = C level (moderate pollution) and \(>\)54.48 = D level (heavy pollution). The scoring ranges of the above four types of pollution degree labels are obtained based on the results of combining the original pollution assessment standards of the above four environmental indicators into four grades artificially.  
In fact, after the items in the dataset are calculated, the result does not contain D level (heavy pollution) data, and there is no data source for training the model, so the C level and D level are merged. When the score is greater than 16.8, all are C level.  
Figure 1: The overall data labelling process.