Crop water demand and rainfall collaborative prediction method and system based on multi-task learning

By employing a multi-task learning approach, combining multi-source data and genetic algorithm feature selection, an LSTM and attention mechanism model is constructed to collaboratively optimize crop water demand and precipitation prediction. This solves the problem of neglecting the collaborative relationship between tasks in traditional algorithms, and achieves accurate identification and optimization of crop water demand and precipitation.

CN121638595APending Publication Date: 2026-03-10ZHEJIANG YUGONG INFORMATION TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-02-05
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

Traditional algorithms only consider a single objective in predicting crop water requirements and precipitation, ignoring the synergistic relationship between tasks, resulting in suboptimal solutions and failing to simultaneously optimize water-saving rate and yield reduction rate.

Method used

A multi-task learning-based approach is adopted, utilizing multi-source historical monitoring data to construct an original feature pool. Feature selection is performed through a genetic algorithm, and a prediction model combining LSTM and attention mechanisms is used to collaboratively optimize crop water demand and precipitation predictions, generating discrete prediction labels.

Benefits of technology

It enables accurate identification of crop water requirements and precipitation, provides scientific basis, supports water resource allocation and precision irrigation in agricultural production, and improves the generalization ability and decision optimization effect of the prediction model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121638595A_ABST
    Figure CN121638595A_ABST
Patent Text Reader

Abstract

The invention discloses a crop water demand and rainfall collaborative prediction method and system based on multi-task learning, irrigation water demand and rainfall collaborative prediction of a short-term time window can be realized, two prediction models only need an initial feature pool, the feature pool comprises multi-source historical data influencing crop growth, feature coding is carried out on the multi-source historical data, and a prediction result is obtained. The embedded genetic algorithm performs adaptive selection on the input features to form independent feature subsets, after subtask training, results of double tasks of crop water demand prediction and rainfall prediction are output respectively, and finally crop water demand state labels are output through collaborative optimization. The crop water demand and rainfall collaborative prediction method and system with subtask interpretability are formed, crop water demand and rainfall prediction information is fused, accurate judgment of the crop water state in the future period is achieved, and a scientific basis is provided for water resource allocation and accurate irrigation in agricultural production.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of crop water demand and precipitation co-prediction technology, specifically to a method and system for crop water demand and precipitation co-prediction based on multi-task learning. Background Technology

[0002] In the field of agricultural water and soil engineering, the coordinated prediction of crop water requirements and precipitation is crucial for efficient water resource utilization and sustainable agricultural development. However, traditional algorithms are typically designed based on a single-objective optimization framework, considering only one of the multiple objectives—water saving rate and yield reduction rate—in multi-objective optimization. This design performs well in single-task scenarios, but when multiple tasks are parallelized, ignoring the synergistic relationship between tasks may lead to suboptimal solutions.

[0003] Therefore, it is necessary to develop a crop water demand-precipitation synergy system, and at the same time optimize the dual objectives of water saving rate and yield reduction rate for intelligent prediction, so as to provide a new path to solve this problem. Summary of the Invention

[0004] This invention provides a method and system for the coordinated prediction of crop water demand and precipitation based on multi-task learning. By utilizing multi-source historical monitoring data and integrating crop water demand and precipitation prediction information, it can accurately determine the crop water status in future periods, providing a scientific basis for water resource allocation and precision irrigation in agricultural production.

[0005] This invention provides the following technical solution: a method for collaborative prediction of crop water demand and precipitation based on multi-task learning, comprising: S1, collecting multi-source historical data affecting crop growth and constructing an original feature pool; S2, based on two objectives, water demand and precipitation, using a genetic algorithm to independently select features from the original feature pool, generating a subset of crop water demand prediction features and a subset of precipitation prediction features; S3, pre-constructing a crop water demand prediction sub-model based on LSTM and attention mechanism for crop water demand prediction, the construction process including: S3.1, improving the LSTM network model using an attention mechanism; S3.2, training the model using the subset of crop water demand prediction features, comparing the error between the predicted output value and the actual value during training. S3.3. Based on the error value, use stochastic gradient descent to update the weights and biases of each layer of neurons, adjusting the magnitude of each adjustment according to the learning rate; S3.4. Repeat S3.1-S3.3 until the preset conditions are met, and the number of iterations makes the gradient descent approach 0; S4. Construct a multi-scale LSTM precipitation prediction sub-model for precipitation prediction, and use KernelExplainer to test the LSTM precipitation prediction sub-model during training; S5. Co-optimize the prediction results of the crop water demand prediction sub-model and the LSTM precipitation prediction sub-model to generate the final discrete prediction labels, including two states: needing irrigation and not needing irrigation.

[0006] As an optional scheme of the crop water demand and precipitation collaborative prediction method based on multi-task learning described in this invention, the multi-source historical data affecting crop growth includes meteorological data, hydrological data, crop growth data, and soil attribute data. After cleaning the multi-source historical data, binary classification labels are transformed, and finally merged to obtain the original feature pool. Feature selection includes: S2.1, filtering redundant features: calculating and sorting the Pearson correlation coefficient between any feature and its corresponding binary classification label, and finding and deleting redundant features using a Markov blanket; S2.2, feature grouping: dividing the original feature pool into several similar feature groups, with the grouping principle being to group related features and their redundant feature sets into the same group; S2.3, initializing the population: determining the chromosome encoding method, determining the population size, and randomly generating chromosomes; S2.4, calculating the fitness of chromosomes in the population; S2.5, using a roulette wheel selection operator to calculate the probability of a chromosome being selected; S2.6, using a simulated binary crossover operator to perform crossover operations; S2.7, using a Cauchy mutation operator to perform mutation operations to complete feature selection.

