Water quality index prediction model training method, device and equipment and storage medium

By using a meta-learner network in the water quality index prediction model for data augmentation and training with self-supervised hierarchical comparison model, the problem of low accuracy of the existing water quality index prediction model is solved, and higher prediction accuracy and stability are achieved.

CN119807697APending Publication Date: 2025-04-11NORTHEASTERN UNIV CHINA +2
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202411606774.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-12
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

The prediction results of the existing water quality index prediction model are low in accuracy, making it difficult to effectively solve the lag problem in the monitoring process of water quality index.

Method used

A water quality index prediction model training method is adopted. By obtaining the training data set, using the meta-learner network for data augmentation, generating an enhanced time series data set, and inputting it into the self-supervised hierarchical comparison model for training, optimizing model parameters to improve prediction accuracy.

Benefits of technology

Through data augmentation and self-supervised level comparison learning, the accuracy of the prediction results of water quality indicators is improved, and the stability and generalization ability of the model are enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119807697A_ABST
    Figure CN119807697A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a water quality index prediction model training method and device, equipment and a storage medium, and the method comprises the steps: carrying out the data enhancement of a training data set through employing a meta-learner network after the training data set is obtained, so as to obtain an enhanced time series data set. And inputting the enhanced time sequence data set into a trained model, and calculating training loss through the trained model, thereby optimizing model parameters of the trained model according to the training loss. According to the method, data enhancement can be carried out by utilizing a meta-learner network, layered contrast learning is carried out on multiple dimensions of global, instance and time, and information of a time sequence on different semantic hierarchies is comprehensively captured. The sequence features are extracted by using the convolutional neural network, and the self-supervised hierarchical comparison model is trained and established, so that the accuracy of the water quality index prediction result can be improved, and the stability is relatively high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of water treatment technology, and in particular to a water quality index prediction model training method, device, equipment and storage medium. Background Art

[0002] In the water treatment industry, by monitoring water quality indicators, we can timely understand key parameters such as pollutant concentration, microbial quantity, pH value, total phosphorus, etc. in the water body, and help water treatment plants and related institutions monitor water quality to ensure that the water quality meets relevant standards and requirements. Based on the monitoring results, the water quality environment can be regulated, such as adding drugs to adjust the pH value in the water quality, adjust the living environment of microorganisms, and adjust the concentration of corresponding elements in the water body. Real-time and effective monitoring of water quality indicators can improve production quality, prevent equipment damage, water pipe network corrosion and other problems, and improve production efficiency.

[0003] Since the water quality index monitoring process has a lag in the water treatment industry, it is necessary to analyze and predict historical data and trends to discover potential problems in advance, so as to take preventive measures in advance to ensure the stability and reliability of production operations. In order to predict water quality indicators, water quality numerical simulation methods can be used to study the physical, chemical and biological elements in the water environment and construct mathematical models to predict water quality indicators.

[0004] However, the mathematical model constructed based on the water quality numerical simulation method has a complex structure and it is difficult to accurately estimate the parameters, which affects the prediction effect of the mathematical model in practical applications and leads to a low accuracy rate in the prediction results of water quality indicators. Summary of the invention

[0005] In view of this, the embodiments of the present application provide a water quality index prediction model training method, device, equipment and storage medium to solve the problem of low accuracy of water quality index prediction results.

[0006] According to one aspect of the present application, a water quality index prediction model training method is provided, the method comprising:

[0007] Acquire a training data set, wherein the training data set includes a target data column and a time index column, wherein the target data column is used to record detection parameters of water quality indicators, and the time index column is used to record detection time of water quality indicators;

[0008] Using a meta-learner network to perform data augmentation on the training dataset to obtain an augmented time series dataset, the augmented time series dataset comprising cropped sequence segments generated by randomly cropping adaptive augmented instance data, the adaptive augmented instance data being augmented instances generated by the meta-learner network based on the training dataset;

[0009] Inputting the enhanced time series data set into a trained model, and calculating the training loss through the trained model, wherein the trained model is a self-supervised hierarchical contrast model; the trained model is used to perform hierarchical contrast on the enhanced time series data set in global, instance and time dimensions to generate hierarchical contrast loss, and extract sequence features using a convolutional neural network;

[0010] Model parameters of the trained model are optimized according to the training loss.

[0011] Optionally, the method further includes:

[0012] Extracting a target data column and a time index column from the training data set;

[0013] Calculate the time index frequency corresponding to the time index column;

[0014] According to the time index frequency, completing the missing time index columns in the training data set;

[0015] Using the completed time index column as an index, detecting missing values ​​in the target data column;

[0016] The missing values ​​are completed based on an interpolation completion algorithm, and the abnormal values ​​in the target data column are replaced with adjacent mean values, wherein the abnormal values ​​are parameter values ​​in the target data column after the missing values ​​are completed, and the difference between the values ​​and the mean values ​​of adjacent parameter values ​​is greater than a parameter fluctuation threshold.

[0017] Optionally, the method further includes:

[0018] Set training command line parameters, including data file location, model hyperparameters, and iteration rounds;

[0019] Running a parser according to the training command line parameters, and setting a prediction length, wherein the parser is used to read the training data set; the prediction length is used to set a prediction period for the output result;

[0020] Using the parser, extract data features of a first dimension from the training data set and extract time features of a second dimension from the time index column to generate a feature set of a third dimension, wherein the third dimension is equal to the sum of the first dimension and the second dimension;

[0021] The target data column and the feature set are divided into a training set, a validation set and a test set.

[0022] Optionally, performing data augmentation on the training dataset using a meta-learner network includes:

[0023] Calling a generative adversarial network, wherein the generative adversarial network includes a generator and a discriminator;

[0024] Inputting the training data set into a generator so that the generator generates fake sample data according to the training data set;

[0025] Inputting the training data set and the fake sample data into the discriminator to obtain a probability value output by the discriminator;

[0026] Based on the probability value, calculating the adversarial training loss of the generator and the discriminator according to the minimization loss function;

[0027] The network parameters of the generator and the discriminator corresponding to the multi-layer neural network are optimized according to the adversarial training loss.

[0028] Optionally, the method further includes:

[0029] Invoking a meta-learner network for adaptively selecting a data augmentation strategy based on high-fidelity and / or high-diversity information-aware criteria;

