Determination of Optimal Predictors and Sampling Frequency to Develop Nutrient Soft Sensors Using Random Forest

Sensors (Basel). 2023 Jun 30;23(13):6057. doi: 10.3390/s23136057.

Abstract

Despite advancements in sensor technology, monitoring nutrients in situ and in real-time is still challenging and expensive. Soft sensors, based on data-driven models, offer an alternative to direct nutrient measurements. However, the high demand for data required for their development poses logistical issues with data handling. To address this, the study aimed to determine the optimal subset of predictors and the sampling frequency for developing nutrient soft sensors using random forest. The study used water quality data at 15-min intervals from 2 automatic stations on the Main River, Germany, and included dissolved oxygen, temperature, conductivity, pH, streamflow, and cyclical time features as predictors. The optimal subset of predictors was identified using forward subset selection, and the models fitted with the optimal predictors produced R2 values above 0.95 for nitrate, orthophosphate, and ammonium for both stations. The study then trained the models on 40 sampling frequencies, ranging from monthly to 15-min intervals. The results showed that as the sampling frequency increased, the model's performance, measured by RMSE, improved. The optimal balance between sampling frequency and model performance was identified using a knee-point determination algorithm. The optimal sampling frequency for nitrate was 3.6 and 2.8 h for the 2 stations, respectively. For orthophosphate, it was 2.4 and 1.8 h. For ammonium, it was 2.2 h for 1 station. The study highlights the utility of surrogate models for monitoring nutrient levels and demonstrates that nutrient soft sensors can function with fewer predictors at lower frequencies without significantly decreasing performance.

Keywords: machine learning; nitrate; optimization; surrogate; water quality.

MeSH terms

  • Environmental Monitoring* / methods
  • Nitrates*
  • Nutrients
  • Phosphates
  • Random Forest
  • Rivers
  • Water Quality

Substances

  • Nitrates
  • Phosphates

Grants and funding

We appreciate the support from the Open Access Publishing Fund of the Technical University of Munich (TUM).