[0007] As an optional scheme of the crop water demand and precipitation co-prediction method based on multi-task learning described in this invention, the LSTM precipitation prediction sub-model includes convolutional layers, a long short-term memory network, and a fully connected layer. During training, the SHAP values ​​of meteorological element parameters and time step parameters on the prediction results are obtained. Finally, the meteorological element parameters and time step parameters of the model are dynamically adjusted in each rolling forecast by cluster analysis of the SHAP values. The long short-term memory network includes three forward layers and three backward layers, receiving the same input three-dimensional tensor, and is trained and predicted separately for forward and backward time series. The number of neurons and the dropout rate of neurons in each of the three layers increase progressively. The output sequence is that the first two layers return all hidden states for all time steps, and the last layer returns a single hidden state. The fully connected layer merges the outputs of the forward and backward long short-term memory networks. The fully connected layer is a three-layer network with the number of neurons and the dropout rate increasing progressively, and the final layer mapped to precipitation output has only 1 neuron.

[0008] As an optional scheme of the crop water demand and precipitation synergistic prediction method based on multi-task learning described in this invention, the following steps are included: Testing the LSTM precipitation prediction sub-model using KernelExplainer: S4.1 Selecting a baseline value: Selecting a baseline value for the LSTM precipitation prediction sub-model as a reference point for calculating the SHAP value; S4.2 Calculating conditional expectation: For any feature, calculating the difference between the average value of the model output and the baseline value when the feature is included, reflecting the contribution of the feature to the model output; S4.4 Kernel estimation: Smoothing and estimating the eigenvalue function using the kernel method; S4.3 Calculating the SHAP value: For any feature and any sample in the test set, calculating its SHAP value to obtain the contribution of the feature value to the model output. SHAP value analysis is performed using a clustering method based on data point path features to generate optimized meteorological element parameters and time step parameters. Generating the final discrete prediction label includes: calculating the comprehensive water state score and converting the comprehensive water state score into discrete prediction labels, wherein the comprehensive water state score calculation method includes: , where P irrigate The overall moisture status score; y t p represents the crop water requirement prediction result of the crop water requirement prediction sub-model; p represents the precipitation prediction result of the LSTM precipitation prediction sub-model; α represents the water requirement severity weight, which is determined by the crop water requirement type; β represents the precipitation suppression weight, which is determined by the soil type; γ represents the baseline irrigation threshold, which is used to adjust the bias of the overall irrigation decision and is set based on irrigation demand; σ is the mapping function, which maps the output value to between 0 and 1.

[0009] A system applying any of the above-mentioned multi-task learning-based methods for co-predicting crop water demand and precipitation includes:

[0010] Data acquisition module: Collects multi-source historical data that affects crop growth and constructs an original feature pool;

[0011] Feature selection module: Based on two objectives, water demand and precipitation, a genetic algorithm is used to independently select features from the original feature pool to generate feature selection subsets for crop water demand prediction and precipitation prediction.

[0012] Crop water requirement prediction submodule: This submodule uses LSTM and attention mechanisms to predict crop water requirements. The construction process includes:

[0013] S3.1 Improve the LSTM network model using attention mechanism;

[0014] S3.2. Select a subset of crop water requirement prediction features to train the model. During training, compare the error value with the actual value for each prediction to obtain the error value, and then pass the error value to all neurons.

[0015] S3.3 Update the weights and biases of neurons in each layer based on the error values;

[0016] S3.4 Repeat S3.1-S3.3 until the preset conditions are met;

[0017] LSTM precipitation prediction submodule: Precipitation prediction is performed based on a multi-scale LSTM precipitation prediction submodel. During training, KernelExplainer is used to test the LSTM precipitation prediction submodel.

[0018] Results prediction module: Collaboratively optimizes the prediction results of the crop water demand prediction sub-model and the LSTM precipitation prediction sub-model to generate the final discrete prediction labels, including two states: those requiring irrigation and those not requiring irrigation.

[0019] The present invention has the following beneficial effects:

[0020] 1. This multi-task learning-based collaborative prediction method for crop water demand and precipitation utilizes multi-source historical monitoring data and integrates crop water demand and precipitation prediction information to accurately determine the crop water status in future periods. This provides a scientific basis for water resource allocation and precision irrigation in agricultural production. By introducing a dual-channel feature selection mechanism, the two sub-models for crop water demand and precipitation prediction share the original feature pool but output independent feature subsets. Compared with traditional single-channel or manual feature selection, the dual-channel feature selection mechanism based on genetic algorithms can automatically discover key influencing factors hidden in complex spatiotemporal data, improve the generalization ability of the prediction model, and further optimize the model decision through a collaborative mechanism, ultimately outputting a binary classification of crop water status labels.

[0021] 2. This multi-task learning-based collaborative prediction system for crop water demand and precipitation has time-series sub-task models for short-term irrigation water demand prediction and precipitation prediction. It integrates a multi-task deep learning framework for task fusion, sharing the same original feature pool at the front end of both sub-task models. The feature pool includes various water demand and precipitation-related influencing factors such as soil moisture tension, precipitation probability, and evapotranspiration, which are then feature-encoded. A genetic algorithm is embedded to adaptively select input features in conjunction with the sub-model tasks, forming independent feature subsets. After sub-task training, the system outputs the results of both crop water demand prediction and precipitation prediction. Finally, a shared layer collaboratively outputs crop water demand status labels, thus constructing a multi-task learning system for water demand-precipitation collaborative prediction with sub-task interpretability. Furthermore, a collaborative optimization module fuses the two prediction results, ultimately outputting discretized crop water demand status labels, including two types: requiring irrigation and not requiring irrigation.

[0022] 3. This multi-task learning-based crop water demand and precipitation co-prediction system provides a reliable crop water demand prediction model by combining the powerful representation capabilities of deep learning and the superior prediction capabilities of LSTM neural networks for time series models, and using an attention mechanism to improve the attention ratio of intermediate results obtained from the hidden layers of LSTM.

[0023] 3. The crop water demand and precipitation co-prediction system based on multi-task learning uses the KernelExplainer algorithm to perform global interpretability analysis on the deep learning model constructed by the CNN-LSTM-FC composite architecture, and realizes quantitative contribution assessment of meteorological element parameter set and time step parameter. Attached Figure Description

[0024] Figure 1 This is a schematic diagram of the steps in Embodiment 1 of the present invention.