[0030] selecting a candidate transformation function, the candidate transformation function being associated with a weight for inferring a probability of selection of the candidate transformation function;

[0031] For an original instance in the training data set, an enhanced instance is obtained by calculating the candidate transformation function, wherein the original instance is a single data point extracted from the training data set; and the enhanced instances are set to have the same length;

[0032] By combining the enhanced instances corresponding to the candidate instance functions, an adaptive enhanced instance is obtained.

[0033] Optionally, the method further includes:

[0034] Selecting a time tensor of the training data set;

[0035] Obtaining a time step of the adaptive enhancement instance data;

[0036] Generate a cutting length, wherein the cutting length is generated according to a set input length of the prediction model, or is generated by a random number;

[0037] Calculate the shearing range according to the shearing length based on the randomly selected shearing starting position;

[0038] The adaptive enhancement instance data is clipped according to the clipping range to obtain the clipping sequence segment.

[0039] Optionally, calculating the training loss by the trained model includes:

[0040] Creating positive instance data based on the cropped sequence segments, the positive instance data including the cropped sequence segments obtained by cropping the same time series;

[0041] A training loss is calculated for the positive instance data, wherein the training loss includes one or more combinations of a global contrast loss, an instance contrast loss, and a time contrast loss; the global contrast loss is obtained by performing a contrast calculation on feature identifiers of the entire data set or the entire time series data; the instance contrast loss is obtained by performing a contrast calculation on different cropped sequence segments of the same instance; the time contrast loss is obtained by performing a contrast calculation on feature representations of the same time series instance at different time steps;

[0042] Optimizing the model parameters of the trained model according to the training loss includes:

[0043] If the training loss is greater than a loss threshold, modifying a model parameter of the trained model according to the training loss;

[0044] If the training loss is less than or equal to the loss threshold, the model parameters of the trained model are output to obtain a water quality index prediction model.

[0045] According to another aspect of the present application, a water quality index prediction model training device is provided, the device comprising:

[0046] A data acquisition module, used to acquire a training data set, wherein the training data set includes a target data column and a time index column, wherein the target data column is used to record the detection parameters of the water quality index, and the time index column is used to record the detection time of the water quality index;

[0047] a data enhancement module, configured to perform data enhancement on the training data set using a meta-learner network to obtain an enhanced time series data set, wherein the enhanced time series data set includes cropped sequence segments generated by randomly cropping adaptively enhanced instance data, wherein the adaptively enhanced instance data is an enhanced instance generated by the meta-learner network according to the training data set;

[0048] A loss calculation module, used for inputting the enhanced time series data set into a trained model, and calculating the training loss through the trained model, wherein the trained model is a self-supervised hierarchical contrast model; the trained model is used for performing hierarchical contrast on the enhanced time series data set in global, instance and time dimensions to generate hierarchical contrast loss, and extracting sequence features using a convolutional neural network;

[0049] A parameter optimization module is used to optimize the model parameters of the trained model according to the training loss.

[0050] According to another aspect of the present application, an electronic device is provided, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor implements the above-mentioned water quality index prediction model training method when executing the program.

[0051] According to another aspect of the present application, a storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the above-mentioned water quality index prediction model training method is implemented.

[0052] By means of the above technical scheme, a water quality index prediction model training method, device, equipment and storage medium provided in the embodiment of the present application can perform data enhancement on the training data set using a meta-learner network after obtaining the training data set to obtain an enhanced time series data set. The enhanced time series data set is then input into the trained model, and the training loss is calculated by the trained model, thereby optimizing the model parameters of the trained model according to the training loss. The method can use a meta-learner network for data enhancement, and perform hierarchical comparative learning in multiple dimensions of global, instance and time to comprehensively capture information at different semantic levels of the time series. By using a convolutional neural network to extract sequence features, train and establish a self-supervised hierarchical comparative model, the accuracy of the water quality index prediction results can be improved while having high stability.

[0053] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0055] Figure 1 A schematic diagram of the water quality index prediction model training method provided in an embodiment of the present application is shown;

[0056] Figure 2 A schematic diagram of the training data preprocessing process provided in an embodiment of the present application is shown;

[0057] Figure 3 A schematic diagram of a process for processing abnormal values ​​provided in an embodiment of the present application is shown;

[0058] Figure 4 A schematic diagram of a generative adversarial network processing flow provided in an embodiment of the present application is shown;

[0059] Figure 5A schematic diagram of the water quality index prediction model training process provided in an embodiment of the present application is shown;

[0060] Figure 6 A schematic diagram of a process for generating a cropping sequence segment provided in an embodiment of the present application is shown;

[0061] Figure 7 A schematic diagram of a process of dividing a data set provided in an embodiment of the present application is shown;

[0062] Figure 8 A schematic diagram of a training loss calculation process provided in an embodiment of the present application is shown;

[0063] Fig. 9 A schematic diagram of a water quality index prediction process provided in an embodiment of the present application is shown;

[0064] Fig.10 A schematic diagram of the structure of a water quality index prediction model training device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0065] The present application will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.

[0066] In the embodiments of the present application, the water quality index refers to a specific measurement index that can affect the water quality and judge the degree of water pollution. According to the specific type of water quality index, it can include physical indicators, chemical indicators, biological indicators, radioactive indicators, etc. Among them, physical indicators are used to describe the physical properties of water, including but not limited to smell, temperature, turbidity, transparency, color, etc. Chemical indicators are used to describe the chemical composition of water, including but not limited to pH value, dissolved oxygen, permanganate index (COD), total phosphorus and total nitrogen, etc. Biological indicators are used to assess the degree of biological contamination of water bodies, including but not limited to total bacteria, coliform group, algae, etc. Radioactive indicators are used to assess the degree of radioactive contamination of water bodies, including but not limited to total alpha rays, total beta rays, uranium, radium, thorium and other radioactive element contents, etc.

[0067] In the embodiments of the present application, water quality indicators are used to represent the above specific indicators for scheme description. It should be understood that the water quality indicators may include one or more combinations of the above specific indicators. For example, some embodiments use key parameters such as pollutant concentration, microbial count, pH value, total phosphorus, etc. used by water treatment plants and relevant regulatory agencies to monitor water quality as examples of water quality indicators. Water quality indicators may also include other indicators that can affect water quality other than the above specific indicators, such as social factor indicators, etc., which are not specifically limited.

