Introduction

Water resources in China are unevenly distributed over space and time, and the surface water is of poor quality and scarce in some arid or semiarid areas (Li et al. 2014; Wu et al. 2018a; Yan and Chen 2013). Therefore, groundwater plays an important role in irrigation and domestic purposes and is considered to be a source of uncontaminated water (Li et al. 2018; Qian et al. 2016; Wu et al. 2018b). However, extensive contamination has posed threats to groundwater quality, and the most common groundwater contaminants include pathogens (e.g., bacteria, viruses and protozoans) and some common solutes (e.g., nitrate, sulfate, Ca2+, and Mg2+) (Azizullah et al. 2011; Memon et al. 2011). Particularly, the highlighted reports with respect to arsenic (As) and fluoride (F) groundwater contamination represent one of the most serious and emerging human health challenges (Niazi et al. 2018; Nickson et al. 2004). Groundwater As and F concentrations are quite patchy, varying from drinking water standards to several hundred μg/L in wells that are several meters apart (Guo et al. 2012). Therefore, understanding the spatial variability of As is crucial not only for understanding the biogeochemical–hydrological processes that control the groundwater concentrations of As but also for developing strategies for the sustainable use of shallow groundwater that will reduce exposure to As (Farooqi 2015; Rasool et al. 2016). On the other hand, As ingestion from groundwater used as drinking water is a major source of As exposure to humans in arid or semiarid areas, including Northwest China (Wang et al. 2009, 2018; Guo et al. 2014). The long-term intake of high-As groundwater has negative effects on human health, resulting in residents suffering from chronic intoxication, including hematological, cardiovascular, neurological, respiratory, and renal diseases (Chappells et al. 2014; Shahid et al. 2018).

Hence, health-risk assessment of As in groundwater used as drinking water will be of great help to ensure the basic safety of drinking water for the increasing populations. The health-risk assessment of As was evaluated by Muhammad et al. (2010) and Sultana et al. (2014) in Pakistan, and the authors reported hazard quotient (HQ) values > 1, and more than 85% of drinking water had HQ values > 1, respectively. In the semiarid region of Northwest China, Li et al. (2016) revealed the groundwater’s effect on human health, and the health-risk assessment suggested that females and children faced higher non-carcinogenic risks than males due to groundwater contaminants impacted by industrial and agricultural activities. Similarly, other scholars conducted health-risk assessments of drinking water to examine the adverse impacts of groundwater contaminants on human health in some areas (He and Wu 2019; He et al. 2019; Li and Qian 2011; Radfard et al. 2018; Ravindra and Mor 2019; Shahid et al. 2018; Sharifi et al. 2018; Wang et al. 2015; Wu et al. 2019). However, very limited research has been undertaken regarding the status of health-risk assessments for As in drinking water in the Yanchi region.

The Yanchi region is in an arid or semiarid region, and groundwater has been a major source of the water supply in this area, where there is a great shortage of water resources and almost no surface water resources are present. High-F groundwater has been found in the Yanchi area, and the sources of high F are the dissolution of fluorite and the desorption of exchangeable F; additionally, the groundwater environment provides favorable conditions for F enrichment (Wu et al. 2018b). Moreover, Duan et al. (2016) revealed that most of the groundwater is of poor quality and is high in fluoride and salinity. Most research has focused on high-F groundwater and correlative groundwater quality issues. However, there is almost no research on high-As groundwater, groundwater quality assessments related to As or pollution source identification.

Random forest (RF) generates a large number of trees, which reduces generalization error due to the ensemble of permutations that can overcome the classification error of one permutation, and RF does not overfit the model to the dataset (Ghimire et al. 2010; Prasad et al. 2006). Therefore, the RF method can offer substantial improvements in classification accuracy and can be easily implemented for parallel computing, making it computationally efficient and a popular choice for data classification (Cutler et al. 2007; Hastie et al. 2009). Bindal and Singh (2019) used random forest to predict the regions in Uttar Pradesh at risk due to As contamination; the model showed an overall accuracy of 84.67% and performed better than other widely methods for As prediction. Tesoriero et al. (2017) used random forest classification to determine the probabilities of detecting elevated concentrations of nitrate, iron, and arsenic, and elevated nitrate, iron, and arsenic concentrations are a major risk to groundwater quality in the Fox-Wolf-Peshtigo study area. Similarly, random forest has been used extensively in hydrology for applications, such as identifying contaminant sources (Lee et al. 2018), classifying surface–groundwater interaction (Yang et al. 2019), modeling groundwater potential (Naghibi et al. 2017), and modeling groundwater level (Sahoo et al. 2017). Moreover, some studies have reported that RF produces very good results compared to other machine learning-based classification systems, such as support vector and neural networks or other decision tree algorithms (Baudron et al. 2013; Liaw and Wiener 2002).