[0025] Figure 2 This is a schematic diagram of the feature selection steps in Embodiment 1 of the present invention.

[0026] Figure 3 This is a diagram of the LSTM neural network structure in Embodiment 1 of the present invention.

[0027] Figure 4 This is a model architecture diagram of the crop water requirement prediction sub-model in Embodiment 1 of the present invention.

[0028] Figure 5 This is a model architecture diagram of the LSTM precipitation prediction sub-model in Embodiment 1 of the present invention. Detailed Implementation

[0029] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0030] Example 1

[0031] Please see Figures 1-5 One method for co-predicting crop water demand and precipitation based on multi-task learning includes:

[0032] S1. Collect multi-source historical data affecting crop growth and construct an original feature pool. Specifically:

[0033] Data sources for multi-source historical data include, but are not limited to, databases, sensors, and file systems. During data acquisition, the module collects multi-source observation data in a targeted manner according to the needs of different fields. In terms of meteorological data acquisition, it obtains temperature data such as daily average temperature, maximum temperature, and minimum temperature through meteorological sensors and interfaces with meteorological databases. Temperature affects crop physiological processes and soil microbial activity. It also collects relative humidity and soil moisture data; the former relates to crop transpiration, and the latter determines water absorption and growth of crop roots. It records precipitation, precipitation intensity, and frequency, as precipitation affects water resource distribution and agricultural production. It acquires data on sunshine duration and light intensity, as sunlight is the energy source for crop photosynthesis, and different crops have different requirements. Finally, it collects wind speed and wind direction data; wind speed affects crop transpiration and gas exchange, while wind direction is related to the propagation and diffusion of meteorological elements, affecting precipitation distribution and the agricultural ecological environment.

[0034] In hydrological data collection, data is collected by connecting with the data system of the water conservancy department and by installing water level and flow monitoring equipment in water bodies to obtain water level change data of rivers, lakes, reservoirs and other water bodies. The level of water directly affects the availability of irrigation water sources and is closely related to farmland irrigation. At the same time, water level changes may also indicate the risk of floods. The flow data of rivers, canals and other water bodies are recorded. The flow rate determines the water supply capacity of the irrigation system and reflects the hydrological processes such as precipitation and evaporation in the basin. This is of great significance for the rational management and allocation of water resources.

[0035] For crop growth data, the types of crops planted are identified through methods such as connecting with agricultural planting management systems and manual on-site observation and recording. Different crops have unique growth characteristics, water and fertilizer requirements, and adaptability to environmental conditions. Understanding crop types helps to formulate targeted planting management measures. The various growth stages of crops from sowing to harvest are accurately recorded, such as seedling stage, tillering stage, jointing stage, heading stage, and grain filling stage. Crops have different water requirements at different growth stages.

[0036] In terms of soil property data collection, soil texture type is determined by the proportion of sand, silt, and clay particles in the soil through soil sampling analysis and connection with soil monitoring equipment. Soil texture affects the physical properties of soil such as aeration, permeability, and water retention, which in turn affects the growth of crop roots. Soil bulk density and porosity are calculated. Soil bulk density reflects the compactness of the soil, and porosity represents the proportion of the volume of pores in the soil to the total volume of the soil. Both affect the aeration, permeability, and root growth of the soil. Suitable soil bulk density and porosity can provide a good growth environment for crop roots.

[0037] After the initial data collection is completed, the collected raw data undergoes simple processing immediately. In the data cleaning stage, by setting reasonable threshold ranges and using statistical model-based methods, noisy data is accurately identified and removed. For example, outliers caused by sensor malfunctions or data transmission errors are removed to prevent these noisy data from interfering with subsequent analysis results, ensuring the accuracy and reliability of the data. Regarding missing value imputation, various scientifically sound imputation methods are employed based on the characteristics of the data and the actual situation. For numerical data, the mean or median of the non-missing values ​​in the dataset is calculated and used to impute missing values.

[0038] Convert multi-source historical data into binary labels; for example, convert raw precipitation data X... rain Convert to binary label Y binary : Where δ is the precipitation threshold, δ=0.1mm, to avoid misjudging minute precipitation. All features are merged into a unified original feature pool, denoted as: Where n represents the total number of all preprocessed features.

[0039] S2. Based on the two objectives of water demand and precipitation, a genetic algorithm is used to independently select features from the original feature pool, generating feature selection subsets for crop water demand prediction and precipitation prediction. Specifically:

[0040] It should be noted that the dual-channel feature selection employs a Markov blanket feature selection method based on an adaptive genetic algorithm. Most research on feature selection methods based on genetic algorithms first improves the genetic algorithm, then directly solves the feature selection problem using the improved genetic algorithm in a binary encoding manner, neglecting research on how the genetic algorithm is applied to feature selection. If an improved genetic algorithm is used to calculate the weights of each feature in the WKNN classification problem, and then feature selection is achieved based on the ranking of feature weights, this method simply selects features by ranking them, ignoring the interactions between features. To address this problem, this invention proposes a Markov blanket feature selection method based on an adaptive genetic algorithm. The basic idea is to deeply integrate the genetic algorithm with feature selection methods, using the genetic algorithm to improve traditional feature selection methods. This invention focuses on the Markov blanket method, using an approximate Markov blanket to divide the original feature pool into multiple similar feature groups, and then treating the process of selecting at most one feature from each feature group as an optimization problem. The traditional Markov blanket method for solving this optimization problem can be viewed as using a forward search strategy to select the feature with the highest relevance to the label class from each group. However, this forward search method ignores the interaction between different features in different feature groups, making the algorithm prone to getting trapped in local optima. Therefore, the traditional Markov blanket method is improved by using an improved adaptive genetic algorithm to solve this optimization problem. Compared with the traditional Markov blanket method, the selected feature subset is closer to the global optimum.