[0068] Water quality index prediction is the process of collecting historical monitoring data of water quality indicators and building prediction models to predict water quality data in the future. Among them, the prediction model can be built based on numerical simulation methods, statistical methods, machine learning methods, and deep learning methods. Depending on the constructed prediction model, the specific water quality index prediction process also varies.

[0069] In some embodiments, if the prediction model is constructed based on a numerical simulation method, the water environment quality can be predicted by analyzing the physical, chemical and biological elements in the water environment and constructing a mathematical model. Among them, when constructing a prediction model based on a numerical simulation method, a conceptual model can be established first, that is, the simulated area, boundary conditions and initial conditions are determined based on detailed geographic information. Then, according to the conceptual model, a suitable mathematical model is selected, such as a one-dimensional, two-dimensional, three-dimensional model, a water flow model, a solute transport model, a reaction model, a hydrodynamic-water quality coupling model, etc. Then, based on methods such as finite elements and finite differences, the mathematical model is converted into a solvable numerical model. Then, the simulation results are compared with the measured results, and the parameters are adjusted so that the simulation results are consistent with the measured results within a given error range. After the confidence of the model reaches the design requirements, the corrected parameter values ​​are used for prediction and future water quality indicators are estimated.

[0070] In some embodiments, if the prediction model is constructed based on statistical methods, the model can be constructed using historical observation data, such as an autoregressive integrated moving average model (ARIMA) and regression analysis.

[0071] In some embodiments, if the prediction model is constructed based on machine learning methods, nonlinear models such as support vector machines (SVM), random forests, and artificial neural networks (ANN) can be used to construct the prediction model. The prediction accuracy can be improved by continuously improving the method, such as simulating complex water quality relationships.

[0072] In some embodiments, if the prediction model is built based on a deep learning method, a convolutional neural network (CNN) method can be used to extract local features that are invariant across spatial dimensions, or local features can be extracted in the time dimension and gradually summarized in the previous layer through multiple hidden layers, thereby obtaining hidden information of a longer sequence of past time periods.

[0073] In order to associate with more distant time series information and improve the accuracy and stability of the prediction results, the Recurrent Neural Network (RNN) method can also be used for prediction, such as the Long Short-Term Memory (LSTM) network. Its core RNN network can learn the internal hidden states of all time series before the prediction as the feature representation of past information, and combine it with the current input to give the result of the next prediction.

[0074] Considering that in the process of building a prediction model based on a deep learning method, it may be limited by the gradient explosion and vanishing problems, thereby limiting the length of the water quality indicator prediction sequence. Therefore, in some embodiments, a self-attention network can be used for prediction. For example, based on the Transformer model, the corresponding association between each unit in the input time series can be realized, and the context information interaction of the time series can be better realized.

[0075] In some embodiments, self-supervised learning methods can also be used for prediction, that is, the time series is analyzed according to generative, comparative and adversarial methods. Among them, the generative method is to learn the distribution of time series data by building a generative model, while the comparative method is to learn the representation of data by comparing positive and negative sample pairs. The adversarial method uses a generative adversarial network to generate time series samples close to real data. The self-supervised time series prediction method can use a large amount of unlabeled data for training, reduce the dependence on labeled data, and thus improve the generalization ability and robustness of the model.

[0076] In the self-supervised time series prediction methods, learning general representations of time series, such as (TimeSeries Contrastive Learning with Information-Aware Augmentations), (Fully-Connected Spatial-Temporal Graph for Multivariate Time-Series Data), (Conditional BERT Contextual Augmentation), etc., can focus on learning instance-level representations, by describing the entire part of the input time series and performing tasks such as clustering and classification to predict water quality indicators.

[0077] In addition, contrastive loss can also be used to learn the inherent structure of time series, such as Time-Series Representation Learning Via Temporal And Contextual Contrasting (TS-TCC), Unsupervised Scalable Representation Learning For Multivariate Time Series, etc. However, the method of using contrastive loss to learn time series still has obvious limitations. For example, the learned representation only considers the internal relationship of the sequence itself, but ignores the correlation between different sequences, and rarely distinguishes multi-scale contextual information of different granularities, that is, it is not effective for multi-source data. Moreover, the instance-level representation in self-supervised learning may not be suitable for tasks that require fine-grained representation. The time series prediction task needs to infer the target at a specific timestamp or subsequence, and the coarse-grained representation of the entire time series is not enough to achieve the preset performance.

[0078] In addition, most unsupervised time series representation learning methods are greatly influenced by the fields of Computer Vision (CV) and Natural Language Processing (NLP) in terms of design ideas and techniques. These two fields usually assume that data has strong transformation invariance and cropping invariance, that is, after a certain degree of transformation or cropping, the essential information and distribution of the data will not change significantly. This assumption is not necessarily applicable to time series data, because the distribution and semantics of time series data may change over time, and the cropped subsequence may have obvious differences in distribution from the original sequence. For example, if only the first few time points are taken, the distribution may be different from that of the complete sequence.

[0079] Based on this, in order to improve the accuracy of the prediction results, this embodiment provides a water quality index prediction model training method, such as Figure 1 As shown, the method includes:

[0080] S101. Obtain a training data set.

[0081] The training data is the water quality indicator monitoring data used to perform model training. Since the water quality indicator monitoring process is a periodic measurement process performed over time, the water quality indicator data obtained by monitoring has an associated relationship with time, that is, each specific data point of the monitoring indicator is associated with a timestamp. Accordingly, the training data set includes a target data column and a time index column. The target data column is used to record the detection parameters of the water quality indicator, and the time index column is used to record the detection time of the water quality indicator. Exemplarily, the training data set can be shown in the following table:

[0082] time Pollutant N concentration Microbial count pH Total Phosphorus January 82 552 7.5 0.16 February 78 489 6.8 0.13 March 65 320 7.2 0.18 April 80 540 8.9 0.2 May 77 532 - 0.15 June 95 780 7.6 - July 87 531 7.4 0.15 August 105 895 8.2 0.17 September 83 - 7.1 0.15 October 75 576 6.9 0.1 November 68 524 6.7 0.09 December 70 533 7.0 0.13