In the study area, very limited research has been undertaken on the status of the spatial variability of As, the health-risk assessment of As and the effects on groundwater quality. In such cases, the presence of As in groundwater that is used as drinking water is applied to assess the potential health risks, including the HQ and CR for adults and children. Then, the RF method is used to classify groundwater quality and pollution source identification. Ultimately, the objectives of this study are to (1) investigate the distribution of As concentrations from shallow groundwater in time and space and assess the health risk posed by As to adults and children and (2) evaluate the importance of indicators on the groundwater classification task and further investigate the influence of these important indicators on the groundwater classification performance.

Materials and Methods

Study Area

The study area is located in the east of Yanchi County, Ningxia Hui Autonomous, and the Midwest of the Ordos Basin, northwest China (Fig. 1). It belongs to the transitional belt from the Ordos Platform to the north of Loess Plateau. The Yanchi County has many natural salt lakes, so it is also named ‘Salt pond,’ and there are two lakes—Beidachi and Gouchi, in the study area. Moreover, it is an extensive steppe and desert grassland from southeast to northwest, and it enjoys the well-known ningxia tan-sheep. In terms of the terrain topography, the terrain is high in the south and lows in the north, and the northern region is adjacent to the Mu Us Desert. The study area is a typical continental monsoon climate, cold in winter, and hot in summer with average temperature of 22.4 °C, temperature difference between day and night can reach 20 °C in autumn and winter handover. It belongs to an arid or semiarid climate with little precipitation and sufficient sunshine, the average annual evaporation of 2505 mm that is almost seven times the average annual precipitation of 375 mm.

Fig. 1
figure 1

Location and hydrogeological condition of the study area and sampling locations

In terms of the regional geology, the study area is located in the east of the Tianhuan Depression, Ordos Basin. It is mainly composed of Cretaceous strata-Huanhe and Luohandong formation, which consists of fine sandstones, mudstones, and sandstones and Quaternary unconsolidated alluvial and eluvium cover widely that comprises of sandy silt, clayey silt, silty sand, and silty fine sands (Duan et al. 2016; Wu et al. 2018b). The phreatic aquifer consists mainly of the lower Cretaceous and Quaternary aquifers, water-bearing formation of the Cretaceous-Luohe and Luohandong formation are extremely thick and widely distributed. However, Quaternary pore water is formed by an alluvial and eluvium stratum with variations of the thickness that has close hydraulic connection with underlying Cretaceous aquifer.

As shown in Fig. 1, it is observed that the terrain is high in the middle and low in the north and south, with an elevation ranging from 1279 to 1597 m. There is no perennial river in this study area, and the seasonal valley is confined to transient streams that run only in the rainy season. The drinkable surface water is scarce, Beidachi and Gouchi as salt water lake can’t be directly drink. Hence, groundwater has played an important role in local inhabitants and livestock for various uses. In the study area, groundwater is mainly recharged by rainfall, accounting for 70% of the total recharge, while the rest comes from the lateral recharge of the high-lying region (Duan et al. 2016). According to the direction of groundwater flow (Fig. 1), the groundwater flows along the topography and drains into the Beidachi and Gouchi lakes, and groundwater is mainly discharged through evaporation, overflow to the surface water body, and artificial exploitation (Wu et al. 2018b).

Sample Collection and Analysis