[0041] Based on the two objectives of water demand and precipitation, independent feature selection includes a crop water demand feature selection submodule and a precipitation prediction feature selection submodule. The crop water demand feature selection submodule is replaced by QEA1, and the precipitation prediction feature selection submodule is replaced by QEA2. The two submodules have similar structures but run independently, each outputting its own subset of features: QEA1 outputs the crop water demand prediction feature selection subset F. ∗ crop QEA2 output precipitation prediction feature selection subset F ∗ rain The specific steps for feature selection are as follows:

[0042] S2.1 Filtering Redundant Features: Based on symmetric uncertainty, features are sorted, and some irrelevant features with low relevance to the label class are removed. This is done by calculating f for each feature. i The Pearson correlation coefficient with label C is used, and the features are sorted in descending order according to the Pearson correlation coefficient, selecting the top k features. Then, a Markov blanket is used to find redundant features in the original feature pool and remove these redundant features. The mathematical expression for the Markov blanket is shown in the following formula: , where f i It is a subset of the original feature pool F, ⊥ denotes independence, |Si Indicated by S i As a condition, S i It is a subset of F, C is the label, therefore the feature set S i It is feature f i The conditions for a Markov blanket can be described as follows: given a feature set S i Feature f i Independent of feature set F−S i −{f i} and label C, that is, if the selected feature set is S i Then S i Feature f has already been included i For all information about label C, then feature f i Features that are no longer valuable in feature selection can be removed. Although Markov blankets play a significant role in removing redundant features, they are difficult to solve in practical problems. Therefore, an approximate Markov blanket is generally used to define redundant features.

[0043] Assume feature f i and feature f j If two features of F belong to F and are not the same feature, then feature f i It is feature f j The conditions for the approximate Markov blanket can be defined by the following formula: Here, SU represents the symmetric uncertainty, and the symmetric uncertainty SU(X,Y) of two random variables X and Y is defined by the following formula: Where H(X) is the Shannon entropy of the random variable X, representing the uncertainty of the variable X, and is defined as follows: .

[0044] S2.2 Feature Grouping: The original feature pool is divided into multiple similar feature groups using an approximate Markov blanket. The grouping principle is to group related features and their redundant feature sets into the same group. The specific steps of feature grouping are described below.

[0045] F contains n features, for each f i ∈F(1≤i≤n), calculate f i Symmetric uncertainty SU(f) with label C i ;C), then set a threshold δ to remove SU(f) i C) Features f less than the threshold δ i For the remaining features, follow SU(f) i C) Sort the features in descending order, denote the sorted feature set as M, and renumber the features in M. Repeat the following steps until M is an empty set.

[0046] Select the first feature f0 in M ​​as the search starting point and put it into feature group G. i In M, remove the feature from M, and calculate the relationship between feature f0 and each feature f in M. i Symmetric uncertainty SU(f) i ;f0), if SU(f i (f0) is greater than f i Symmetric uncertainty SU(f) with label C i If C), then the feature is removed from M and added to group G. i In the middle, the remaining feature sets of M are renumbered.

[0047] When M is empty, the grouping algorithm ends, and the feature grouping set is obtained. This is the result of grouping, where each group G i Includes a related feature f i And the set of redundant features of this feature.

[0048] S2.3 Initialize the population: This includes three steps: determining the chromosome encoding method, determining the population size, and randomly generating chromosomes. These three steps will be described in detail below.

[0049] First, the chromosome encoding method is determined. This invention uses grouped real-number encoding, with the encoding length consistent with the grouping of features. Each gene locus represents a group selection. Because grouping features using an approximate Markov chain, based on the constraint that at most one feature can be selected within a group, this is represented in binary encoding as follows: B j This represents the j-th bit of the binary encoding. This encoding method, under the influence of subsequent crossover and mutation operators, is prone to breaking the aforementioned grouping restrictions, generating chromosomes that do not meet the requirements, which is detrimental to the iterative operation of the genetic algorithm.

[0050] Assuming this group Then the gene locus B j The value range is [0, t]. The formula relating the gene locus value and the selected feature is shown below: Then determine the population size. The population size generally needs to be determined based on the problem complexity and computational resource constraints. The initial population size is the median of a preset population size range.

[0051] Then, chromosomes are randomly generated. For each chromosome in the population, an initial solution is randomly generated according to a determined encoding method, thus initializing a population containing random chromosomes and providing a starting point for subsequent genetic algorithms.

[0052] S2.4 Next, calculate the fitness of chromosomes in the population. The fitness function is shown below: Where acc is the classification accuracy of the feature subset decoded based on the selected chromosome x, num is the dimension of the feature subset, k is the number of feature groups, a is the fitness transformation coefficient (the larger a is, the greater the probability of selecting a superior chromosome), and β is the weighting coefficient that balances classification accuracy and feature subset dimension.

[0053] The fitness function of this invention uses a fitness value of higher as its criterion, indicating a superior chromosome. As can be seen from the fitness function formula, chromosomes with higher fitness values ​​should decode feature subsets with higher classification accuracy and lower feature dimensionality.

[0054] S2.5. The probability of a chromosome being selected is calculated using a roulette wheel selection operator. This invention employs a roulette wheel selection operator. The probability of selecting a chromosome can be calculated using the following formula: Among them, P x Let x represent the probability of chromosome x being selected, and M be the set of all chromosomes in the population. It is easy to see from this formula that chromosomes with higher fitness have a greater probability of being selected.

[0055] S2.6 This invention uses a simulated binary crossover operator to perform the crossover operation. The simulated binary crossover operator is a crossover operator specifically designed for real number encoding. Its basic idea is to simulate the single-point crossover operator in binary encoding, ensuring that the average value of the real values ​​before and after crossover is equal. First, two chromosomes X are randomly selected from the parent generation. i and X j Each chromosome has t gene loci, denoted as ti, tj, ... and The binary crossover operator is used to perform crossover operations on both chromosomes, resulting in two sub-chromosomes. and It can be calculated using the following formula: Where k∈[1,t] represents the k-th gene locus on the chromosome, and β is the expansion factor, a non-negative random parameter used to control the distance between offspring and parents. When β is 1, the distance between the two child chromosomes x i ' and x j ' They are respectively equal to the father's X chromosome i ' and X j ' The distance between offspring is a copy of the parent generation; when β < 1, the distance between offspring is less than the distance between parents; when β > 1, the distance between offspring is greater than the distance between parents.

