Water quality prediction method based on fused TCKAN model

By integrating the TCN and KAN layers into the TCKAN model, the problem of nonlinear feature processing of water quality data is solved, enabling efficient and accurate water quality prediction and early warning of anomalies, which is suitable for water resource management.

CN120950874APending Publication Date: 2025-11-14NANJING UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202511067477.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-31
Publication Date
2025-11-14

AI Technical Summary

Technical Problem

Existing water quality prediction methods, such as linear regression and BP neural networks, are unable to effectively handle the nonlinear characteristics of water quality data, and their prediction accuracy and efficiency are insufficient.

Method used

A hybrid TCKAN model is adopted, combining TCN and KAN layers. The TCN layer extracts time series features through convolutional structure, and the KAN layer uses a learnable B-spline function for nonlinear transformation to construct a TCKAN hybrid model for water quality prediction.

Benefits of technology

It improves the accuracy and efficiency of water quality forecasting, enables early warning of water quality anomalies, assists in water resource management strategies, and reduces computational costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120950874A_ABST
    Figure CN120950874A_ABST
Patent Text Reader

Abstract

The invention discloses a water quality prediction method based on a fused TCKAN model, and belongs to the technical field of water quality prediction, and the method comprises the following steps: S1, collecting the sequence data of a plurality of water quality indexes through an online water quality monitoring device, and obtaining an original data set; s2, preprocessing the original data set; s3, inputting the processed original data set into a TCKAN hybrid model for water quality prediction; the TCKAN hybrid model comprises a TCN layer and a KAN layer. According to the method, the advantages of the TCN layer and the KAN layer are fused, efficient time sequence feature extraction and powerful nonlinear modeling capability are achieved, the calculation cost is reduced with extremely low parameter quantity, and the precision and efficiency of long-sequence water quality prediction are effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of water quality prediction technology, and in particular to a water quality prediction method based on a fused TCKAN model. Background Technology

[0002] With the rapid advancement of industrialization and urbanization, water pollution has become increasingly prominent, making accurate water quality prediction crucial for water resource management, aquatic ecosystem protection, and public health maintenance. Currently, traditional water quality prediction methods, such as linear regression and time-series ARIMA models, are limited by linear assumptions and unable to cope with the complex and variable nonlinear characteristics of water quality data. Backpropagation (BP) neural networks, on the other hand, are prone to getting stuck in local optima during training, resulting in poor prediction accuracy and lengthy prediction times.

[0003] Meanwhile, the emerging KAN network, with its unique activation function layout and operation mechanism, has opened up new ideas for nonlinear modeling of data; TCN, on the other hand, can efficiently extract key features of time series by leveraging the advantages of convolutional structure.

[0004] Based on this, a water quality prediction method based on the fusion of the TCKAN model is proposed. Summary of the Invention

[0005] The purpose of this invention is to provide a water quality prediction method based on a fused TCKAN model to solve the problems in the background art.

[0006] To achieve the above objectives, this invention provides a water quality prediction method based on a fused TCKAN model, comprising the following steps:

[0007] S1. Collect sequence data of various water quality indicators through online water quality monitoring devices to obtain the raw dataset;

[0008] S2. Preprocess the original dataset;

[0009] S3. Input the processed original dataset into the TCKAN hybrid model for water quality prediction, and output the predicted values ​​of water quality indicators after training.

[0010] The TCKAN hybrid model consists of TCN and KAN layers.

[0011] Preferably, in S1, the water quality indicators include water temperature, pH, dissolved oxygen, ammonia nitrogen, total phosphorus, and total nitrogen.

[0012] Preferably, in step S2, the specific steps for preprocessing the original dataset are as follows:

[0013] S21. Data cleaning: Use interpolation or multiple imputation to fill in missing values; use statistical methods to identify and remove outliers; the statistical method follows the 3σ principle.

[0014] S22. Data Standardization and Normalization: Z-score standardization and Min-Max normalization are used to eliminate the dimensional differences between different water quality indicators.

[0015] Preferably, in step S3, the specific steps for water quality prediction using the TCKAN hybrid model are as follows:

[0016] S31. Input the processed original dataset into the TCN layer for time series feature extraction to obtain a multi-channel matrix;

[0017] S32. Input the multi-channel matrix into the KAN layer for nonlinear transformation and feature abstraction to obtain the water quality index prediction results.

[0018] Preferably, in S31, the TCN layer consists of a first convolutional layer, a dilated causal convolutional layer, a batch normalization layer, and an activation function layer.

[0019] Preferably, in step S31, the specific process of using the TCN layer for time series feature extraction is as follows:

[0020] (1) For the processed original dataset, convolution operation is used to extract local features;

[0021] (2) Expand the receptive field by using dilation convolution operation;

[0022] (3) Perform batch normalization to accelerate model convergence;

[0023] (4) The ReLU activation function is used to introduce nonlinear factors to enhance the model’s ability to express complex data relationships.

[0024] Preferably, in S32, the KAN layer consists of input nodes, multiple hidden layer nodes, a learnable activation function, and an output node.

[0025] Preferably, in step S32, the specific process of using the KAN layer for nonlinear transformation and feature abstraction is as follows:

[0026] (1) Map the multi-channel matrix to the input node;

[0027] (2) Add the output of the previous layer node at the hidden layer node to generate an intermediate feature representation. Use a learnable activation function to perform a nonlinear transformation on the intermediate feature representation. The learnable activation function is the B-spline function.

[0028] (3) The feature representation after multi-layer nonlinear transformation is used as the prediction result and passed to the output layer for output.

[0029] Preferably, the prediction result is expressed as:

[0030] KAN=(Φ L-1 Φ L-2 …Φ1Φ0)X;

[0031] In the formula, Φ i Let X represent the learnable one-dimensional function matrix of the i-th layer in the KAN layer, and let X represent the multi-channel matrix.

[0032] Preferably, after completing the water quality prediction, the prediction results of the water quality indicators are evaluated using multiple evaluation indicators. The evaluation indicators include mean absolute error, root mean square error, mean absolute percentage error, and coefficient of determination. Among them, mean absolute error and root mean square error are used to measure the error between the model's predicted value and the actual value, mean absolute percentage error is used to evaluate the accuracy of the model's prediction, and coefficient of determination is used to compare and analyze the model's prediction performance.

[0033] Therefore, the water quality prediction method based on the fused TCKAN model of the present invention has the following beneficial effects:

[0034] (1) By combining the advantages of TCN layer and KAN layer, the model has both efficient temporal feature extraction and strong nonlinear expression capability. The TCN layer uses dilated causal convolutional layer to accurately capture the short-term fluctuations, medium-term trends and long-term dependencies of water quality indicators, while the KAN layer uses learnable B-spline activation function to flexibly fit the complex nonlinear interactions between water quality indicators. This complementary architecture breaks through the limitations of traditional linear models and single neural networks, and significantly improves the prediction accuracy.

[0035] (2) The TCKAN hybrid model adopts a very low parameter design and combines batch normalization and residual connection technology of TCN layer to effectively accelerate training convergence, avoid gradient vanishing problem and enhance stability. At the same time, KAN layer reduces the dependence on preset function form by adaptively learning activation function parameters, and significantly reduces the computation cost while ensuring high accuracy. This efficiency is especially suitable for the real-time prediction needs of long sequence water quality data, and can provide early warning for water quality anomalies and assist managers in formulating water resource protection strategies.

[0036] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description

[0037] Figure 1 This is an overall flowchart of an embodiment of the present invention;

[0038] Figure 2 This is a diagram of the TCKAN hybrid model architecture according to an embodiment of the present invention;

[0039] Figure 3 Total nitrogen prediction at a monitoring point according to an embodiment of the present invention Figure 1 ;

[0040] Figure 4 Total nitrogen prediction at a monitoring point according to an embodiment of the present invention Figure 2 . Detailed Implementation

[0041] The technical solution of the present invention will be further described below with reference to the accompanying drawings and embodiments.

[0042] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are some embodiments of the present invention, but not all embodiments.

[0043] Example

[0044] like Figure 1 As shown, the present invention provides a water quality prediction method based on a fused TCKAN model, comprising the following steps:

[0045] S1. Collect sequence data of various water quality indicators through online water quality monitoring devices to obtain the raw dataset, specifically:

[0046] In this embodiment, the conventional online water quality monitoring device collects raw water quality monitoring data from the monitoring points every 4 hours at a fixed step size, and uploads the collected raw data to the database as the raw dataset. The dataset is divided according to time and different water quality indicators. The main water quality indicators include water temperature, pH, dissolved oxygen, ammonia nitrogen, total phosphorus, and total nitrogen.

[0047] S2. Preprocess the original dataset; remove outliers and missing values ​​affected by human factors from the sequence data, and organize it into time series data of selected water quality indicators at 4-hour intervals over the past 2-3 years, specifically:

[0048] S21. Data cleaning: supplementing and removing missing and outlier values ​​caused by human factors or equipment damage during monitoring. Use statistical methods (such as the 3σ principle) to identify and remove water quality index values ​​that deviate significantly from the normal range. Missing data are supplemented by interpolation or multiple imputation methods.

[0049] S22. Data Standardization and Normalization: To eliminate dimensional differences, time series data undergoes standardization or normalization. The resulting data is suitable input for TCKAN. For example, water temperature ranges from 0 to 30 degrees Celsius, while chemical oxygen demand (COD) ranges from 0 to 100 mg / L. Normalization and standardization allow data from different indicators to be on the same scale, which helps TCKAN better learn data characteristics.

[0050] This embodiment uses Z-score standardization and Min-Max normalization to eliminate the dimensional differences between different water quality indicators. Z-score standardization transforms the data into a normal distribution with a mean of 0 and a standard deviation of 1, which facilitates model training convergence and improves stability. Min-Max normalization maps the data to the [0, 1] interval, which is simple and intuitive to operate and can preserve the original distribution characteristics of the data to a certain extent, meeting the needs of some models that are sensitive to data scale.

[0051] S3 and TCN efficiently extract temporal features using convolutional structures, but they are somewhat inadequate when dealing with deep nonlinear relationships between complex water quality data. KAN networks, with their unique learnable activation function settings, differ from traditional deep learning models by utilizing B-spline functions to endow the network with powerful nonlinear expressive capabilities, but when applied alone to long-sequence data, they are still not accurate enough in capturing dependencies with large time spans. Therefore, the advantages of both are combined to construct the TCKAN hybrid model.

[0052] The processed original dataset is input into the TCKAN hybrid model for water quality prediction. After training, the predicted values ​​of water quality indicators are output. The TCKAN hybrid model consists of two core layers: the TCN layer and the KAN layer. First, the processed water quality dataset is input into the TCN layer. The time series features can be extracted through the dilated causal convolutional layer of the TCN to obtain a multi-channel matrix. The multi-channel matrix reflects the changing trends of water quality indicators at different time scales (such as short-term fluctuations of total nitrogen, medium-term changing trends of dissolved oxygen, etc.) and the potential correlations between indicators. Subsequently, the obtained multi-channel matrix is ​​input into the KAN layer. After processing by the KAN layer, the predicted values ​​are output, specifically:

[0053] S31. Input the processed original dataset into the TCN layer for time series feature extraction to obtain a multi-channel matrix (feature tensor); the TCN layer consists of a first convolutional layer, a dilated causal convolutional layer, a batch normalization layer, and an activation function layer;

[0054] The specific process of using the TCN layer for time series feature extraction is as follows:

[0055] (1) First convolutional layer: The processed original dataset (multivariate water quality time series data) is input into the first convolutional layer of TCN. The convolutional kernel slides on the time series (convolution operation) to extract local features. Taking dissolved oxygen time series as an example, the convolutional kernel captures the fluctuation characteristics of dissolved oxygen concentration in a short period of time and its correlation with other water quality indicators within a local time window by calculating the dot product between the convolutional kernel and the input data.

[0056] (2) Dilated Causal Convolutional Layers: As the network depth increases, dilated convolution operations are used to expand the receptive field; for example... Figure 2 The second convolutional layer, with an expansion rate of 2, can capture the medium-term trends of water quality indicators such as dissolved oxygen concentration and their interactions with other indicators over slightly longer periods without significantly increasing computational load. The third convolutional layer further captures long-term variation characteristics.