As shown in Fig. 1, the location of the sampling wells, which were evenly distributed in the study area, is observed. Twenty-seven groundwater samples were collected from hand-pumped tube wells and motor-pumped wells in three seasons, including dry season (January), normal season (April) and wet season (July). Among, eleven samples (red circle in Fig. 1) and sixteen samples (black circle in Fig. 1) were taken from Quaternary pore water (depths of approximately 10–50 m) and from Cretaceous pore-fissure water (depths of approximately 50–300 m), respectively. As a result, a total of 77 samples through 0.45-μm membrane filters were collected in clean and dry polyethylene plastic bottles, and one well was not sampled for some reasons in normal and wet seasons. Sample collection, handling, and storage followed the standard procedures recommended by the Chinese Ministry of Water Resources (Wu et al. 2018b). These groundwater samples used for major and trace element analysis were collected in 100 mL HNO3 washed polyethylene plastic bottles, followed by the addition of 6 M HNO3 to pH < 2, and the samples for the analysis of As species were preserved with 0.25 M EDTA (10%). We sent these samples to the Pony Testing International Group for the measurement of 8 parameters, such as Na+ was determined using a flame photometer; SO42− and Cl were analyzed using the ion chromatography method; and F and NO3 were determined by spectrophotometry. The concentrations of total dissolved As were determined by atomic fluorescence spectrometry with hydride generation (Guo et al. 2014). The accuracy of the water quality test was controlled by blank samples, parallel samples, and internal standard analysis, and the percentage of charge balance error (%CBE) was calculated to be less than 5%, suggesting that the accuracy of each index was within the quality requirements.

Risk Assessment Model

The models recommended by the Ministry of Environmental Protection of the P.R. China (MEPC 2014) are based on United States Environmental Protection Agency (USEPA) models. The models for non-carcinogenic risk through drinking water intake and dermal contact are as follows (MEPC 2014; Li et al. 2016). The non-carcinogenic risk through drinking water intake is expressed as (Li et al. 2019a, b):

$${\text{Intake}}_{{{\text{oral}}}} = \frac{C \times IR \times EF \times ED}{{BW \times AT}}$$
$${\text{HQ}}_{{{\text{oral}}}} { = }\frac{{{\text{Intake}}_{{{\text{oral}}}} }}{{{\text{RfD}}_{{{\text{oral}}}} }}$$

where Intakeoral is the daily average exposure dosage through drinking water intake (oral pathway) per unit weight (ug/kg day). C is the contaminant concentration in groundwater (mg/L), as determined by laboratory analyses. IR is the ingestion rate of water (L/day), 1.5 L/day of water is selected for adults and 0.7 L/day is selected for children in this study (Li et al. 2016; Wu and Sun. 2016). EF and ED represent the exposure frequency (day/year) and exposure duration (average life expectancy of the P.R. China, year), respectively, for the non-carcinogenic risk assessment, EF is 365 days per year and ED is 30 years for adults and 12 years for children (Li et al. 2019a, b). BW and AT are the body weight (average body weight of the P.R. China, kg) and average time of life for non-carcinogenic pollutants (day), respectively. For children, the BW is 15 kg; for adults, the BW is 76 kg. The AT values for adults and children are 10,950 and 4380 days, respectively. On the other hand, HQoral and RfDoral represent the hazard quotient and reference dosage, respectively. For non-carcinogenic pollutants introduced through the oral exposure pathway, the RfDoral values for F and As are 0.04 and 0.0003 mg/kg day, respectively (MEPC 2014; Li et al. 2016; Wu and Sun 2016).

If the values of HQ > 1.00, the substance is considered unsafe for human health (MEPC 2014), and residents are exposed to a non-carcinogenic risk. As can also create a CR for humans, and the CR of As is calculated by using the following equation (MEPC 2014):

$${\text{CR}}_{{{\text{oral}}}} {\text{ } = \text{ Intake}}_{{{\text{oral}}}} \times {\text{SF}}_{{{\text{oral}}}}$$

where CR denotes the carcinogenic risk, according to the Ministry of Environmental Protection of the P.R. China, the acceptable limit for CR is 1 × 10−6. SF is the slope factor for the carcinogenic contaminants (mg/ kg day). The Chinese technical guidelines for risk assessments of contaminated sites (MEPC 2014) set the SF values of As at 1.5 mg/kg day. The exposure duration (ED) for CR assessments is set at 25,550 days for both adults and children, indicating that the adverse effects from As on human health will last a lifetime.