[0056] Therefore, the gene locus x of the daughter chromosome was calculated. i k' and x jk' Since the value may exceed the range [0, t] of the gene locus, a modulo operation is also required. The updated calculation is shown in the following formula: β can be calculated using the following formula: μ is a number randomly generated from a uniform distribution U(0,1). η is the distribution exponent, which controls the strength or diversity of crossovers; the larger η is, the closer the offspring are to the parent; the smaller η is, the more likely the offspring are to move away from the parent, indicating a stronger exploratory nature.

[0057] S2.7 This invention uses the Cauchy mutation operator for mutation operations. Cauchy mutation is a mutation method designed for real number encoding. Its basic idea is to randomly generate a mutation amount based on the Cauchy distribution on the parent chromosome, and then add the generated mutation amount to the parent chromosome to obtain the child chromosome. The form of Cauchy mutation is shown in the following formula: Where C(0,σ) is a one-dimensional Cauchy random variable centered at 0 with a scale parameter of σ, and its density function is shown in the following formula: However, the Cauchy distribution tends to generate random numbers far from the center, and Cauchy mutation based on the Cauchy distribution tends to generate child chromosomes that deviate more from the parent chromosome, increasing the diversity of the algorithm and thus helping to avoid the genetic algorithm from getting stuck in local optima.

[0058] Obviously, similar to the crossover operator, the gene loci after Cauchy mutation may also exceed the value range [0,t], so a modulo operation is also required. The updated calculation is shown in the following formula: After feature selection, QEA1 outputs the crop water requirement prediction feature selection subset F. ∗ crop QEA2 output precipitation prediction feature selection subset F ∗ rain .

[0059] S3. Pre-build a crop water requirement prediction sub-model based on LSTM and attention mechanism for crop water requirement prediction. The construction process includes:

[0060] S3.1 Improving the LSTM Network Model Using an Attention Mechanism: Leveraging a deep learning framework, an attention mechanism is used to improve the LSTM model, denoted as Attention-LSTM. This attention mechanism is used to optimize the attention ratio in the intermediate results obtained from the hidden layers of the LSTM. Then, the parameters in the Attention-LSTM network model are randomly initialized, and the parameters are learned and adjusted through training samples, i.e., x... i y i The parameters in the Attention-LSTM network are learned by using them as input and output, respectively.

[0061] Specifically, the parameters W0 in the Attention-LSTM network model are randomly initialized, and the parameters in the Attention-LSTM network model are learned and adjusted through training samples to obtain the weight parameters in the training process. That is, (xi, yi) are used as the input and output of the Attention-LSTM network to learn the final parameters w of the network. This process can be represented as follows. Where Attention-LSTM(x, w) is a generalized representation of the urban water demand prediction model based on Attention and LSTM, x represents the model input, and w represents all the model weights; L(Ypredict, Ylabel) represents a generalized representation of the supervision function of the LSTM-Attention model, and is actually written as follows:

[0062] .

[0063] S3.2 The model is trained using a subset of crop water requirement prediction features. During training, the error value is obtained by comparing the predicted output value with the actual value each time, and the error value is transmitted to all neurons. The model is trained using the feature subset selected from the feature selection, and each time x... i As input to the model, a prediction result is obtained. The output value of the Attention-enhanced LSTM network is compared with the actual value to calculate the error, and the error is propagated to all neurons using the backpropagation algorithm.

[0064] S3.3 Update the weights and biases of neurons in each layer based on the error value: Based on the error value, use stochastic gradient descent to update the weights and biases of neurons in each layer, with the adjustment range determined by the learning rate each time.

[0065] S3.4 Repeat S3.1-S3.3 until the preset condition is met: set the number of iterations to a sufficient gradient descent of 0.

[0066] S4. Construct a multi-scale LSTM precipitation prediction sub-model for precipitation prediction, and use KernelExplainer to test the LSTM precipitation prediction sub-model during training.

[0067] S5. Using the trained model, predict the weekly water demand of a crop in a certain region during a certain week. Co-optimize the prediction results of the crop water demand prediction sub-model and the LSTM precipitation prediction sub-model to generate the final discrete prediction labels, including two states: those requiring irrigation and those not requiring irrigation.

[0068] The initialization parameters for the LSTM network include: the number of input neurons (L), the number of hidden layer neurons (H), the number of output neurons (O), the LSTM network learning rate (α), the training epochs, and the batch size (batch_size). The input vector x is used... i By training an LSTM network, the output value of a neuron at time t can be obtained as h. t The formula is: In the formula o t It is the output value of the output gate inside the hidden layer neuron at time t: , where w ox The weights between the output gate and the input layer; w oh The output gate is connected to the output h of the previous hidden layer neuron. t−1 The weights between them; b0 is the bias between the output gate and the input layer; c t It refers to the state of the long and short-term memory cells of the hidden layer neurons at time t. In the formula , where w cx These are the weights between the internal state units of the hidden layer neurons and the input layer; w ch This refers to the state unit and the output h of the previous hidden layer neuron. t−1 The weights between them; b c The bias between the state unit and the input layer; i t It is the output value of the input gate inside the hidden layer neuron at time t: , where w ix The weights between the input gate and the input layer; w ih The input gate and the output h of the previous hidden layer neuron t−1 The weights between them; b i The bias between the input gate and the input layer; f t It is the output value of the forget gate inside the hidden layer neuron at time t: , where w fx To forget the weights between the input layer and the input layer; w fh To forget the gate and the output h of the previous hidden layer neuron t−1 The weights between them; b f To avoid the bias between the forget gate and the input layer; c t−1 Let be the state value of the short-term and long-term memory cloud of the previous hidden layer neuron at time t-1; σ(·) is the sigmoid activation function; tanh(·) is the activation function.