[0083] It can be seen that in the above table, the first column (the data column with the header "Time") is the time index column, and the second to fifth columns (the data columns with the headers "Contaminant N Concentration", "Microbial Quantity", "pH Value" and "Total Phosphorus" respectively) are the target data columns. Since each data point in the target data column has an associated relationship with the time point in the time index column, any target data column can form a time series with a time index column. That is, in a time series, multiple data points are included that are arranged according to the associated time points.

[0084] The training data set also includes classification labels for performing model training. Depending on the output type of the trained model, the classification labels can be expressed in different forms. For example, when the water quality index prediction model is used to predict the pollutant concentration, microbial count, pH value, and total phosphorus in the next month, the training data can be labeled with the specific pollutant concentration, microbial count, pH value, and total phosphorus in the next month.

[0085] The classification labels in the training data set can be added by manual annotation, that is, by manually reviewing each data item and assigning it the correct classification label. Labeling tools can also be used to automatically or semi-automatically add labels, such as Labelbox, Dataloop, etc.

[0086] In some embodiments, since the water quality index monitoring data is time series data, each specific monitoring parameter is associated with a time parameter. Therefore, when the prediction model is a specific water quality index parameter for a specific prediction period in the future, the monitoring parameters of the latter period can be directly used as the classification label of the monitoring data of the previous period. For example, when the prediction model uses 6 months of monitoring data to predict the water quality index parameters of the seventh month, the water quality index parameters actually monitored in July can be set as the classification label of the monitoring data from January to June. Similarly, the water quality index parameters actually monitored in August are set as the classification label of the monitoring data from February to July.

[0087] The training data set can be stored in the database of the water quality index prediction system and updated in real time with the specific water quality index data monitoring process. It should be noted that the model training process can be performed locally by terminal devices such as personal computers and mobile terminals, or by network devices such as servers in the cloud. Therefore, when performing water quality index prediction model training, the electronic device performing model training can send a data call request to the database. After obtaining the data call request, the database can feedback the training data set to the electronic device for the electronic device to perform model training.

[0088] After obtaining the training data set, data preprocessing can be performed based on the training data set. The data preprocessing process can filter, denoise, and convert the data in the training data set to convert the training data into a time series form. In the process of data preprocessing, the water quality indicator monitoring data can also be completed and center-aligned.

[0089] For example, for a given water quality prediction dataset You can first determine the sample batch size. Based on the maximum training length you set, split the long sequence into multiple sequences that are smaller than the length. For each input sequence x in a batch of samples, i , check its input dimension and make sure it is 3D (number of samples, number of time steps, number of features). Then all samples are processed for missing values ​​and center alignment.

[0090] That is Figure 2 As shown, in some embodiments, the method further includes: extracting a target data column and a time index column from the training data set. Calculating the time index frequency corresponding to the time index column. Then, according to the time index frequency, completing the missing time index column in the training data set. And using the completed time index column as an index, detecting the missing value in the target data column. Then completing the missing value based on an interpolation completion algorithm.

[0091] For example, when preparing a training dataset, you can extract the target data column Data from the table i , i is the target data column number, and the time index column Date is extracted. Then the time index column frequency is extracted, that is, the time frequency unit is determined, including daily, hourly, minutely, secondly, irregular, etc. The missing index columns are completed after the time frequency unit is determined. For example, when the time frequency unit is daily, if the data row of August 14 in the training data set is directly August 16, then the index column is determined to be missing according to the time frequency unit. Therefore, the missing time value of August 15 can be completed in the time index column.

[0092] After completing the missing time in the time index column, use the Date column as the index to check the data column. i Missing values ​​are interpolated and completed. The interpolation completion can calculate the interpolation value based on the linear interpolation algorithm, the polynomial interpolation algorithm, the spline interpolation algorithm, the radial basis function (RBF) interpolation algorithm, etc., and add the interpolation value to the missing value position to complete the training data set.

[0093] After completing the missing values ​​of the training data set, anomaly detection can also be performed on the training data set after completing the missing values ​​to determine whether there are outliers in the training data set and process the outliers. That is, in some embodiments, after completing the missing values ​​based on the interpolation completion algorithm, the outliers in the target data column can also be replaced with adjacent mean values. The outliers are parameter values ​​in the target data column after completing the missing values, whose difference with the mean of adjacent parameter values ​​is greater than the parameter fluctuation threshold.

[0094] like Figure 3 As shown, in order to process outliers, the method further includes: traversing the target data column after completing the missing values ​​to obtain the target parameter value and the adjacent parameter values ​​of the target parameter value (S301). Then calculating the mean of the adjacent parameter values, and the difference between the target parameter value and the mean (S302). If the difference between the target parameter value and the mean is less than the parameter fluctuation threshold, it means that the current target parameter value is not an outlier, so there is no need to perform outlier processing on the target parameter value. If the difference between the target parameter value and the mean is greater than or equal to the parameter fluctuation threshold, it means that the current target parameter value is an outlier, so the mean can be used to replace the target parameter value (S303).

[0095] For example, for any target parameter value x in the training dataset n , we can extract the adjacent parameter values ​​of the target parameter value, that is, x n-1 and x n+1 . Then calculate the mean of two adjacent parameter values Right now:

[0096]

[0097] Then calculate the mean of adjacent parameter values With the target parameter value x n The difference And compare the difference Δx with the parameter fluctuation threshold x t , if the difference Δx between the target parameter value and the mean is greater than or equal to the parameter fluctuation threshold x t , indicating the current target parameter value x nis an outlier, so the adjacent mean can be used to handle the outlier, such as using the mean Replace the target parameter value x n Similarly, if the difference Δx between the target parameter value and the mean is less than the parameter fluctuation threshold x t , indicating the current target parameter value x n is not an outlier, so there is no need to replace the target parameter value x in the training dataset n .

[0098] It can be seen that in the above embodiment, the water quality index prediction model training method can use the actual water quality index monitoring data to construct the original data set, and perform data cleaning and data preprocessing on the original data set to form a complete time series data set. In the data preprocessing stage, missing value processing is performed for the missing water quality index data, and the time date data used as the data index is supplemented to alleviate the problem of ineffective prediction due to lack of accurate label data and missing data in the water quality index prediction process.