Results and Discussion

Human Health-Risk Assessment

We calculated HQoral and CRoral based on the As concentrations of groundwater in the study area. Table 1 shows the calculated health risk to adults and children when they are exposed through drinking water intake in three seasons. For adults, the HQ from drinking water intake (HQoral) ranged from 0.01 to 4.83, with a mean of 0.92 in the wet season. In the normal and dry seasons, the HQoral ranged from 0.01 to 5.20 and 0.18 to 7.33, with mean values of 0.68 and 1.19, respectively. Meanwhile, the mean values of HQoral decreased slightly and then increased by 0.51 from the wet season to the dry season, indicating that the HQoral values were obviously affected by seasonal changes.

Table 1 The HQ and CR values for adults and children in three seasons

Based on the Ministry of Environmental Protection of the P.R. China, 6/27, 5/26, and 6/26 of groundwater samples had HQoral values exceeding 1 in three seasons, suggesting that some samples may induce non-carcinogenic risks to adults if they drink the contaminated groundwater. Similarly, the HQoral values for children ranged from 0.02 to 9.02, 0.02 to 0.91, and 0.33 to 13.69, with mean values of 1.72, 1.26, and 2.23 in the three seasons, respectively. As a result, children have smaller body weights and lower average life spans than adults due to non-carcinogenic risks; the HQoral values of all samples for children exceeded those of adults in three seasons; children in the study area faced higher non-carcinogenic risks.

Compared with the non-carcinogenic risk, as shown in Table 1, the CR created by drinking water (CRoral) is significantly lower for adults and children. In the wet season, the CRoral values of adults and children ranged from 3.89 × 10−6 to 2.26 × 10−3 and 1.81 × 10−5 to 1.05 × 10−2, with averages of 4.29 × 10−4 and 2.00 × 10−3, respectively. The CRoral values changed with seasons in ways that were similar to those of the HQoral values; the mean CRoral values were 3.16 × 10−4 and 5.57 × 10−4 for adults and 1.47 × 10−3 and 2.60 × 10−3 for children in the normal and dry seasons, respectively. In the study area, these values were higher than the acceptable limit (1.00 × 10−6) recommended by the MEPC (2014), and these results are consistent with those of other studies conducted in homogeneous areas in China (Li and Qian 2011; Li et al. 2014) Li et al (2016). revealed the carcinogenic risk created by drinking the water (CRoral) were higher than the acceptable limit with an average of 5.93 × 10–5 in a is a part of the Weining Plain in northwest China.

Coal and oil were important resource in the study area, it focused on the development of petrochemical industry, and several gas fields had been put into production. To reduce the health risks induced by ingestion of the contaminated groundwater, local Chinese governments have to take action to control and eliminate groundwater contamination; it is wise to pursue additional water for domestic uses. The As concentration of groundwater with burial depth > 100 m was less than 10 µg/L, local government established new water collection and transition networks to supply deep-layer groundwater to local residents for drinking purpose. Furthermore, human activities such as the disposal of sewage and animal wastes should also be regulated, preventing further deterioration of shallow groundwater (depths of approximately < 60 m). The capital construction of gas field should be strictly implemented in accordance with national standards and industrial effluents from it must be purified to national standards, groundwater pollution in this area can be effectively controlled. In the study area, groundwater had been contaminated may be due to the lack of public awareness on groundwater protection and ignorance of groundwater research, it is necessary to first establish groundwater-monitoring networks, and cleaning shallow groundwater was also recommended.

Effect of Groundwater Sampling Depth on As Concentration.