[0057] (3) Batch normalization layer: After each convolution operation, batch normalization is performed to accelerate model convergence and improve model stability.

[0058] (4) Activation function layer: After step (3), the ReLU activation function is used to introduce nonlinear factors to enhance the model’s ability to express complex data relationships.

[0059] Features after batch normalization and ReLU activation can better represent the nonlinear interactions between water quality indicators, such as the changes in the nonlinear relationship between dissolved oxygen and chemical oxygen demand at different time scales.

[0060] (5) Residual connection layer: In order to avoid the gradient vanishing problem, this embodiment also introduces residual connections. That is, in addition to the normal convolution result, the output of each layer also includes the input data itself (after appropriate dimensionality adjustment), so that the network can learn deeper feature information better, while ensuring that the gradient can be effectively transmitted to the shallow network during backpropagation.

[0061] S32. The multi-channel matrix is ​​input into the KAN layer for nonlinear transformation and feature abstraction to obtain the water quality index prediction results. The KAN layer consists of input nodes, multiple hidden layer nodes, learnable activation functions, and output nodes, specifically:

[0062] (1) Based on the architectural characteristics of the KAN network, determine the number of nodes in the network, the connection method between nodes, and the initial parameter settings of the learnable activation function (B spline function in this embodiment), and map the multi-channel matrix to the input nodes;

[0063] (2) At the hidden layer nodes of the KAN layer, the outputs of the previous layer nodes (input nodes or previous hidden layer nodes) are added to generate intermediate feature representations. For example, a certain hidden layer node combines the input features representing "short-term fluctuations in total nitrogen", "medium-term trends in dissolved oxygen" and "water temperature changes" to form a new, comprehensive intermediate feature representation; then, a B-spline function (learnable activation function) is used to perform a nonlinear transformation on the intermediate feature representation.

[0064] B-spline functions automatically learn and fit the complex nonlinear relationships inherent in the input multi-channel matrix and their mapping patterns with future values ​​of target water quality indicators by adjusting their parameters (B-spline coefficients). During model training, the shape and parameters of the activation function are automatically learned and optimized through the backpropagation algorithm and the Adam optimizer.

[0065] This learnable nonlinear transformation can flexibly fit arbitrarily complex nonlinear relationships between input features and between features and the prediction target. Taking the prediction of total phosphorus concentration as an example, features (comprehensive information including water temperature, pH, total phosphorus value, and trends of other pollutants) combined through node addition are input into a learnable B-spline function. This function learns and adjusts the coefficients of its basis functions to accurately simulate the nonlinear accelerating effect of rising water temperature on total phosphorus concentration within a specific pH range. This fitting ability far surpasses that of traditional neural networks with fixed activation functions.

[0066] (3) The feature representation after multi-layer nonlinear transformation is used as the prediction result and passed to the output layer for output, specifically:

[0067] Steps (1) and (2) are carried out layer by layer in the multi-layer KAN structure. Each layer gradually abstracts and refines higher-level, more predictive nonlinear feature representations through node addition and transformation of learnable activation functions. Deep KAN can learn very complex feature interactions and nonlinear dependencies.

[0068] Finally, the feature representation, after undergoing multiple nonlinear transformations, is passed to the output node (output layer) of the KAN layer; such as Figure 3 , Figure 4 As shown, the value of the output node directly corresponds to the predicted value of the target water quality indicator for one or more future time steps.

[0069] The KAN layer processes the input feature tensor X through a hierarchical composition of the learnable function matrix Φ, and the prediction result is expressed as:

[0070] KAN=(Φ L-1 Φ L-2 …Φ1Φ0)X;

[0071] In the formula, Φ iLet X represent the learnable one-dimensional function matrix of the i-th layer in the KAN layer, where i ranges from 0 to L-1. Let X represent the multi-channel matrix. This calculation formula indicates that the KAN layer transforms the multi-channel matrix X after processing the TCN layer, and obtains the nonlinear relationship of important temporal features, which can be used to predict the values ​​of water quality indicators at future time steps.