[0099] S102: Use a meta-learner network to perform data enhancement on the training dataset to obtain an enhanced time series dataset.

[0100] After obtaining the training dataset and performing data preprocessing, a meta-learner network can be used for data augmentation to obtain more reliable data. The meta-learner network is a machine learning framework that aims to enable the model to use historical learning experience to guide the learning of new tasks, thereby improving the learning efficiency and generalization ability of the model on new tasks. The meta-learner network can perform data augmentation based on the original training dataset, use Generative Adversarial Networks (GAN) for data production, and use the information-aware augmentation strategy generated by the meta-learner network to guide data augmentation of the produced samples, and use the data augmented dataset as training input.

[0101] Then, each batch of samples is randomly cropped to obtain its time step. And based on the cropped part from the same input, a cropped time series is generated. Therefore, the enhanced time series data set includes cropped sequence segments generated by randomly cropping the adaptive enhanced instance data. The adaptive enhanced instance data is an enhanced instance generated by the meta-learner network according to the training data set.

[0102] like Figure 4As shown, when performing data enhancement, the generative adversarial network can be called first. The generative adversarial network is a deep learning model, including a generator and a discriminator. The generator and the discriminator compete with each other under the framework of a zero-sum game, and jointly promote the training and optimization of GAN. The role of the generator is to create synthetic data samples. The generator can receive a random sequence as input, and gradually convert this random noise into a false data sample similar to the real data sample through a multi-layer neural network. The task of the discriminator is to distinguish between real data and false sample data. The discriminator is also a multi-layer neural network that can take real samples and false sample data generated by the generator as input, and output a probability value, indicating the probability that the input data is real data.

[0103] Therefore, after calling the generative adversarial network, the training data set can be input into the generator so that the generator generates fake sample data according to the training data set, and then the training data set and the fake sample data are input into the discriminator to obtain the probability value output by the discriminator.

[0104] During the training process, the generator and the discriminator are trained in an adversarial manner. The goal of the generator is to generate realistic data samples as much as possible, so that the discriminator cannot distinguish between real data and generated fake data. The goal of the discriminator is to distinguish between real data and generated fake data as accurately as possible. Therefore, the discriminator can output a probability value that can characterize the degree of similarity between real data and fake sample data.

[0105] Then, based on the probability value, the adversarial training loss of the generator and the discriminator is calculated according to the minimization loss function. The performance of the generator and the discriminator is improved by minimizing their respective loss functions. Eventually, the generator can learn to generate realistic data samples, and the discriminator can accurately distinguish between real data and generated false data, thereby producing data samples. During the training process, the network parameters of the multi-layer neural network corresponding to the generator and the discriminator can be optimized according to the adversarial training loss. That is, if the adversarial training loss is greater than the loss threshold, the network parameters of the multi-layer neural network corresponding to the generator and the discriminator are modified according to the training loss. If the adversarial training loss is less than or equal to the loss threshold, the expanded sample data is generated by the generator.

[0106] After generating a large amount of augmented sample data, the meta-learner network can also be used for data enhancement. Figure 5As shown, in some embodiments, the method further includes: calling a meta-learner network, which can adaptively select a data enhancement strategy based on high-fidelity and / or high-diversity information perception criteria. Therefore, a candidate transformation function can be selected. The candidate transformation function is associated with a weight for inferring the selection probability of the candidate transformation function. For the original instance in the training data set, an enhanced instance is obtained by calculating the candidate transformation function. The original instance is a single data point extracted from the training data set; the enhanced instances are set to the same length. Then, by combining the enhanced instances corresponding to the candidate instance functions, an adaptive enhanced instance is obtained.

[0107] In this embodiment, the meta-learner network is also called the meta-learner network. The meta-learner network can adaptively select the best data augmentation strategy based on two information perception criteria: high fidelity or high diversity. The selection of the optimal augmentation is regarded as a priori selection. A set of candidate transformation functions is randomly selected, and each candidate transformation function t i ∈T with weight p i ∈(0, 1), and infer the selection transformation t i For an instance x, through the transformation function t i The obtained enhanced instance v i It can be calculated as follows:

[0108] a i ~Bernoulli(p i )

[0109] v i =(1-a i )x+a i t i (x)

[0110] Taking into account multiple transformations, all augmented instances v i are set to the same length. By combining candidate instances, the adaptive enhancement instance v can be obtained, that is, the adaptive enhancement instance v is calculated according to the following formula:

[0111]

[0112] In order to use gradient-based methods for efficient optimization, a binary specific distribution is used to approximate the discrete Bernoulli process, i.e., a i Approximately:

[0113] ε~Uniform(0,1)

[0114]

[0115] Among them, δ(-) is the sigmoid function and τ is the parameter that controls the approximation.

[0116] It can be seen that in the above embodiment, through the meta-learner network, the feature representation of time series data can be optimized by learning to generate information-aware data enhancement strategies. By learning a large number of data enhancement strategies, the meta-learner network can adaptively generate enhancement methods suitable for different data based on the input time series data, thereby enhancing the generalization ability of the model.

[0117] After obtaining the adaptive augmentation instance through the data augmentation strategy determined by the meta-learner network, random cropping operations can be performed on the adaptive augmentation instance and the original data. Figure 5 As shown, in some embodiments, the method further includes:

[0118] The time tensor of the training data set is selected, and the time step of the adaptive enhancement instance data is obtained. Then, a shearing length is generated according to the set input length of the prediction model, or a shearing length is generated by a random number. And according to the randomly selected shearing start position, a shearing range is calculated according to the shearing length. And the adaptive enhancement instance data is sheared according to the shearing range to obtain the shearing sequence segment.

[0119] For example, Figure 6 As shown, during the random shearing operation, the time tensor of the input 3D (number of samples, number of time steps, number of features) time series can be selected and the time step ts of the current input sequence can be obtained. l , and generate a cutting length c according to the model settings or through random numbers, and then in the valid range (0~ts l -crop l ) Randomly select the starting position of the crop to calculate the boundary Crop left , that is, determine the end position of the clipping, and finally use the calculated clipping range to clip the input data to obtain different clipping sequence segments out i .