Groundwater sampling depth is a crucial factor affecting the As concentration in groundwater (Ahmad et al. 2013; Shahid et al. 2018). Guo et al. (2012) observed that high-As groundwater is present at depths greater than 15 m and is found in deep aquifers (40–100 m), which are currently used as domestic water supplies and for irrigation in the Hetao Basin of China. Furthermore, the mean As concentration (5.2 µg/L) of shallow wells (9–40 m) does not exceed the WHO safe limit of As in Punjab, Pakistan, indicating a safe aquifer zone for pumping groundwater; in contrast, the deeper wells at 41–90 m and > 90 m depth had mean As concentrations of 51 and 123 µg/L, respectively (Shakoor et al. 2018). Wang et al. (2018) reported that the As concentrations of unconfined groundwater samples were all < 10 µg/L (WHO), with an average of 1.99 µg/L. The As concentrations in confined groundwater ranged between 9.9 and 377 µg/L (average 109 µg/L), with the highest concentration (377 µg/L) reported at a depth of 221 m in the Guide basin, Northwest China.

Figure 2 shows that the groundwater As concentration did not obviously vary with sampling depth in the three seasons. In the study area, 12 samples were collected at water table depths less than 20 m, 5 samples were collected at depths between 20 and 60 m, and 10 samples were collected at depths of more than 60 m. Generally, As concentration was dependent on depth. For the samples collected at a depth of more than 60 m, the As concentration was ≤ 10 µg/L in the three seasons, except for one sample (A23) at a depth of 130 m, which had an As concentration of 15 µg/L. Of the samples collected from depths of less than 60 m, the As concentrations were greater than 10 µg/L: the As concentrations of 11 samples were between 10 and 50 µg/L. Moreover, one sample (A2) from a depth of 18 m had an As concentration of 58 µg/L in the dry season, and two and three samples had an As concentration greater than 50 µg/L in the normal and dry seasons, respectively.

Fig. 2
figure 2

The relationship between As concentration and sampling depth

The As concentrations of six samples (A1, A2, A4, A8, A10, and A26) were > 10 µg/L, and the depth of the water table was < 60 m. Among the samples, the A10 and A26 sampling wells belonged to the Quaternary pore groundwater and were located in the discharge area near Beida and Gouchi lakes, respectively. The other four groundwater samples came from Cretaceous pore-fissure groundwater, and the sampling wells were located in the mountain front with higher altitudes. Similarly, Sanaullah et al. (2016) and Toor and Tahir (2009) revealed that there was no significant relationship between As concentration and sampling depth. In the study area, it is found that there is no such relation exists; it may be resulted due to the dissolution of solutes from different sources and later its leakage towards ground water.

Moreover, Guo et al. (2012) reported that large variations in As concentration are common over short distances. Similarly, there was a low As concentration in well A3 from a depth of 60 m (7.0 µg/L), while the neighboring A4 groundwater samples from a depth of 50 m contained 30.0 µg/L As in the study area. Overall, in the normal and dry seasons, the relationship between As contents and sampling depths was similar to that in the wet season. Therefore, it is likely that high-As groundwater is present at depths less than 60 m, and this range is currently used for domestic water supplies and for irrigation; thus, additional research must focus on these depths.

Effect of Seasonal Variation on As Concentrations

The groundwater As concentration might also vary with season; relatively higher As contents are detected in groundwater during the pre-monsoon period compared to those during the post-monsoon season; which was attributed to increases in groundwater recharge due to rainfall (Zubair et al. 2014). Similarly, Savarimuthu et al. (2006) observed seasonal variation in As concentration in West Bengal, with the maximum As concentration in the monsoon season and the minimum As concentration in the dry season. However, some authors reported mixed variation in As content during different seasons. In a shallow aquifer of the Bengal Delta, the groundwater As concentration increased and decreased over an 8-year (2002–2010) observation period (McArthur et al. 2010). Moreover, in Bangladesh, one out of 20 wells showed higher As concentrations during the rainy season (Savarimuthu et al. 2006).

Figure 3 shows the spatial distribution of As concentration in the three seasons. D10 and D26 were located in groundwater discharge area and had higher As concentration in the wet season, however, their As concentration were less than 10 µg/L in the normal and dry seasons. Correspondingly, As concentration of D13 and D25 near the lakes became higher from wet season to dry season. Other groundwater samples with higher As concentration were basically located in recharge area. In the dry season, D20 and D22 were located in groundwater runoff area and had higher As concentration. There weren’t obviously relationship between As concentration and sampling point for all groundwater samples, suggesting that higher As concentration may be due to human activities such as the disposal of sewage and animal wastes (Wu and Sun 2016).

Fig. 3
figure 3