[0069] Therefore, the output vector h of the lowest hidden layer of the LSTM model is obtained. tAs the input vector to the Attention module, let the hidden layer weights of the current Attention layer be w. t The bias is b, and the output vector h of the LSTM model at time t is... t The output value is calculated. The sigmoid activation function outputs the value y. t ∈(0,1) is used to represent the probability that the crop is in a water-deficient state at time t. When y t When y > 0.5, the crop is considered to be in a state of water shortage; when y t When the value is ≤0.5, the crop is determined to be in a non-water-deficient state, and the prediction of the data is completed.

[0070] A precipitation prediction model module based on multi-scale LSTM was constructed. KernelExplainer was used to estimate the deep learning neural network model constructed by convolutional layers, long short-term memory network, and fully connected layers. The contribution values ​​(SHAP) of meteorological element parameters m and time step parameters tl to the prediction results were obtained. Finally, the m and tl parameters of the model were dynamically adjusted in each rolling forecast by cluster analysis of the SHAP values, thereby improving the precipitation prediction effect.

[0071] The number of neurons in the convolutional layer is the same as that in the first layer of the Long Short-Term Memory (LSTM) network. The kernel size is a function of the time step, kernel_size = ceil(timesteps / 2), and the maximum value of the kernel is 4. The LSM network is divided into forward and backward types, which receive the same input three-dimensional tensor [samples, timesteps, feature] and are trained and predicted separately for forward and backward time series. Each of them is further subdivided into three layers, with the number of neurons and the dropout rate of neurons increasing layer by layer. The output sequence is that the first two layers return all hidden states for all time steps, and the last layer returns a single hidden state. The fully connected layer first merges the outputs of the forward and backward LSM networks, and then constructs a three-layer network. The number of neurons and the dropout rate of neurons also increase layer by layer. Finally, the number of neurons in the precipitation output layer is 1.

[0072] Construction of training and test sets: Let [1,2,……,n] be the historical time series including the prediction start point before the prediction start point, and [n+1,n+2,……nn] be the prediction time series of the numerical weather prediction model. The input of the training set is a feature subset of m meteorological elements selected by GA, which is rolled over in the time series [1,2,……,n-1] according to time steps tl to obtain n-tl matrices of dimension tl×m, and synthesized into a three-dimensional tensor dimension [samples=n-tl,timesteps=tl,feature=m]. The output of the training set is the precipitation value in the time series [tl+1,tl+2,……,n], and the three-dimensional tensor dimension [samples=n-tl, The test set input consists of m meteorological element values ​​within a time series [n-tl+1, n-tl+2, ..., nn-1], which are rolled over at time steps tl to obtain n-n matrices of dimension tl×m. These matrices are then synthesized into a three-dimensional tensor dimension [samples=nn-n, timesteps=tl, feature=m]. After testing, the output is the precipitation probability p predicted by the model, with an output tensor dimension [samples=nn-n, timesteps=1, feature=1], used to evaluate indicators such as binary classification accuracy and F1 score.

[0073] The Conv1D convolutional layer is used to extract local features from data, and is therefore widely used in deep learning. For each sample in a 3D tensor, Conv1D uses a kernel of size `kernel_size` to cover a small region of the matrix `[timesteps, feature]`, and continues to slide until the entire matrix is ​​covered, yielding the convolution operation result. Given an input data `I` and a convolution kernel `K`, the convolution operation can be represented as: ,in, The input data is at position (d) i ,d j The value of ) I*K[i,j] is the weight value of the convolution kernel at position (i,j), (I*K)[i,j] is the value of the output feature at position (i,j), and * indicates the convolution operation.

[0074] LSTM (Long Short-Term Memory) networks are used to learn the contextual relationships of time series. Their core is the memory unit, which controls the flow of information through several different gating mechanisms, including input gates, forget gates, and output gates. These gating mechanisms allow the neural network to retain or forget information as needed, thus effectively capturing long-term dependencies. Below is the basic formula for LSTM: In the formula, f tIt is the forget gate output at the current time step, σ is the sigmoid activation function, and W is the output of the forget gate at the current time step. f H is the weight matrix of the forget gate. t−1 It is the hidden state of the previous time step, x t It is the input for the current time step, b f It is the bias term of the forget gate. In the formula, i t It is the output of the input gate. It is a candidate memory unit, W i and W c These are the weight matrices for the input gate and candidate memory units, respectively, b i and b c This is the corresponding bias term. C t This is a memory unit update. In this step, the memory unit C at the current time step is updated. t It consists of two parts: one part is the memory unit C from the previous time step. t−1 Multiply by the output f of the forget gate t The other part is the output i of the input gate. t Multiplied by new candidate memory units , where * represents the Hadama product. In the formula, the output gate o t This determines which information from the memory unit will be output to the hidden state H. t The output of the output gate is o. t Activated via the sigmoid function, then linked to memory cell C t The final hidden state H is obtained by multiplying the ReLU activation values. t W o and b o These are the weight matrix and bias term of the output gate, respectively, where * denotes the Hadamard product.

[0075] KerneolExplainer is a core component of the SHAP library, suitable for estimating and interpreting tests of arbitrary neural network models. It approximates the model's feature functions based on a kernel method, assigning a SHAP value to each feature. These SHAP values ​​quantify the contribution of each feature to the model's output. The specific steps are as follows:

[0076] S4.1 Selecting a baseline value: First, select a baseline value for the trained model, usually the average or weighted sum of the dataset samples, as a reference point for calculating the SHAP value.

[0077] S4.21 Calculate Conditional Expectation: For each feature, calculate the difference between the average value of the model output and the baseline value when the feature is included. This difference reflects the contribution of the feature to the model output.

[0078] S4.3 Kernel Estimation: The kernel method is used to smooth and estimate the eigenvalue function. KernelExplainer approximates the eigenvalue function by sampling some dummy data points in the feature space and calculating the model output for these data points. Specifically, the model output is first calculated for each sampled data point, and then the eigenvalue function is estimated using the kernel function and the sampled data points. That is, the kernel function weights the output values ​​of the sampled points to smooth the estimation of the eigenvalue function.