[0120] It can be seen that in the above embodiment, the GAN adversarial network can be used for data production, and the information-aware enhancement strategy generated by the meta-learner network can be used to guide data enhancement on the produced sample data, and the data set after data enhancement is used as input. Each batch of samples is randomly cropped in sequence to obtain its time step. For the cropped parts out1 and out2 from the same input, a cropped time series is generated.

[0121] In some embodiments, in order to obtain data feature representation, feature representation extraction can also be performed based on a feature representation extractor. In each training iteration, the input data is passed to the feature representation extractor and a new feature output is obtained for hierarchical contrast loss calculation. The feature representation extractor can be used to convert the input time series data into a higher-dimensional, abstract feature representation through a series of operations such as convolution and activation. These representations can contain potential patterns and structural information in the time series, which can be used to improve the predictive ability of the model.

[0122] The feature representation extractor may include a module for generating continuous masks, a module for generating binomial masks, a sequence encoder, and a dilated convolutional encoder. The masker creates a missing value mask to mark which time steps have valid values. And for the time steps with missing values, fill them with 0 for subsequent processing. The processed input data is projected through a linear layer, and after passing through a fully connected layer to form a hidden layer representation, a mask is generated and applied to the input data to ensure that the unmasked time steps will be used for calculation during inference. The mask is then combined with a valid value mask so that the mask processes both invalid and valid data. The data shape is transformed to accommodate the convolution operation, and then input into the dilated convolutional encoder for feature extraction and convolution calculation, and the extracted feature representation containing the feature dimension is returned.

[0123] S103: inputting the enhanced time series data set into a trained model, and calculating a training loss through the trained model.

[0124] Wherein, the trained model is a self-supervised hierarchical contrast model. The trained model is a water quality index prediction model that does not reach the predetermined accuracy. The trained model is used to perform hierarchical contrast on the enhanced time series data set in the global, instance and time dimensions to generate hierarchical contrast losses, and use a convolutional neural network to extract sequence features to output water quality index prediction results. Before performing training, the trained model can be an initial self-supervised hierarchical contrast model. During the training process, the model parameters can be continuously modified as the training loss is back-propagated so that the output prediction results gradually approach the classification labels.

[0125] like Figure 7 As shown, when executing model training, you can first set the training command line parameters, including the data file location, model hyperparameters, and iteration rounds. Then run the parser according to the training command line parameters, and set the prediction length. The parser is used to read the training data set; the prediction length is used to set the prediction period of the output result.

[0126] For example, when executing training, you can set corresponding command line parameters, including data file location, model hyperparameters, iteration round n, etc. By running the command line parameter parser, the data set is read and the prediction length is given to determine how many future time points to consider in the output prediction.

[0127] The parser is then used to extract data features of the first dimension from the training data set and time features of the second dimension from the time index column to generate a feature set of the third dimension, and the target data column and the feature set are divided into a training set, a validation set and a test set.

[0128] The third dimension is equal to the sum of the first dimension and the second dimension. For example, in the case of a single column of water quality index data input, 1 dimension data features and 7 dimensions of time features are obtained from the date index column, and finally the features including the data column and 8 dimensions are divided into a training set, a validation set, and a test set.

[0129] After dividing the training set, validation set, and test set, the training set can be first input into the trained model, that is, the training set can be used to perform model training. The trained model can output prediction results for the input training set and calculate the training loss based on the prediction results. The calculated training loss is used for back propagation to continuously optimize the model parameters of the trained model. Therefore, in some embodiments, calculating the training loss through the trained model also includes: creating positive instance data based on the cropped sequence segments. Among them, the positive instance data includes the cropped sequence segments obtained by cropping from the same time series. For example, different cropped sequence segments obtained after random cropping, such as cropped segments out1 and out2, these output feature representations are different random croppings generated from the same input sequence, aiming to create a pair of positive instances.

[0130] The training loss is then calculated for the positive instance data. The training loss is a hierarchical contrast loss, which can optimize the model by dividing the data into multiple levels and comparing the feature representations of each level. Therefore, the training loss includes one or more combinations of global contrast loss, instance contrast loss, and time contrast loss.

[0131] The global contrastive loss is obtained by comparing the feature identifiers of the entire data set or the entire time series data. Global contrastive loss is a loss function used for self-supervised learning, which aims to learn more global and holistic feature representations by comparing the feature representations of the entire data set or the entire time series data.

[0132] The instance contrast loss is obtained by comparing different cropped sequence segments of the same instance. Instance contrast loss is obtained by comparing different cropped parts of the same instance to determine the difference between the prediction result and the classification label. Instance contrast loss focuses on promoting model learning by calculating the distance between similar instances. The cropped segments out1 and out2 can be connected together to form a larger feature set Z, and then the dot product is used to calculate these representation similarity matrices sim, that is, sim = Z·Z T , and based on the transposed similarity matrix sim T The instance contrastive loss is calculated using the negative log loss function.

[0133] The temporal contrast loss is calculated by comparing the feature representations of the same time series instance at different time steps. Temporal contrast loss can compare the feature representations of the same time series instance at different time steps. The calculation method of temporal contrast loss is similar to that of instance contrast loss, but it requires that out1 and out2 have temporal correlation.

[0134] After calculating the loss, the total layer contrast loss, i.e. the training loss, can be calculated. The training loss is calculated as follows:

[0135] Instance Contrastive Loss

[0136] Temporal contrast loss

[0137] Global contrast loss

[0138] Layer contrast total loss

[0139] Where i and j are the indexes of the input time series samples, and t is the timestamp. i,t and r′ i,t represents the same timestamp t, and comes from x i , such as out1 and out2 from the same crop segment. Ω is the timestamp set of the overlapping parts of the two subsequences, and 1 is the indicator function. B represents the batch size. ij is the sample x i and x j The label can only be 0 or 1, s ij is the sample x i and x j distance, m is a hyperparameter.

[0140] The training loss is calculated using a hierarchical contrastive loss function. The similarity can be learned through contrastive loss between instances, while constraints between time series are used to infer the consistency of time values, and a global contrastive loss is used to capture instance-level relationships in time series datasets.

[0141] S104: Optimize model parameters of the trained model according to the training loss.

