准确的水质预测有助于水资源的智能化管理。水质指标具有时间序列特征和非线性,但是现有模型在引入长短期记忆(LSTM)时只关注前向时间序列,没有考虑模型上的并行计算。正因为如此,构建了一个名为LSTM-多头注意力(LMA)的新神经网络来预测水质,利用长短期记忆对时序数据进行处理,利用多头注意进行并行计算和特征信息提取。此外,水质指数存在数据类型多、数据关联复杂的问题,以及水质数据中的数据缺失和数据异常问题。为了解决这些问题,这项研究提出了一种称为GRA-LMA的基于线性插值的水质预测模型,灰色关联分析和LMA。以淮河流域水质数据为案例,进行了两个实验,验证了GRA-LMA的预测性能。第一个实验侧重于数据处理,包括水质数据的缺失数据和异常数据的处理,水质指标的相关性分析。线性插值适用于处理丢失的数据,同时采用箱线图和直方图相结合的方法对异常数据进行分析和剔除,然后用线性插值修复异常数据。采用灰色关联分析法计算不同水质指标之间的关联度,和相关性较高的水质指标,以确定水质预测模型的输入变量。数据处理结果表明,使用灰色关联分析可以在不改变数据变化模式和模型的情况下使用线性插值进行修复,以减少其输入所需的数据量。在第二个实验中,GRA-LMA和反向传播神经网络(BP)等现有模型的预测能力,递归神经网络(RNN),长短期记忆(LSTM),和门循环单元(GRU)使用不同的数值和图形性能评估指标进行评估和比较。对比实验结果表明,pH值均方误差,溶解氧,化学需氧量,氨氮,电导率,浊度,总磷,GRA-LMA的总氮减少到0.05890、0.40196、0.322454、0.04368、14.71003、8.13252、0.01558和0.14345。结果表明,GRA-LMA对各种水质指标具有较好的预测适应性,并能显著降低预测误差。
Accurate prediction of water quality contributes to the intelligent management of water resources. Water quality indices have time series characteristics and nonlinearity, but the existing models only focus on the forward time series when long short-term memory (LSTM) is introduced and do not consider the parallel computation on the model. Owing to this, a new neural network called LSTM-multihead attention (LMA) was constructed to predict water quality, using long short-term memory to process time series data and multihead attention for parallel computing and extracting feature information. Additionally, water quality indices have the issues of multiple data types and complex data correlations, as well as missing data and abnormal data problems in water quality data. In order to solve these problems, this study proposes a water quality prediction model called GRA-LMA-based linear interpolation, gray relational analysis and LMA. Two experiments are carried out to verify the predictive performance of the GRA-LMA with the water quality data of the Huaihe River Basin as a
case study sample. The first experiment focuses on data processing, including the processing of missing data and abnormal data of water quality data, and the correlation analysis of water quality indices. Linear interpolation is adapted to process the missing data, while a combination of boxplot and histogram is adopted to analyze and eliminate the abnormal data, which is then repaired the abnormal data with linear interpolation. The gray relational analysis is adopted to calculate the correlation between different water quality indices, and water quality indices with high correlation are retained to determine the input variables of the water quality prediction model. The data processing results demonstrate that repairs can be made using linear interpolation without altering the pattern of data change and the model by using the gray relational analysis to reduce the quantity of data it needs as input. In the second experiment, the predictive capacity of GRA-LMA and existing models such as backpropagation neural network (BP), recurrent neural network (RNN), long short-term memory (LSTM), and gate recurrent unit (GRU) was evaluated and compared using different numerical and graphical performance evaluation metrics. Comparative experimental results show that the mean square error of pH, dissolved oxygen, chemical oxygen demand, ammonia nitrogen, electrical conductivity, turbidity, total phosphorus, and total nitrogen of GRA-LMA is reduced to 0.05890, 0.40196, 0.32454, 0.04368, 14.71003, 8.13252, 0.01558, and 0.14345. The results indicate that GRA-LMA has superior adaptability for predicting various water quality indices and can significantly lower the induced prediction error.