[0079] S4.4 Calculate the SHAP value: For each feature and each sample in the test set, calculate its SHAP value, which is the contribution of the feature value to the model output. For the j-th feature of the i-th sample, and a reference point r... j The SHAP value can be calculated using the following formula: , where x −j k x represents the other feature values ​​of the k-th sampling point besides feature j. −j k x represents the feature values ​​of sample i other than feature j. −j r It is the reference value r j The corresponding eigenvalues ​​other than feature j, K is the kernel function used to smooth the data, y k This is the model output at sampling point k, y r The reference point r j The model output.

[0080] Since the above SHAP value calculation is based on the matrix [samples, feature], for the neural network model in this paper, the three-dimensional tensor [samples=nn-n, timesteps=tl, feature=m] of the test set is first converted into the matrix [samples=nn-n, feature =tl×m], so that the SHAP values ​​of tl×m features can be obtained, where tl is the time step and m is the meteorological element.

[0081] Secondly, a clustering method based on data point path characteristics is used for SHAP value analysis to generate optimized time steps and meteorological elements. Compared with other statistical methods, the advantage of clustering is that it can find similar features close to the highest correlation feature max(mean(|SHAP value|)) without manually specifying a segmentation threshold. The steps are as follows:

[0082] Establish the minimum distance connected path feature (RFS) of the dataset: A graph consisting of tl×m data points of dimension n-n and tl×m-1 undirected acyclic edges connecting any two data points, connected by the nearest neighbor distance, is called a minimum distance connected graph. There is a unique nearest neighbor path R between any two data points. RFS = Rmax represents the maximum edge length of R, with dimensions [tl×m, tl×m].

[0083] Set the number of clusters to 2, and the cluster center points to be {cc1=max(mean(|SHAP value|)), cc2=min(mean(|SHAP value|))}. Then, iterate through the remaining undivided data points cp and find the cluster center point corresponding to the minimum value of {RFS[cp, cc1], RFS[cp, cc2]}. If RFS[cp, cc1]=RFS[cp, cc2], then take the minimum Euclidean distance from cp to cc1 and cc2 as the cluster center point to be assigned, resulting in 2 clusters.

[0084] The set of meteorological element names, m_oc, for the cluster with cluster center cc1 is used to optimize the meteorological elements. The optimized time step tl_oc = tl−min(tl_c), where tl_c is the set of time step indices for this cluster. Finally, the optimized parameters m_oc and tl_oc are used to train the rolling forecast again, and the final prediction result is obtained.

[0085] The output and collaborative optimization module is mainly divided into output layer design and collaborative optimization mechanism. Whether a crop needs irrigation is primarily determined by the following formula: , where P irrigate The overall moisture status score; y t p represents the crop water requirement prediction result of the crop water requirement prediction sub-model; p represents the precipitation prediction result of the LSTM precipitation prediction sub-model; α represents the water requirement severity weight, determined by the crop water requirement type. For high water-demand crops (such as rice and vegetables), the value of α can be increased, α∈(0.5,1], while for drought-resistant crops (such as corn and wheat), the value of α can be decreased, α∈(0,0.5]; β represents the precipitation suppression weight, determined by the soil type. Considering the different soil utilization conversion rates of precipitation, sandy soils suffer severe water loss, so the value of β can be decreased, β∈(0.1,0.3], while clay soils retain good moisture, so the value of β can be increased, β∈(0.3,0.8]; γ represents the baseline irrigation threshold, used to adjust the deviation of the overall irrigation decision. It is set based on irrigation demand. In this embodiment, γ∈(−0.2,0], considering water conservation and reducing false positives, γ∈(0,0.2). Therefore, the above weights can be dynamically adjusted according to specific circumstances. σ is a mapping function that maps the output value to the range of 0-1.

[0086] Finally, P is expressed by the following formula. irrigate Convert to binary label Rout. θ takes a value of 0.5. The converted binary labels are used to characterize the crop water status. Specifically, 1 indicates that the crop has sufficient water and 0 indicates that the crop has insufficient water.

[0087] Example 2

[0088] A system for a crop water requirement and precipitation co-prediction method based on multi-task learning, as described in Example 1, includes:

[0089] Data acquisition module: Collects multi-source historical data that affects crop growth and constructs an original feature pool;

[0090] Feature selection module: Based on two objectives, water demand and precipitation, a genetic algorithm is used to independently select features from the original feature pool to generate feature selection subsets for crop water demand prediction and precipitation prediction.

[0091] Crop water requirement prediction submodule: This submodule uses LSTM and attention mechanisms to predict crop water requirements. The construction process includes:

[0092] S3.1 Improve the LSTM network model using attention mechanism;

[0093] S3.2. Select a subset of crop water requirement prediction features to train the model. During training, compare the error value with the actual value for each prediction to obtain the error value, and then pass the error value to all neurons.

[0094] S3.3 Update the weights and biases of neurons in each layer based on the error values;

[0095] S3.4 Repeat S3.1-S3.3 until the preset conditions are met;

[0096] LSTM precipitation prediction submodule: Precipitation prediction is performed based on a multi-scale LSTM precipitation prediction submodel. During training, KernelExplainer is used to test the LSTM precipitation prediction submodel.

[0097] Results prediction module: Collaboratively optimizes the prediction results of the crop water demand prediction sub-model and the LSTM precipitation prediction sub-model to generate the final discrete prediction labels, including two states: those requiring irrigation and those not requiring irrigation.

[0098] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.

