Domestic sewage yield prediction method and system based on machine learning
Through the convolution of two-way long and short-term conformal prediction model and time convolutional long and short-term network model, the problems of uncertainty and seasonal changes in water demand prediction in the existing technology are solved, and the accuracy and robustness of domestic sewage yield prediction are improved. , enhances the support of sewage treatment decisions.
Patent Information
- Application Number
- CN202411135730.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-19
- Publication Date
- 2024-12-17
AI Technical Summary
The existing domestic sewage yield prediction model is difficult to measure the uncertainty of water demand forecasting, and the prediction accuracy is insufficient in the face of seasonal and long-term trend changes, which affects the effectiveness of sewage treatment decisions.
The convolutional bidirectional long and short-term conformal prediction model is used to predict water demand, and the domestic sewage yield is predicted by combining the time convolutional long and short-term network model. The prediction interval is adaptively adjusted through quantile regression and conformal prediction technology to enhance the coverage of the prediction and reliability, and capture complex dependencies of time series.
It improves the accuracy and stability of water demand forecasting, enhances support for sewage treatment decisions, improves the accuracy and robustness of domestic sewage production forecasting, and improves the effect of sewage treatment.
Smart Images

Figure CN119151041A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of intelligent sewage management, and specifically refers to a method and system for predicting domestic sewage output based on machine learning. Background Art
[0002] Domestic sewage production forecast uses machine learning technology to analyze various sewage production-related factors to achieve accurate domestic sewage production forecasts, thereby assisting sewage management personnel to formulate reasonable sewage treatment plans, take measures in advance to deal with sewage peak periods, prevent sewage overflow, and improve sewage treatment efficiency, which helps promote urban sustainable development and environmental protection, and improve public health levels.
[0003] However, in the existing domestic sewage production forecasting process, there is a technical problem that domestic sewage production is mainly driven by water demand, while traditional models only provide point predictions when forecasting water demand, making it difficult for managers to measure the uncertainty of the forecast results, thus affecting the effectiveness of subsequent sewage treatment decisions; there is a technical problem that domestic sewage production has seasonal and long-term trend changes, which requires high time series modeling capabilities, and the model needs to maintain a high level of forecasting accuracy when facing sudden changes in water use. Summary of the invention
[0004] In view of the above situation, in order to overcome the defects of the prior art, the present invention provides a method and system for predicting domestic sewage production based on machine learning. In view of the technical problem that in the existing domestic sewage production prediction process, domestic sewage production is mainly driven by water demand, and the traditional model only provides point prediction when predicting water demand, and it is difficult for managers to measure the uncertainty of the prediction results, thereby affecting the effectiveness of subsequent sewage treatment decisions, this solution creatively adopts a convolutional bidirectional long-term and short-term conformal prediction model to predict water demand. Through quantile regression and conformal prediction technology, the prediction interval can be adaptively adjusted to ensure the coverage and reliability of the prediction interval, and the uncertainty of the prediction is quantified, thereby enhancing support for subsequent sewage treatment decisions, and through the convolutional network layer and the bidirectional long-term and short-term network layer, it is effective It captures the complex interactions between features and improves the accuracy and stability of predictions. In view of the technical problems in the existing domestic sewage output prediction process, such as the seasonal and long-term trend changes in domestic sewage output, the high requirements for time series modeling capabilities, and the need to maintain a high prediction accuracy when facing sudden changes in water use, this solution creatively uses a time convolutional long-term and short-term network model to predict domestic sewage output. By combining the time convolutional network with the long-term and short-term network, it can better capture the complex dependencies of the time series, improve the prediction capabilities of seasonal fluctuations and long-term trends, and enhance the robustness of the model to abnormal data. It can maintain a high prediction accuracy in the face of sudden water use, improve the overall reliability and practicality of the method, and help improve the effect of subsequent sewage treatment.
[0005] The technical solution adopted by the present invention is as follows: The method for predicting domestic sewage output based on machine learning provided by the present invention comprises the following steps: Step S1: data collection; Step S2: data preprocessing; Step S3: water demand prediction; Step S4: domestic sewage production prediction; Step S5: Comprehensive prediction of sewage output.
[0006] Furthermore, in step S1, the data collection is used to collect the original data required for the prediction of domestic sewage production, specifically, obtaining the original domestic sewage data by collecting population data, weather data, holiday data, historical water consumption data and historical sewage production data.
[0007] Furthermore, in step S2, the data preprocessing is used to improve the data quality, including the following steps: Step S21: data cleaning, specifically, cleaning the original domestic sewage data by filling missing values, filtering outliers and deleting duplicate values to obtain domestic sewage cleaning data; Step S22: data normalization, specifically, obtaining normalized domestic sewage data by normalizing the domestic sewage cleaning data; Step S23: data merging, specifically merging the population data, weather data, holiday data and historical sewage production data in the normalized domestic sewage data to obtain domestic sewage merged data, and merging the population data, weather data, holiday data and historical water consumption data in the normalized domestic sewage data to obtain water demand merged data.
[0008] Further, in step S3, the water demand prediction is specifically to predict the water demand based on the water demand merging data, using a convolutional bidirectional long-term and short-term shape-preserving prediction model to obtain water demand prediction information; The convolutional bidirectional long-term and short-term shape-preserving prediction model specifically includes a convolutional bidirectional long-term and short-term network layer, a quantile regression prediction head and a shape-preserving prediction layer; The convolutional bidirectional long short-term network layer is used to extract data features, including an input layer, a convolutional network layer, a flattening layer, a bidirectional long short-term network layer and a fully connected layer; The quantile regression prediction head is used to process the output results of the convolutional bidirectional long-term and short-term network layer and generate quantile prediction results; The conformal prediction layer is used to calibrate the prediction results of the quantile regression prediction head to ensure the probability that the prediction interval covers the true value; The water demand forecasting comprises the following steps: Step S31: constructing a convolutional bidirectional long-term short-term network layer, including the following steps: Step S311: constructing an input layer for receiving model input, specifically receiving water demand combined data as model input through the input layer; Step S312: Construct a convolutional network layer to capture local features in the model input and extract high-level features. Specifically, two one-dimensional convolutional layers are set in the convolutional network layer. The model input is calculated through the convolutional network layer to obtain high-dimensional convolutional features. The calculation formula is: ; In the formula, CLay one is a local feature, specifically the output of the first one-dimensional convolutional layer, Relu(·) is the Relu activation function, Conv1D(·) is a one-dimensional convolution operation, X is the model input, specifically the combined water demand data, W1 is the first convolution weight, b1 is the first convolution bias, CLay two It is a high-dimensional convolution feature, specifically the output of the second one-dimensional convolution layer, W2 is the second convolution weight, and b2 is the second convolution bias; Step S313: construct a flattening layer for flattening the output of the convolutional network layer. Specifically, the high-dimensional convolutional features are flattened by the flattening layer to convert the high-dimensional convolutional features into one-dimensional features to obtain one-dimensional flattened features. The calculation formula is: ; In the formula, Fea one It is a one-dimensional flattened feature, specifically the output of the flattening layer, and Flatten(·) is the flattening operation; Step S314: construct a bidirectional long-term short-term network layer to perform temporal processing on the flattened features and capture forward and backward dependencies therefrom. Specifically, the one-dimensional flattened features are processed by the bidirectional long-term short-term network layer to obtain bidirectional long-term short-term features. The calculation formula is: ; In the formula, Fea two is a bidirectional long-term and short-term feature, specifically refers to the output of the bidirectional long-term and short-term network layer, BiLSTM(·) is a bidirectional long-term and short-term network layer function, concat(·) is a feature concatenation function, is the forward long-term short-term network layer function, used to capture the forward dependency, It is the backward long-term and short-term network layer function, which is used to capture the backward dependency; Step S315: construct a fully connected layer to convert the output of the bidirectional long-term and short-term network layer into features suitable for quantile regression, specifically, the bidirectional long-term and short-term features are processed by the fully connected layer to obtain convolutional bidirectional features; Step S32: construct a quantile regression prediction head, specifically, calculate the convolution bidirectional features through the quantile regression prediction head to predict the water demand under different quantiles. The calculation formula is: ; Where p is the quantile, y p is the predicted value corresponding to quantile p, Q p (·) is the quantile regression function, Fea three It is a convolutional bidirectional feature; Step S33: constructing a shape-preserving prediction layer, specifically calibrating the prediction result of the quantile regression prediction head through the shape-preserving prediction layer to generate a final prediction result; Step S34: constructing a convolutional bidirectional long-term and short-term shape-preserving prediction model, specifically, constructing a convolutional bidirectional long-term and short-term shape-preserving prediction model by constructing a convolutional bidirectional long-term and short-term network layer, constructing a quantile regression prediction head, and constructing a shape-preserving prediction layer, thereby obtaining a convolutional bidirectional long-term and short-term shape-preserving prediction model; Step S35: constructing a water demand prediction model, specifically, obtaining a water demand prediction model by training a convolutional bidirectional long-term and short-term conformal prediction model; Step S36: Generate a water demand forecast result, specifically, perform water demand forecasting through a water demand forecasting model to obtain water demand forecasting information.
[0009] Further, in step S4, the domestic sewage production prediction is specifically to predict the domestic sewage production based on the water demand prediction information and the domestic sewage combined data, using the time convolution long-term and short-term network model to obtain the domestic sewage production prediction information; The temporal convolutional long-term and short-term network model includes a data input layer, a temporal convolutional network layer, a long-term and short-term network layer, and a dense prediction layer; The temporal convolutional network layer is used to capture features at different time scales; The long-short term network layer is used to capture long-term dependencies; The domestic sewage output prediction comprises the following steps: Step S41: designing a temporal convolutional long-term and short-term network model architecture, specifically setting a data input layer, a temporal convolutional network layer, a long-term and short-term network layer, a dense layer and an output layer in the temporal convolutional long-term and short-term network model; Step S42: constructing a temporal convolutional long-term and short-term network model, including the following steps: Step S421: constructing a data input layer for receiving input data, specifically receiving water demand forecast information and domestic sewage combined data as input data through the input layer; Step S422: constructing a temporal convolutional network layer, specifically, setting five dilated causal convolutional layers in the temporal convolutional network layer, with dilation rates of 2, 4, 8, 16 and 32 respectively, adding residual connections between each dilated causal convolutional layer, and setting a random dropout layer, a Relu activation layer and a weight normalization layer after each dilated causal convolutional layer, calculating the input data through the temporal convolutional network layer to obtain temporal convolution features; The calculation formula of the dilated causal convolutional layer is: ; Where t is the time step index, y t is the output of the dilated causal convolutional layer at time step t, k is the kernel size, i is the kernel index, and w i is the weight of the i-th convolution kernel, is the dilated causal convolution layer input at the td∙i-th time step, d is the dilation rate, and b is the dilated causal convolution bias term; Step S423: constructing a long-short term network layer, specifically setting a long-short term network sublayer and three hidden layers in the long-short term network layer, processing the temporal convolution features through the long-short term network layer to obtain long-short term features, and the calculation formula of the long-short term network sublayer is: ; In the formula, ig t is the output vector of the input gate at the tth time step, sig(·) is the S-type activation function, and W ig is the input gate weight, h t-1 is the hidden state at the t-1th time step, z t is the temporal convolution feature at the tth time step, b ig is the input gate bias term, fg t is the output vector of the forget gate at time step t, W fg is the forget gate weight, b fg is the forget gate bias term, og t is the output vector of the output gate at time step t, W og is the output gate weight, b og is the output gate bias term, h t is the hidden state at the tth time step, tanh(·) is the hyperbolic tangent function, c t It is a memory unit; Step S424: constructing a dense prediction layer for further extracting features and outputting prediction results, specifically, setting a dense layer and an output layer in the dense prediction layer, processing long-term and short-term features through the dense prediction layer, and generating prediction results; Step S43: constructing a domestic sewage production prediction model, specifically by training the time convolution long-term and short-term network model to obtain the domestic sewage production prediction model; Step S44: generating a domestic sewage production prediction result, specifically, predicting the domestic sewage production through a domestic sewage production prediction model to obtain domestic sewage production prediction information.
[0010] Furthermore, in step S5, the comprehensive sewage production forecast is used to generate a domestic sewage production forecast report, specifically, the comprehensive water demand forecast information and domestic sewage production forecast information are used to generate a domestic sewage production forecast report and provide sewage treatment suggestions.
[0011] The domestic sewage production prediction system based on machine learning provided by the present invention comprises: a data collection module, a data preprocessing module, a water demand prediction module, a domestic sewage production prediction module and a sewage production comprehensive prediction module; The data collection module is used for data collection, obtains the original data of domestic sewage through data collection, and sends the original data of domestic sewage to the data preprocessing module; The data preprocessing module is used for data preprocessing, and obtains domestic sewage combined data and water demand combined data through data preprocessing, and sends the water demand combined data to the water demand prediction module, and sends the domestic sewage combined data to the domestic sewage output prediction module; The water demand prediction module is used for water demand prediction, obtains water demand prediction information through water demand prediction, and sends the water demand prediction information to the domestic sewage production prediction module and the sewage production comprehensive prediction module; The domestic sewage production prediction module is used for domestic sewage production prediction, obtains domestic sewage production prediction information through domestic sewage production prediction, and sends the domestic sewage production prediction information to the sewage production comprehensive prediction module; The sewage production comprehensive prediction module comprehensively integrates water demand prediction information and domestic sewage production prediction information to generate a domestic sewage production prediction report and provide sewage treatment suggestions.
[0012] The beneficial effects achieved by the present invention using the above scheme are as follows: (1) In view of the technical problem that in the existing domestic sewage production prediction process, domestic sewage production is mainly driven by water demand, while the traditional model only provides point predictions when predicting water demand, and managers find it difficult to measure the uncertainty of the prediction results, thus affecting the effectiveness of subsequent sewage treatment decisions, this solution creatively adopts a convolutional bidirectional long-term and short-term shape-preserving prediction model to predict water demand. Through quantile regression and shape-preserving prediction technology, the prediction interval can be adaptively adjusted to ensure the coverage and reliability of the prediction interval, and the uncertainty of the prediction is quantified to enhance support for subsequent sewage treatment decisions. In addition, the complex interactions between features are effectively captured through the convolutional network layer and the bidirectional long-term and short-term network layer, which improves the accuracy and stability of the prediction. (2) In view of the technical problems in the existing domestic sewage production prediction process, there are seasonal and long-term trend changes in domestic sewage production, which requires high time series modeling capabilities, and the model needs to maintain a high prediction accuracy when facing sudden changes in water use. This solution creatively uses a time convolutional long-term and short-term network model to predict domestic sewage production. By combining the time convolutional network and the long-term and short-term network, it can better capture the complex dependencies of the time series, improve the prediction capabilities of seasonal fluctuations and long-term trends, and enhance the robustness of the model to abnormal data. It can maintain a high prediction accuracy in the face of sudden water use, improve the overall reliability and practicality of the method, and help improve the effect of subsequent sewage treatment. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1 A schematic diagram of the process of predicting domestic sewage output based on machine learning provided by the present invention; Figure 2 A schematic diagram of a domestic sewage production prediction system based on machine learning provided by the present invention; Figure 3 is a schematic flow chart of step S2; Figure 4 is a schematic flow chart of step S3; Figure 5 It is a schematic diagram of the process of step S4.
[0014] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention. DETAILED DESCRIPTION
[0015] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments; based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0016] In the description of the present invention, it should be understood that terms such as “upper”, “lower”, “front”, “back”, “left”, “right”, “top”, “bottom”, “inside” and “outside” indicating directions or positional relationships are based on the directions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore should not be understood as limiting the present invention.
[0017] Example 1, see Figure 1 The method for predicting domestic sewage output based on machine learning provided by the present invention comprises the following steps: Step S1: data collection; Step S2: data preprocessing; Step S3: water demand prediction; Step S4: domestic sewage production prediction; Step S5: Comprehensive prediction of sewage output.
[0018] Example 2, see Figure 1 This embodiment is based on the above embodiment. In step S1, the data collection is used to collect the original data required for the prediction of domestic sewage production, specifically by collecting population data, weather data, holiday data, historical water consumption data and historical sewage production data to obtain the original data of domestic sewage.
[0019] Example 3, see Figure 1 and Figure 3 This embodiment is based on the above embodiment. In step S2, the data preprocessing is used to improve the data quality, including the following steps: Step S21: data cleaning, specifically, cleaning the original domestic sewage data by filling missing values, filtering outliers and deleting duplicate values to obtain domestic sewage cleaning data; Step S22: data normalization, specifically, obtaining normalized domestic sewage data by normalizing the domestic sewage cleaning data; Step S23: data merging, specifically merging the population data, weather data, holiday data and historical sewage production data in the normalized domestic sewage data to obtain domestic sewage merged data, and merging the population data, weather data, holiday data and historical water consumption data in the normalized domestic sewage data to obtain water demand merged data.
[0020] Example 4, see Figure 1 and Figure 4 , this embodiment is based on the above embodiment. In step S3, the water demand prediction is specifically based on the water demand merge data, using the convolutional bidirectional long-term and short-term shape-preserving prediction model to predict the water demand, and obtain water demand prediction information; The convolutional bidirectional long-term and short-term shape-preserving prediction model specifically includes a convolutional bidirectional long-term and short-term network layer, a quantile regression prediction head and a shape-preserving prediction layer; The convolutional bidirectional long short-term network layer is used to extract data features, including an input layer, a convolutional network layer, a flattening layer, a bidirectional long short-term network layer and a fully connected layer; The quantile regression prediction head is used to process the output results of the convolutional bidirectional long-term and short-term network layer and generate quantile prediction results; The conformal prediction layer is used to calibrate the prediction results of the quantile regression prediction head to ensure the probability that the prediction interval covers the true value; The water demand forecasting comprises the following steps: Step S31: constructing a convolutional bidirectional long-term short-term network layer, including the following steps: Step S311: constructing an input layer for receiving model input, specifically receiving water demand combined data as model input through the input layer; Step S312: Construct a convolutional network layer to capture local features in the model input and extract high-level features. Specifically, two one-dimensional convolutional layers are set in the convolutional network layer. The model input is calculated through the convolutional network layer to obtain high-dimensional convolutional features. The calculation formula is: ; In the formula, CLay one is a local feature, specifically the output of the first one-dimensional convolutional layer, Relu(·) is the Relu activation function, Conv1D(·) is a one-dimensional convolution operation, X is the model input, specifically the combined water demand data, W1 is the first convolution weight, b1 is the first convolution bias, CLay two It is a high-dimensional convolution feature, specifically the output of the second one-dimensional convolution layer, W2 is the second convolution weight, and b2 is the second convolution bias; Step S313: construct a flattening layer for flattening the output of the convolutional network layer. Specifically, the high-dimensional convolutional features are flattened by the flattening layer to convert the high-dimensional convolutional features into one-dimensional features to obtain one-dimensional flattened features. The calculation formula is: ; In the formula, Fea one It is a one-dimensional flattened feature, specifically the output of the flattening layer, and Flatten(·) is the flattening operation; Step S314: construct a bidirectional long-term short-term network layer to perform temporal processing on the flattened features and capture forward and backward dependencies therefrom. Specifically, the one-dimensional flattened features are processed by the bidirectional long-term short-term network layer to obtain bidirectional long-term short-term features. The calculation formula is: ; In the formula, Fea two is a bidirectional long-term and short-term feature, specifically refers to the output of the bidirectional long-term and short-term network layer, BiLSTM(·) is a bidirectional long-term and short-term network layer function, concat(·) is a feature concatenation function, is the forward long-term short-term network layer function, used to capture the forward dependency, It is the backward long-term and short-term network layer function, which is used to capture the backward dependency; Step S315: construct a fully connected layer to convert the output of the bidirectional long-term and short-term network layer into features suitable for quantile regression, specifically, the bidirectional long-term and short-term features are processed by the fully connected layer to obtain convolutional bidirectional features; Step S32: construct a quantile regression prediction head, specifically, calculate the convolution bidirectional features through the quantile regression prediction head to predict the water demand under different quantiles. The calculation formula is: ; Where p is the quantile, y p is the predicted value corresponding to quantile p, Q p (·) is the quantile regression function, Fea three It is a convolutional bidirectional feature; Step S33: constructing a shape-preserving prediction layer, specifically calibrating the prediction result of the quantile regression prediction head through the shape-preserving prediction layer to generate a final prediction result; Step S34: constructing a convolutional bidirectional long-term and short-term shape-preserving prediction model, specifically, constructing a convolutional bidirectional long-term and short-term shape-preserving prediction model by constructing a convolutional bidirectional long-term and short-term network layer, constructing a quantile regression prediction head, and constructing a shape-preserving prediction layer, thereby obtaining a convolutional bidirectional long-term and short-term shape-preserving prediction model; Step S35: constructing a water demand prediction model, specifically, obtaining a water demand prediction model by training a convolutional bidirectional long-term and short-term conformal prediction model; Step S36: generating a water demand forecast result, specifically, performing water demand forecasting through a water demand forecasting model to obtain water demand forecasting information; By performing the above operations, in order to solve the technical problem that in the existing domestic sewage production prediction process, domestic sewage production is mainly driven by water demand, while the traditional model only provides point predictions when predicting water demand, and it is difficult for managers to measure the uncertainty of the prediction results, thus affecting the effectiveness of subsequent sewage treatment decisions, this solution creatively adopts a convolutional bidirectional long-term and short-term conformal prediction model to predict water demand. Through quantile regression and conformal prediction technology, it can adaptively adjust the prediction interval to ensure the coverage and reliability of the prediction interval, and quantify the uncertainty of the prediction, thereby enhancing support for subsequent sewage treatment decisions. The convolutional network layer and the bidirectional long-term and short-term network layer can effectively capture the complex interactions between features, thereby improving the accuracy and stability of the prediction.
[0021] Example 5, see Figure 1 and Figure 5 , this embodiment is based on the above embodiment. In step S4, the domestic sewage production prediction is specifically to predict the domestic sewage production based on the water demand prediction information and the domestic sewage combined data, using the time convolution long-term and short-term network model to obtain the domestic sewage production prediction information; The temporal convolutional long-term and short-term network model includes a data input layer, a temporal convolutional network layer, a long-term and short-term network layer, and a dense prediction layer; The temporal convolutional network layer is used to capture features at different time scales; The long-short term network layer is used to capture long-term dependencies; The domestic sewage output prediction comprises the following steps: Step S41: designing a temporal convolutional long-term and short-term network model architecture, specifically setting a data input layer, a temporal convolutional network layer, a long-term and short-term network layer, a dense layer and an output layer in the temporal convolutional long-term and short-term network model; Step S42: constructing a temporal convolutional long-term and short-term network model, including the following steps: Step S421: constructing a data input layer for receiving input data, specifically receiving water demand forecast information and domestic sewage combined data as input data through the input layer; Step S422: constructing a temporal convolutional network layer, specifically, setting five dilated causal convolutional layers in the temporal convolutional network layer, with dilation rates of 2, 4, 8, 16 and 32 respectively, adding residual connections between each dilated causal convolutional layer, and setting a random dropout layer, a Relu activation layer and a weight normalization layer after each dilated causal convolutional layer, calculating the input data through the temporal convolutional network layer to obtain temporal convolution features; The calculation formula of the dilated causal convolutional layer is: ; Where t is the time step index, y t is the output of the dilated causal convolutional layer at time step t, k is the kernel size, i is the kernel index, and w i is the weight of the i-th convolution kernel, is the dilated causal convolution layer input at the td∙i-th time step, d is the dilation rate, and b is the dilated causal convolution bias term; Step S423: constructing a long-short term network layer, specifically setting a long-short term network sublayer and three hidden layers in the long-short term network layer, processing the temporal convolution features through the long-short term network layer to obtain long-short term features, and the calculation formula of the long-short term network sublayer is: ; In the formula, ig t is the output vector of the input gate at the tth time step, sig(·) is the S-type activation function, and W ig is the input gate weight, h t-1 is the hidden state at the t-1th time step, z t is the temporal convolution feature at the tth time step, b ig is the input gate bias term, fg t is the output vector of the forget gate at time step t, W fg is the forget gate weight, b fg is the forget gate bias term, og t is the output vector of the output gate at time step t, W og is the output gate weight, b og is the output gate bias term, h t is the hidden state at the tth time step, tanh(·) is the hyperbolic tangent function, c t It is a memory unit; Step S424: constructing a dense prediction layer for further extracting features and outputting prediction results, specifically, setting a dense layer and an output layer in the dense prediction layer, processing long-term and short-term features through the dense prediction layer, and generating prediction results; Step S43: constructing a domestic sewage production prediction model, specifically by training the time convolution long-term and short-term network model to obtain the domestic sewage production prediction model; Step S44: generating a domestic sewage production prediction result, specifically, performing a domestic sewage production prediction through a domestic sewage production prediction model to obtain domestic sewage production prediction information; By performing the above operations, in order to solve the technical problems in the existing domestic sewage production prediction process, that is, the domestic sewage production has seasonal and long-term trend changes, the time series modeling capability is high, and the model needs to maintain a high prediction accuracy when facing sudden changes in water use, this solution creatively adopts the time convolution long-term and short-term network model to predict domestic sewage production. By combining the time convolution network and the long-term and short-term network, it can better capture the complex dependencies of the time series, improve the prediction ability of seasonal fluctuations and long-term trends, and enhance the robustness of the model to abnormal data. It can maintain a high prediction accuracy in the face of sudden water use, improve the overall reliability and practicality of the method, and help improve the effect of subsequent sewage treatment.
[0022] Example 6, see Figure 1 This embodiment is based on the above embodiment. In step S5, the comprehensive sewage production forecast is used to generate a domestic sewage production forecast report, specifically comprehensive water demand forecast information and domestic sewage production forecast information, generate a domestic sewage production forecast report, and provide sewage treatment suggestions.
[0023] Embodiment 7, see Figure 2 , this embodiment is based on the above embodiment, and the domestic sewage production prediction system based on machine learning provided by the present invention includes: a data collection module, a data preprocessing module, a water demand prediction module, a domestic sewage production prediction module and a sewage production comprehensive prediction module; The data collection module is used for data collection, obtains the original data of domestic sewage through data collection, and sends the original data of domestic sewage to the data preprocessing module; The data preprocessing module is used for data preprocessing, and obtains domestic sewage combined data and water demand combined data through data preprocessing, and sends the water demand combined data to the water demand prediction module, and sends the domestic sewage combined data to the domestic sewage output prediction module; The water demand prediction module is used for water demand prediction, obtains water demand prediction information through water demand prediction, and sends the water demand prediction information to the domestic sewage production prediction module and the sewage production comprehensive prediction module; The domestic sewage production prediction module is used for domestic sewage production prediction, obtains domestic sewage production prediction information through domestic sewage production prediction, and sends the domestic sewage production prediction information to the sewage production comprehensive prediction module; The sewage production comprehensive prediction module comprehensively integrates water demand prediction information and domestic sewage production prediction information to generate a domestic sewage production prediction report and provide sewage treatment suggestions.
[0024] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.
[0025] While the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that many changes, modifications, substitutions and variations can be made to the embodiments without departing from the principles and spirit of the invention.
[0026] The present invention and its embodiments are described above, and such description is not restrictive. The drawings show only one embodiment of the present invention, and the actual structure is not limited thereto. In short, if ordinary technicians in the field are inspired by it, without departing from the purpose of the invention, they can design a structure and embodiment similar to the technical solution without creativity, which should belong to the protection scope of the present invention.
Claims
1. A method for predicting domestic sewage production based on machine learning, characterized in that: The method comprises the following steps: Step S1: data collection; Step S2: data preprocessing; Step S3: water demand forecasting, specifically, based on the water demand merging data, using the convolutional bidirectional long-term and short-term shape-preserving forecasting model to forecast water demand, and obtaining water demand forecasting information; The convolutional bidirectional long-term and short-term shape-preserving prediction model specifically includes a convolutional bidirectional long-term and short-term network layer, a quantile regression prediction head and a shape-preserving prediction layer; The convolutional bidirectional long short-term network layer is used to extract data features, including an input layer, a convolutional network layer, a flattening layer, a bidirectional long short-term network layer and a fully connected layer; The quantile regression prediction head is used to process the output results of the convolutional bidirectional long-term and short-term network layer and generate quantile prediction results; The conformal prediction layer is used to calibrate the prediction results of the quantile regression prediction head to ensure the probability that the prediction interval covers the true value; Step S4: domestic sewage production prediction, specifically, based on the water demand prediction information and the domestic sewage combined data, a time convolution long-term and short-term network model is used to predict the domestic sewage production to obtain the domestic sewage production prediction information; The temporal convolutional long-term and short-term network model includes a data input layer, a temporal convolutional network layer, a long-term and short-term network layer, and a dense prediction layer; The temporal convolutional network layer is used to capture features at different time scales; The long-short term network layer is used to capture long-term dependencies; Step S5: Comprehensive prediction of sewage output.
2. The method for predicting domestic sewage output based on machine learning according to claim 1 is characterized in that: In step S3, the water demand forecasting includes the following steps: Step S31: constructing a convolutional bidirectional long-term short-term network layer, including the following steps: Step S311: constructing an input layer for receiving model input, specifically receiving water demand combined data as model input through the input layer; Step S312: Construct a convolutional network layer to capture local features in the model input and extract high-level features. Specifically, two one-dimensional convolutional layers are set in the convolutional network layer. The model input is calculated through the convolutional network layer to obtain high-dimensional convolutional features. The calculation formula is: ; In the formula, CLay one is a local feature, specifically the output of the first one-dimensional convolutional layer, Relu(·) is the Relu activation function, Conv1D(·) is a one-dimensional convolution operation, X is the model input, specifically the combined water demand data, W1 is the first convolution weight, b1 is the first convolution bias, CLay two It is a high-dimensional convolution feature, specifically the output of the second one-dimensional convolution layer, W2 is the second convolution weight, and b2 is the second convolution bias; Step S313: construct a flattening layer for flattening the output of the convolutional network layer. Specifically, the high-dimensional convolutional features are flattened by the flattening layer to convert the high-dimensional convolutional features into one-dimensional features to obtain one-dimensional flattened features. The calculation formula is: ; In the formula, Fea one It is a one-dimensional flattened feature, specifically the output of the flattening layer, and Flatten(·) is the flattening operation; Step S314: construct a bidirectional long-term short-term network layer to perform temporal processing on the flattened features and capture forward and backward dependencies therefrom. Specifically, the one-dimensional flattened features are processed by the bidirectional long-term short-term network layer to obtain bidirectional long-term short-term features. The calculation formula is: ; In the formula, Fea two is a bidirectional long-term and short-term feature, specifically refers to the output of the bidirectional long-term and short-term network layer, BiLSTM(·) is a bidirectional long-term and short-term network layer function, concat(·) is a feature concatenation function, is the forward long-term short-term network layer function, used to capture the forward dependency, It is the backward long-term and short-term network layer function, which is used to capture the backward dependency; Step S315: construct a fully connected layer to convert the output of the bidirectional long-term and short-term network layer into features suitable for quantile regression, specifically, the bidirectional long-term and short-term features are processed by the fully connected layer to obtain convolutional bidirectional features; Step S32: construct a quantile regression prediction head, specifically, calculate the convolution bidirectional features through the quantile regression prediction head to predict the water demand under different quantiles. The calculation formula is: ; Where p is the quantile, y p is the predicted value corresponding to quantile p, Q p (·) is the quantile regression function, Fea three It is a convolutional bidirectional feature; Step S33: constructing a shape-preserving prediction layer, specifically calibrating the prediction result of the quantile regression prediction head through the shape-preserving prediction layer to generate a final prediction result; Step S34: constructing a convolutional bidirectional long-term and short-term shape-preserving prediction model, specifically, constructing a convolutional bidirectional long-term and short-term shape-preserving prediction model by constructing a convolutional bidirectional long-term and short-term network layer, constructing a quantile regression prediction head, and constructing a shape-preserving prediction layer, thereby obtaining a convolutional bidirectional long-term and short-term shape-preserving prediction model; Step S35: constructing a water demand prediction model, specifically, obtaining a water demand prediction model by training a convolutional bidirectional long-term and short-term conformal prediction model; Step S36: Generate a water demand forecast result, specifically, perform water demand forecasting through a water demand forecasting model to obtain water demand forecasting information.
3. The method for predicting domestic sewage output based on machine learning according to claim 2 is characterized in that: In step S4, the domestic sewage production prediction includes the following steps: Step S41: designing a temporal convolutional long-term and short-term network model architecture, specifically setting a data input layer, a temporal convolutional network layer, a long-term and short-term network layer, a dense layer and an output layer in the temporal convolutional long-term and short-term network model; Step S42: constructing a temporal convolutional long-term and short-term network model, including the following steps: Step S421: constructing a data input layer for receiving input data, specifically receiving water demand forecast information and domestic sewage combined data as input data through the input layer; Step S422: constructing a temporal convolutional network layer, specifically, setting five dilated causal convolutional layers in the temporal convolutional network layer, with dilation rates of 2, 4, 8, 16 and 32 respectively, adding residual connections between each dilated causal convolutional layer, and setting a random dropout layer, a Relu activation layer and a weight normalization layer after each dilated causal convolutional layer, calculating the input data through the temporal convolutional network layer to obtain temporal convolution features; The calculation formula of the dilated causal convolutional layer is: ; Where t is the time step index, y t is the output of the dilated causal convolutional layer at time step t, k is the kernel size, i is the kernel index, and w i is the weight of the i-th convolution kernel, is the dilated causal convolution layer input at the td∙i-th time step, d is the dilation rate, and b is the dilated causal convolution bias term; Step S423: constructing a long-short term network layer, specifically setting a long-short term network sublayer and three hidden layers in the long-short term network layer, processing the temporal convolution features through the long-short term network layer to obtain long-short term features, and the calculation formula of the long-short term network sublayer is: ; In the formula, ig t is the output vector of the input gate at the tth time step, sig(·) is the S-type activation function, and W ig is the input gate weight, h t-1 is the hidden state at the t-1th time step, z t is the temporal convolution feature at the tth time step, b ig is the input gate bias term, fg t is the output vector of the forget gate at time step t, W fg is the forget gate weight, b fg is the forget gate bias term, og t is the output vector of the output gate at time step t, W og is the output gate weight, b og is the output gate bias term, h t is the hidden state at the tth time step, tanh(·) is the hyperbolic tangent function, c t It is a memory unit; Step S424: constructing a dense prediction layer for further extracting features and outputting prediction results, specifically, setting a dense layer and an output layer in the dense prediction layer, processing long-term and short-term features through the dense prediction layer, and generating prediction results; Step S43: constructing a domestic sewage production prediction model, specifically by training the time convolution long-term and short-term network model to obtain the domestic sewage production prediction model; Step S44: generating a domestic sewage production prediction result, specifically, predicting the domestic sewage production through a domestic sewage production prediction model to obtain domestic sewage production prediction information.
4. The method for predicting domestic sewage output based on machine learning according to claim 3 is characterized in that: In step S1, the data collection is used to collect the original data required for the prediction of domestic sewage production, specifically, by collecting population data, weather data, holiday data, historical water consumption data and historical sewage production data to obtain the original data of domestic sewage.
5. The method for predicting domestic sewage output based on machine learning according to claim 4 is characterized in that: In step S2, the data preprocessing is used to improve the data quality, including the following steps: Step S21: data cleaning, specifically, cleaning the original domestic sewage data by filling missing values, filtering outliers and deleting duplicate values to obtain domestic sewage cleaning data; Step S22: data normalization, specifically, obtaining normalized domestic sewage data by normalizing the domestic sewage cleaning data; Step S23: data merging, specifically merging the population data, weather data, holiday data and historical sewage production data in the normalized domestic sewage data to obtain domestic sewage merged data, and merging the population data, weather data, holiday data and historical water consumption data in the normalized domestic sewage data to obtain water demand merged data.
6. The method for predicting domestic sewage output based on machine learning according to claim 5 is characterized in that: In step S5, the comprehensive sewage production forecast is used to generate a domestic sewage production forecast report, specifically, the comprehensive water demand forecast information and domestic sewage production forecast information are used to generate a domestic sewage production forecast report and provide sewage treatment suggestions.
7. A domestic sewage production prediction system based on machine learning, used to implement the domestic sewage production prediction method based on machine learning as described in any one of claims 1 to 6, characterized in that: It includes a data collection module, a data preprocessing module, a water demand prediction module, a domestic sewage output prediction module and a sewage output comprehensive prediction module.
8. The domestic sewage production prediction system based on machine learning according to claim 7 is characterized by: The data collection module is used for data collection, obtains the original data of domestic sewage through data collection, and sends the original data of domestic sewage to the data preprocessing module; The data preprocessing module is used for data preprocessing, and obtains domestic sewage combined data and water demand combined data through data preprocessing, and sends the water demand combined data to the water demand prediction module, and sends the domestic sewage combined data to the domestic sewage output prediction module; The water demand prediction module is used for water demand prediction, obtains water demand prediction information through water demand prediction, and sends the water demand prediction information to the domestic sewage production prediction module and the sewage production comprehensive prediction module; The domestic sewage production prediction module is used for domestic sewage production prediction, obtains domestic sewage production prediction information through domestic sewage production prediction, and sends the domestic sewage production prediction information to the sewage production comprehensive prediction module; The sewage production comprehensive prediction module comprehensively integrates water demand prediction information and domestic sewage production prediction information to generate a domestic sewage production prediction report and provide sewage treatment suggestions.