[0142] After the training set is input into the trained model so that the trained model outputs the prediction result and the training loss, the model parameters of the trained model can be optimized according to the training loss. In order to optimize the model parameters, the training loss can be compared with the loss threshold. If the training loss is greater than the loss threshold, it means that the current trained model has not yet reached the preset requirements, so the model parameters of the trained model can be modified according to the training loss.

[0143] Using the calculated loss value, the gradient of each parameter to the loss is calculated through back propagation through the fully connected layer and the dilated convolutional encoder. The gradient of the parameters of each layer can be obtained by propagating from the output layer to the front layer in sequence through the chain rule. These gradient values ​​can be used to indicate the sensitivity of the loss to each parameter. Using the calculated gradient, the parameters of the model are updated to minimize the loss, thereby updating the model parameters. This operation is performed through the optimizer. The parameter update can be based on the following formula:

[0144]

[0145] Among them, θ is the model parameter, η is the learning rate, is the gradient of the loss function with respect to the parameters.

[0146] For example, Figure 8 As shown, during the first round of training, given the initial noise data set And randomly crop the input data to increase the diversity of training. Learn a nonlinear embedding function f θ , which takes each x i Mapped to the representation r that best describes it i , the hierarchical contrast loss function is used to calculate the instance contrast loss and time contrast loss, and the first F1 of the model is obtained through training.

[0147] At this time, since the training loss is greater than the loss threshold and the trained model has not yet reached the preset requirements, the model parameters of the trained model can be modified according to the training loss, that is, the first F1 of the model obtained through training is repeatedly trained, and the loss of the model F1 of the previous round can be used to calculate the loss of the randomly cropped input to obtain the mth round of refined model, while optimizing the model parameters. In each training iteration, the model will continuously update the weights, and each input data will be forward propagated through the feature representation extractor to obtain new feature outputs. The loss function of the model, namely the hierarchical contrast loss, relies on these feature representations for calculation, thereby guiding the optimization process. The trained model obtains F m .

[0148] After multiple rounds of repeated training, when the training loss is less than or equal to the loss threshold, it means that the current trained model has met the preset requirements. At this time, the model parameters of the trained model can be output to obtain a water quality index prediction model.

[0149] In some embodiments, the number of iterations can be preset. When the number of repeated training rounds reaches the preset number of iterations, the iteration can be terminated and the model parameters can be output. For example, when m=n, the iteration is terminated and the final model F is obtained. n , while saving the scaling and other related parameters during the training process.

[0150] It can be seen that in order to fully capture the information at different semantic levels of the time series, based on the water quality index prediction model training method provided in the above embodiment, hierarchical comparative learning can be performed in three dimensions: global, instance, and time. At the same time, for each subsequence that needs to be extracted, it is encoded according to its timestamp (time point) to obtain a coded vector sequence, and then the maximum pooling operation is performed on this coded vector sequence to obtain a representation for any subsequence of the time series, realizing multi-resolution learning of the time series context.

[0151] Through the water quality index prediction model training method provided by the above embodiment, the subsequence representation can contain the most important information at each time point, will not be affected by subtle changes such as the time sequence, can better capture its dynamic change characteristics, and obtain a robust contextual representation of each subsequence without introducing unappreciated inductive biases such as transformation invariance and cropping invariance, which can overcome the defects of prediction methods that focus on learning instance-level representations and use contrastive loss to learn inherent structures.

[0152] After the prediction model is obtained by training the water quality index prediction model training method provided by the above embodiment, the prediction model can be used to predict water quality indexes. In the model prediction stage, it can include model effect evaluation and data input model prediction. The model effect evaluation uses the saved model loading method, and the prediction result is obtained after input and the effect evaluation is performed. Fig. 9As shown, the data input model prediction process is similar, requiring the same format as the training data and the same date index frequency. After inputting the water quality index data, the prediction results can be obtained.

[0153] Further, as a specific implementation of the water quality index prediction model training method described in the above embodiment, the present application embodiment provides a water quality index prediction model training device, such as Fig.10 As shown, the water quality index prediction model training device includes:

[0154] A data acquisition module, used to acquire a training data set, wherein the training data set includes a target data column and a time index column, wherein the target data column is used to record the detection parameters of the water quality index, and the time index column is used to record the detection time of the water quality index;

[0155] a data enhancement module, configured to perform data enhancement on the training data set using a meta-learner network to obtain an enhanced time series data set, wherein the enhanced time series data set includes cropped sequence segments generated by randomly cropping adaptively enhanced instance data, wherein the adaptively enhanced instance data is an enhanced instance generated by the meta-learner network according to the training data set;

[0156] A loss calculation module, used for inputting the enhanced time series data set into a trained model, and calculating the training loss through the trained model, wherein the trained model is a self-supervised hierarchical contrast model; the trained model is used for performing hierarchical contrast on the enhanced time series data set in global, instance and time dimensions to generate hierarchical contrast loss, and extracting sequence features using a convolutional neural network;

[0157] A parameter optimization module is used to optimize the model parameters of the trained model according to the training loss.

[0158] It should be noted that for other corresponding descriptions of the functional units involved in a water quality index prediction model training device provided in an embodiment of the present application, reference can be made to the corresponding descriptions in the water quality index prediction model training method described in the above embodiment, and will not be repeated here.

[0159] By means of the above technical solution, a water quality index prediction model training device provided in an embodiment of the present application can use a meta-learner network to perform data enhancement on the training data set after obtaining the training data set to obtain an enhanced time series data set. The enhanced time series data set is then input into the trained model, and the training loss is calculated by the trained model, thereby optimizing the model parameters of the trained model according to the training loss. The device can use a meta-learner network for data enhancement, and perform hierarchical comparative learning in multiple dimensions of global, instance, and time to comprehensively capture information at different semantic levels of the time series. By using a convolutional neural network to extract sequence features, train and establish a self-supervised hierarchical comparative model, the accuracy of the water quality index prediction results can be improved while having high stability.

[0160] The embodiment of the present application also provides an electronic device, which can be a personal computer, a server, a network device, etc. The electronic device includes a bus, a processor, a memory and a communication interface, and can also include an input and output interface and a display device. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the electronic device is used to store location information. The network interface of the electronic device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the steps in each method embodiment are implemented.

[0161] Those skilled in the art will understand that the structure of the above-mentioned electronic device is only a partial structure related to the scheme of the present application, and does not constitute a limitation on the electronic device to which the scheme of the present application is applied. The specific electronic device may include more or fewer components, or combine certain components, or have a different arrangement of components.