[0072] After completing the water quality prediction, the prediction results of water quality indicators are evaluated using a variety of evaluation indicators. The evaluation indicators include mean absolute error (MAE), root mean square error (RMSE), mean absolute percentage error (MAPE), and coefficient of determination (R²). Among them, mean absolute error and root mean square error are used to measure the error between the model's predicted value and the actual value, mean absolute percentage error is used to evaluate the accuracy of the model's prediction, and the coefficient of determination represents the correlation between two random variables and is used to compare and analyze the predictive performance of the model.

[0073] Therefore, this invention presents a water quality prediction method based on the fusion TCKAN model. By combining the advantages of TCN and KAN layers, this model achieves efficient temporal feature extraction and powerful nonlinear expression capabilities, significantly improving prediction accuracy. At the same time, its extremely low parameter design, combined with batch normalization and residual connection techniques, accelerates training convergence and enhances stability. Meanwhile, KAN's adaptive learning reduces pre-set dependencies and lowers computational costs, making the model highly suitable for real-time prediction of long-sequence water quality data, providing support for water quality anomaly early warning and resource management decisions.

[0074] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that it can still provide insights into the present invention.

[0075] The technical solution is modified or equivalently replaced, and these modifications or equivalent replacements do not...

[0076] It can cause the modified technical solution to deviate from the spirit and scope of the technical solution of the present invention.

Claims

1. A water quality prediction method based on a fused TCKAN model, characterized in that, Includes the following steps: S1. Collect sequence data of various water quality indicators through online water quality monitoring devices to obtain the raw dataset; S2. Preprocess the original dataset; S3. Input the processed original dataset into the TCKAN hybrid model for water quality prediction. After training, the predicted values ​​of water quality indicators are output. The TCKAN hybrid model consists of TCN and KAN layers.

2. The water quality prediction method based on the fused TCKAN model according to claim 1, characterized in that: In S1, the water quality indicators include water temperature, pH, dissolved oxygen, ammonia nitrogen, total phosphorus, and total nitrogen.

3. The water quality prediction method based on the fused TCKAN model according to claim 1, characterized in that, In step S2, the specific steps for preprocessing the original dataset are as follows: S21. Data cleaning: Use interpolation or multiple imputation methods to fill in missing values; use statistical methods to identify and remove outliers. S22. Data Standardization and Normalization: Z-score standardization and Min-Max normalization are used to eliminate the dimensional differences between different water quality indicators.

4. The water quality prediction method based on the fused TCKAN model according to claim 1, characterized in that, In step S3, the specific steps for water quality prediction using the TCKAN hybrid model are as follows: S31. Input the processed original dataset into the TCN layer for feature extraction to obtain a multi-channel matrix; S32. Input the multi-channel matrix into the KAN layer for nonlinear transformation and feature abstraction to obtain the water quality index prediction results.

5. The water quality prediction method based on the fused TCKAN model according to claim 4, characterized in that: In S31, the TCN layer consists of a first convolutional layer, a dilated causal convolutional layer, a batch normalization layer, and an activation function layer.

6. The water quality prediction method based on the fused TCKAN model according to claim 4, characterized in that, In S32, the KAN layer consists of input nodes, multiple hidden layer nodes, learnable activation functions, and output nodes.

7. A water quality prediction method based on a fused TCKAN model according to claim 6, characterized in that, In S32, the specific process of using the KAN layer for nonlinear transformation and feature abstraction is as follows: (1) Map the multi-channel matrix to the input node; (2) Add the output of the previous layer node at the hidden layer node to generate an intermediate feature representation, and use a learnable activation function to perform a nonlinear transformation on the intermediate feature representation; (3) The feature representation after multi-layer nonlinear transformation is used as the prediction result and passed to the output layer for output.

8. The water quality prediction method based on the fused TCKAN model according to claim 7, characterized in that, The prediction result is expressed as follows: KAN=(Φ L-1 F L-2 …Φ1Φ0)X; In the formula, Φ i Let X represent the learnable one-dimensional function matrix of the i-th layer in the KAN layer, and let X represent the multi-channel matrix.

Citation Information

Patent Citations

  • Lake and river water quality parameter prediction method based on time convolutional neural network

    CN117275600A