Spatial distribution of As concentration in three seasons (a wet season, b normal season, c dry season)

Figure 4 shows that As concentration varied with season, 77% of all samples had a positive difference from the dry to normal seasons, indicating that the groundwater As concentration decreased. Particularly, the As concentration of one sample (A14) ranged from 6.4 to 56.6 µg/L, and that sample was located in a recharge area with a higher altitude (Fig. 1), and the buried depth of the sampling well was approximately 10 m. Moreover, the groundwater As concentration was reduced by 29.8 and 30.9 µg/L for the two samples of A4 and A8, respectively. The difference in As concentration in other samples was less than 10 µg/L, suggesting that seasonal variation was not obvious.

Fig. 4
figure 4

Groundwater As concentration in three seasons

On the other hand, the As concentration of most samples increased from the normal season to the wet season, except for three samples with negative differences in As concentration. The A4 samples were located in the groundwater runoff area, and the buried depth of that sampling well was approximately 50 m. The concentration of groundwater As increased by 87.8 µg/L. Conversely, the As concentration decreased by 36.7 µg/L for the A10 samples, which were located in the discharge area near Beida Lake. The concentrations of other samples varied within 10 µg/L from the normal season to the wet season. As a result, seasonal variation had a slight effect on As concentration, and there was mixed variation in the As content from the dry season to the normal season to the wet season due to the local dissolution of Fe oxy-hydroxides (Nicolli et al. 2010).

Some studies have reported that the high concentration of bicarbonate in most groundwater samples can trigger As releases in groundwater and mobilize As from sediments in both oxic and anoxic conditions (Anawar et al. 2004; Farooqi 2015; Rasool et al. 2016). However, it has been reported that As releases are not always closely correlated with bicarbonate content and vary greatly with the presence of cations and redox conditions; furthermore, not all studies agree with the bicarbonate-mediated release of As in groundwater (Birkle and Alvarado 2010). Moreover, the combined role of pH and bicarbonate content may exert a significant effect on As leaching from the sediments (Zubair et al. 2014). In the study area, the groundwater As concentrations of the three samples (A4, A10 and A14) had a larger change, which did not occur in the corresponding concentrations of bicarbonate and pH values with seasonal variation (Table 3).

Significantly, groundwater contamination by leaching from pesticides and fertilizers is unlikely to occur in many areas with low rainfall, high evapotranspiration and strong As binding with soil minerals in alkaline soils, and the use of agrochemicals may result in As releases to surface and/or shallow groundwater (Shahid et al. 2018). Thus, the As concentrations of the three samples varied abnormally with seasonal variation, which might be related to the leaching of the pesticides and fertilizers from soils to groundwater in the study area.

Random Forest Model

The comprehensive evaluation of groundwater quality was determined by the highest classification for the single index evaluation, as recommended by the Quality Standard of Groundwater (QSGW 2015), and the groundwater quality was divided into five categories (Table 2). Moreover, if the Cl and F concentrations in groundwater are 400 mg/L and 2.5 mg/L, respectively, these two indicators fall into five categories, and the other indicators have fewer than five categories. The comprehensive evaluation of groundwater quality has five categories according to the QSGW. Based on the above method, 79 groundwater samples were classified in the study area, as shown in Table 3. The groundwater quality was very poor, possibly due to low rainfall, high evapotranspiration, and the underground environment.

Table 2 Classification of the QSGW
Table 3 Classification results of the QSGW and random forest

To determine which indicators are the most important in influencing the groundwater quality of the study area, a random forest algorithm is utilized to classify the samples and to evaluate the importance of features/indicators. Scikit-learn was used to implement the random forest algorithm with cross-validation procedure and to build the experiment pipeline (Pedregosa et al. 2012). It should be noted that, since the goal of this study is to take advantage of the random forest algorithm for the feature importance evaluation of groundwater quality indicators, the detailed formulation is not included, and additionally, in contrast to the original method (Breiman 2001), which lets each classifier vote for a single class, the scikit-learn implementation used in this study combines classifiers by averaging their probabilistic prediction instead. Random forest is one of the most widely used ensemble learning methods for classification, regression, and other tasks and is based on randomized decision trees. Moreover, because this approach is based on tree structures, the depth of a feature used as a decision node in a tree can be processed as the relative rank to assess the importance of the corresponding indicator with respect to the predictability of the target variable. As shown in Table 3, overall, there are eight indicators involved in the groundwater samples, and among all samples, only three of the samples (A16-N, A23-N, and A12-D) are not in category 4 or category 5; therefore, these three samples were removed from the dataset to simplify the groundwater classification task as a binary classification problem.