[0162] In one embodiment, a computer-readable storage medium is provided. The computer-readable storage medium may be non-volatile or volatile, and stores a computer program thereon. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0163] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0164] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0165] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0166] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0167] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A water quality index prediction model training method, characterized in that: The method comprises: Acquire a training data set, wherein the training data set includes a target data column and a time index column, wherein the target data column is used to record detection parameters of water quality indicators, and the time index column is used to record detection time of water quality indicators; Using a meta-learner network to perform data augmentation on the training dataset to obtain an augmented time series dataset, the augmented time series dataset comprising cropped sequence segments generated by randomly cropping adaptive augmented instance data, the adaptive augmented instance data being augmented instances generated by the meta-learner network based on the training dataset; Inputting the enhanced time series data set into a trained model, and calculating the training loss through the trained model, wherein the trained model is a self-supervised hierarchical contrast model; the trained model is used to perform hierarchical contrast on the enhanced time series data set in global, instance and time dimensions to generate hierarchical contrast loss, and extract sequence features using a convolutional neural network; The model parameters of the trained model are optimized according to the training loss.

2. The method according to claim 1, characterized in that The method further comprises: Extracting a target data column and a time index column from the training data set; Calculate the time index frequency corresponding to the time index column; According to the time index frequency, completing the missing time index columns in the training data set; Using the completed time index column as an index, detecting missing values ​​in the target data column; The missing values ​​are completed based on an interpolation completion algorithm, and the abnormal values ​​in the target data column are replaced with adjacent mean values, wherein the abnormal values ​​are parameter values ​​in the target data column after the missing values ​​are completed, and the difference between the values ​​and the mean values ​​of adjacent parameter values ​​is greater than a parameter fluctuation threshold.

3. The method according to claim 1, characterized in that The method further comprises: Set training command line parameters, including data file location, model hyperparameters, and iteration rounds; Running a parser according to the training command line parameters, and setting a prediction length, wherein the parser is used to read the training data set; the prediction length is used to set a prediction period for the output result; Using the parser, extract data features of a first dimension from the training data set and extract time features of a second dimension from the time index column to generate a feature set of a third dimension, wherein the third dimension is equal to the sum of the first dimension and the second dimension; The target data column and the feature set are divided into a training set, a validation set and a test set.

4. The method according to claim 1, characterized in that: Performing data augmentation on the training dataset using a meta-learner network includes: Calling a generative adversarial network, wherein the generative adversarial network includes a generator and a discriminator; Inputting the training data set into a generator so that the generator generates fake sample data according to the training data set; Inputting the training data set and the fake sample data into the discriminator to obtain a probability value output by the discriminator; Based on the probability value, calculating the adversarial training loss of the generator and the discriminator according to the minimization loss function; The network parameters of the generator and the discriminator corresponding to the multi-layer neural network are optimized according to the adversarial training loss.

5. The method according to claim 4, characterized in that The method further comprises: Invoking a meta-learner network for adaptively selecting a data augmentation strategy based on high-fidelity and / or high-diversity information-aware criteria; selecting a candidate transformation function, the candidate transformation function being associated with a weight for inferring a probability of selection of the candidate transformation function; For an original instance in the training data set, an enhanced instance is obtained by calculating the candidate transformation function, wherein the original instance is a single data point extracted from the training data set; and the enhanced instances are set to have the same length; By combining the enhanced instances corresponding to the candidate instance functions, an adaptive enhanced instance is obtained.

6. The method according to claim 1, characterized in that The method further comprises: Selecting a time tensor of the training data set; Obtaining a time step of the adaptive enhancement instance data; Generate a cutting length, wherein the cutting length is generated according to a set input length of the prediction model, or is generated by a random number; Calculate the shearing range according to the shearing length based on the randomly selected shearing starting position; The adaptive enhancement instance data is clipped according to the clipping range to obtain the clipping sequence segment.

7. The method according to claim 1, characterized in that The training loss is calculated by the trained model, including: Creating positive instance data based on the cropped sequence segments, the positive instance data including the cropped sequence segments obtained by cropping the same time series; A training loss is calculated for the positive instance data, wherein the training loss includes one or more combinations of a global contrast loss, an instance contrast loss, and a time contrast loss; the global contrast loss is obtained by performing a contrast calculation on feature identifiers of the entire data set or the entire time series data; the instance contrast loss is obtained by performing a contrast calculation on different cropped sequence segments of the same instance; the time contrast loss is obtained by performing a contrast calculation on feature representations of the same time series instance at different time steps; Optimizing the model parameters of the trained model according to the training loss includes: If the training loss is greater than a loss threshold, modifying a model parameter of the trained model according to the training loss; If the training loss is less than or equal to the loss threshold, the model parameters of the trained model are output to obtain a water quality index prediction model.

8. A water quality index prediction model training device, characterized in that: The device comprises: A data acquisition module, used to acquire a training data set, wherein the training data set includes a target data column and a time index column, wherein the target data column is used to record detection parameters of water quality indicators, and the time index column is used to record detection time of water quality indicators; a data enhancement module, configured to perform data enhancement on the training data set using a meta-learner network to obtain an enhanced time series data set, wherein the enhanced time series data set includes cropped sequence segments generated by randomly cropping adaptively enhanced instance data, wherein the adaptively enhanced instance data is an enhanced instance generated by the meta-learner network according to the training data set; A loss calculation module, used for inputting the enhanced time series data set into a trained model, and calculating the training loss through the trained model, wherein the trained model is a self-supervised hierarchical contrast model; the trained model is used for performing hierarchical contrast on the enhanced time series data set in global, instance and time dimensions to generate hierarchical contrast loss, and extracting sequence features using a convolutional neural network; A parameter optimization module is used to optimize the model parameters of the trained model according to the training loss.

9. An electronic device comprising a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.

10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Power equipment energy consumption optimization management method and system based on big data analysis

    CN119990828A

  • Evaporation process regulation and control instruction generation method, system, equipment and medium

    CN120909248A

  • Water quality monitoring method and device for secondary water supply system

    CN121258292A

  • A water quality monitoring method and device for a secondary water supply system

    CN121258292B