[0099] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A crop water requirement and precipitation collaborative prediction method based on multi-task learning, characterized in that, The method comprises the following steps: S1, collecting multi-source historical data affecting crop growth, and constructing an original feature pool; S2, based on the two targets of water requirement and precipitation, respectively selecting independent features from the original feature pool using a genetic algorithm to generate a crop water requirement prediction feature selection subset and a precipitation prediction feature selection subset; S3, pre-constructing a crop water requirement prediction sub-model based on LSTM and attention mechanism for crop water requirement prediction, the construction process comprising: S3.1, improving the LSTM network model using the attention mechanism; S3.2, training the model using the crop water requirement prediction feature selection subset, comparing the output value of each prediction with the actual value to obtain an error value, and transmitting the error value to all neurons; S3.3, updating the weight and bias values of each layer of neurons according to the error value; S3.4, repeating S3.1-S3.3 until the preset condition is met; S4, constructing a multi-scale LSTM precipitation prediction sub-model for precipitation prediction, and using KernelExplainer to test the LSTM precipitation prediction sub-model during training; S5, optimizing the prediction results of the crop water requirement prediction sub-model and the LSTM precipitation prediction sub-model in collaboration to generate the final discrete prediction label, including irrigation supply and no irrigation supply.

2. The method of claim 1, wherein the method is based on multi-task learning. The multi-source historical data affecting crop growth includes meteorological data, hydrological data, crop growth data, and soil property data. After cleaning the multi-source historical data, the data is converted into a binary classification label, and finally the original feature pool is obtained after merging and unifying.

3. The method of claim 2, wherein the method is based on multi-task learning. Feature selection includes: S2.1, filtering redundant features: calculating the Pearson correlation coefficient of any feature and its corresponding binary classification label and sorting, finding redundant features through Markov blanket and deleting; S2.2, feature grouping: dividing the original feature pool into several similar feature groups, the grouping principle being to divide related features and their redundant features into the same group; S2.3, initializing the population: determining the chromosome coding method, determining the population size, and randomly generating chromosomes; S2.4, calculating the fitness of the chromosomes in the population; S2.5, using the roulette selection operator to calculate the probability of the chromosome being selected; S2.6, using the simulated binary crossover operator for crossover operation; S2.7, completing feature selection after mutation operation using the Cauchy mutation operator.

4. The method of claim 1 or 2, wherein the method is based on multi-task learning. The LSTM precipitation prediction sub-model includes a convolutional layer, a long short-term memory network, and a fully connected layer. During training, the SHAP value of the prediction result is obtained by acquiring meteorological element parameters and time step parameters, and finally the SHAP value is analyzed through clustering. In each rolling forecast, the meteorological element parameters and time step parameters of the model are dynamically adjusted.

5. The method of claim 4, wherein the method is based on multi-task learning. The long short-term memory network includes a forward three-layer and a reverse three-layer, which receive the same input three-dimensional tensor and separately perform forward and reverse time series training and prediction. The number of neurons and the dropout rate of neurons in the three-layer network increase layer by layer, and the output sequence returns all time step hidden states of the first two layers and a single hidden state of the last layer.

6. The method of claim 5, wherein the method is based on multi-task learning. The full connection layer combines the forward and backward long short-term memory network outputs. The full connection layer is a three-layer network with an increasing number of neurons and neuron dropout rate. Finally, it is mapped to the output layer with one neuron for precipitation.

7. The method of claim 4, wherein the method is based on multi-task learning. The test of the LSTM precipitation prediction sub-model using KernelExplainer includes: S4.1, selecting a benchmark value: selecting a benchmark value for the LSTM precipitation prediction sub-model as a reference point for calculating SHAP values; S4.2, calculating conditional expectations: for any feature, calculate the difference between the average value of the model output containing the feature and the benchmark value, reflecting the contribution of the feature to the model output; S4.3, kernel estimation: using kernel method to smooth and estimate the feature value function; S4.4, calculating SHAP values: for any feature and any sample in the test set, calculate its SHAP value to get the contribution of the feature value to the model output.

8. The method of claim 7, wherein the method is based on multi-task learning. Based on the clustering method of data point path characteristics, the SHAP value analysis is performed to generate optimized meteorological element parameters and time step parameters.

9. The method of claim 1, wherein: The generating the final discrete prediction label comprises: calculating a comprehensive moisture state score, and converting the comprehensive moisture state score into a discrete prediction label, wherein the comprehensive moisture state score calculation method comprises: wherein P irrigate is a comprehensive moisture state score; y t is a result of crop water demand prediction performed by a crop water demand prediction sub-model; p is a result of precipitation prediction performed by an LSTM precipitation prediction sub-model; a is a water demand severity weight determined by a crop water type; β is a precipitation inhibition weight determined by a soil type; γ is a reference irrigation threshold value for adjusting the deviation of the overall irrigation decision, which is set based on irrigation demand; and σ is a mapping function for mapping the output value to between 0 and 1.

10. A system for crop water requirement and precipitation co-forecasting based on multi-task learning according to any one of claims 1-9, characterized in that: It includes: Data acquisition module: collect multi-source historical data affecting crop growth and build an original feature pool; Feature selection module: based on the two targets of water demand and precipitation, respectively, use genetic algorithm to independently select features from the original feature pool to generate crop water demand prediction feature selection subset and precipitation prediction feature selection subset; Crop water demand prediction sub-module: crop water demand prediction is performed based on the LSTM and attention mechanism crop water demand prediction sub-model. The construction process includes: S3.1, improve the LSTM network model using attention mechanism; S3.2, use the crop water demand prediction feature selection subset to train the model. During training, compare the output value of each prediction with the actual value to get the error value, and pass the error value to all neurons; S3.3, update the weight and bias values of each layer neuron according to the error value; S3.4, repeat S3.1-S3.3 until the preset condition is met; LSTM precipitation prediction sub-module: based on the multi-scale LSTM precipitation prediction sub-model, precipitation prediction is performed. During training, KernelExplainer is used to test the LSTM precipitation prediction sub-model; Result prediction module: cooperatively optimize the prediction results of the crop water demand prediction sub-model and the LSTM precipitation prediction sub-model to generate the final discrete prediction label, including irrigation supply and no irrigation supply.

Citation Information

Patent Citations

  • Intelligent irrigation control method and system based on meteorological information

    CN119744746A

  • Remote sensing-based agricultural medium and short term water shortage intelligent estimation method

    CN120579668A

  • Precise agricultural drip irrigation system based on intelligent sensing and control method thereof

    CN120814462A

  • Precise irrigation control system and method for fruit tomatoes

    CN120814469A