Indicator Importance Analysis

To evaluate the importance of indicators on the groundwater classification task, as mentioned above, the remaining 76 samples were used to fit a random forest model. The results are demonstrated in Fig. 5, where the red bars represent the feature importance of the forest as well as their inter-tree variability. As shown in Fig. 5, the four indicators of Na, TDS, TH, and F have an importance in the forest greater than 0.1. These indicators are deemed the most important indicators that affect the groundwater quality of the study area. Moreover, the effects of the four indicators on the overall groundwater quality decrease in the following order: Na > TDS > TH > F.

Fig. 5
figure 5

The indicator importance analysis with random forest

On the other hand, the importance of the other indicators was less than 0.1, and As was the least important indicator that affected the groundwater quality. In the study area, the poor groundwater quality is not caused only by the high content of some conventional indicators in groundwater; rather, fluorine had a great contribution. The long-term intake of this poor-quality groundwater has negative effects on resident health, such as suffering from chronic intoxication due to fluorine, and local residents and management departments must give this problem appropriate attention. In addition, the other indicator causing chronic intoxication is As; although the overall impact on groundwater quality is small, it should be taken seriously in some areas with high-As groundwater.

Given the relative rank of all indicators, we can further investigate the influence of these important indicators on the groundwater classification performance. The goal is to select features by incrementally considering larger and larger sets of features. First, the estimator is trained on the most important feature (i.e., Na). Then, based on the importance of each feature obtained by the random forest model, the second most important feature is added to the set of features. This procedure is repeated until all features are selected and the optimal set of features with the best classification performance is eventually found.

The classification performance is measured by using the accuracy based on a ten-fold cross-validation process. As mentioned above, a binary classification (i.e., category 4 vs. category 5) experiment is carried out to select the optimal set of indicators. In the ten-fold cross-validation process, the sample water data points are randomly assigned to 10 sets, d0, d1,…, d9, so that all sets are roughly equal in size. Then, each of the ten sets is retained as the validation data, while the remaining 9 sets are used for training; thus, every data point was used for both training and validation on each fold. It should be noted that for every single validation, the random forest classifier is trained separately to ensure the reliability of the experimental results. As shown in Fig. 6, the optimal set of indicators contained all four of the most important indicators (i.e., Na, TDS, TH, and F) obtained by the random forest model, which achieved a classification accuracy of 88.21%. This result indicates that the groundwater quality was primarily determined by Na, TDS, TH, and F based on the collected samples, and these four indicators significantly reduced the groundwater quality in the study area.

Fig. 6
figure 6

The optimal indicators on the groundwater classification

Conclusions

In this study, we investigated the distribution characteristics of high-As groundwater in time and space, and an attempt was made to assess the health risk of As. The random forest model was used to simplify the groundwater classification task as a binary classification problem, to evaluate the importance of indicators on the groundwater classification task, and to investigate the influence of these important indicators on the groundwater classification performance. We obtained the following main conclusions from this study:

  1. (1)

    Groundwater As concentration did not obviously vary with sampling depth in three seasons, and high-As groundwater is present at depths less than 60 m.

  2. (2)

    Seasonal variation had a slight effect on the As concentration, and the groundwater As concentration varied abnormally with seasonal variation, which might be related to human activity.

  3. (3)

    The HQ and CR values of all groundwater samples for children exceeded those of adults in three seasons: 33% samples had HQ > 1, and the CR values of all samples were higher than the acceptable limit, indicating a higher non-carcinogenic risk and a serious carcinogenic health risk.

  4. (4)

    The most important indicators that affected the groundwater quality were Na, TDS, TH, and F; when combined, this optimal set of indicators achieved a classification accuracy of 88.21% for groundwater quality.