Agricultural industry economic risk tracking and early warning method and system based on key indexes

By constructing a generative adversarial network, an optimal early warning threshold matching the current agricultural risk scenario is generated, solving the problem of insufficient risk pattern capture in traditional methods and achieving highly accurate early warning of agricultural industry economic risks.

CN121684645APending Publication Date: 2026-03-17张永兰
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511894694.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-16
Publication Date
2026-03-17

AI Technical Summary

Technical Problem

Traditional agricultural industry economic risk early warning methods cannot effectively capture non-linear and time-varying risk patterns, leading to warning failures or false alarms, and the threshold settings lack the ability to correspond to specific scenarios.

Method used

A generative adversarial network architecture is constructed. Through the collaborative training of a scenario generator and a threshold discriminator, the optimal early warning threshold matching the current agricultural risk scenario is generated. This includes historical data annotation, generative adversarial network training, and real-time indicator prediction.

Benefits of technology

It has achieved adaptive and context-sensitive intelligent early warning, which has significantly improved the accuracy and foresight of agricultural industry economic risk early warning and overcome the shortcomings of traditional methods in terms of lag and rigidity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121684645A_ABST
    Figure CN121684645A_ABST
Patent Text Reader

Abstract

The invention relates to an agricultural industry economic risk tracking and early warning method and system based on key indexes. The method comprises the following steps: constructing a generative adversarial network comprising a scene generator and a double-task discriminator, inputting historical agricultural indexes into the generator to generate a pseudo-risk scene and a candidate threshold value, and inputting a real sample and a generated sample into the discriminator for adversarial training; the discriminator discriminates sequence authenticity and threshold-scene matching rationality at the same time, and enables the network to learn complex mapping between a risk scene and an early warning threshold through iterative optimization, thereby training a threshold prediction sub-network. During early warning, a complete scene is spliced based on a real-time index and a prediction sequence to be input into the network, and an optimal threshold highly matched with the current risk is dynamically generated, so that adaptive and scene-sensitive intelligent early warning is realized, the defects of lagging and rigidness of a traditional threshold method are overcome, and the accuracy and foresight of agricultural risk early warning are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of agricultural economic risk management, and in particular relates to a method and system for tracking and early warning of agricultural industry economic risks based on key indicators. Background Technology

[0002] Early warning of economic risks in the agricultural industry is a crucial link in ensuring stable agricultural production and food security. Its core challenge lies in how to identify risk signals in a timely and accurate manner from a vast amount of multidimensional and interconnected indicators. For a long time, mainstream early warning methods have relied heavily on statistical analysis of historical data, such as setting static warning lines by calculating the mean, variance, or specific quantiles of certain indicators over the past few years. While this method is intuitive, it is essentially "looking backward," implicitly assuming that future risk patterns will be similar to those of the past. However, the agricultural system is deeply affected by multiple uncertainties such as climate change, market fluctuations, and policy adjustments, and its risk patterns often exhibit strong nonlinearity and time-varying characteristics. A threshold set based on a five-year average price may fail to effectively capture new scenarios of "price surges" caused by the superposition of extreme weather and international trade disputes, leading to warning failures, missed reports, or false reports during periods of calm.

[0003] To improve the adaptability of early warning systems, some improved methods have introduced dynamic adjustment mechanisms, such as periodically revising baseline thresholds based on recent data or using basic machine learning models to predict indicator trends. While these methods alleviate the lag problem to some extent, their threshold adjustment logic is often linear or based on simple rules, failing to fundamentally understand the complex mechanisms of risk formation. They are like a simple system that can only adjust alarms based on changes in a single dashboard reading, unable to comprehensively handle the complex information flow and interactions from multiple dashboards such as meteorology, planting, markets, and policies. Therefore, when facing "black swan"-like risks that have never occurred historically but are formed by novel combinations of known factors, such methods often fall short, exhibiting a disconnect between their early warning thresholds and the actual risk scenarios, lacking refined scenario-based response capabilities.

[0004] Essentially, the bottleneck of the traditional early warning paradigm lies in its separation of "risk identification" and "threshold setting." Thresholds are pre-set, fixed benchmarks used to measure all different risk indicators. Therefore, there is an urgent need for a technology that proactively generates a risk threshold that best matches the current agricultural situation when a specific agricultural risk scenario is perceived to be forming. Summary of the Invention

[0005] Therefore, it is necessary to provide a method and system for tracking and early warning of agricultural industry economic risks based on key indicators to address the above-mentioned technical problems.

[0006] Firstly, this application provides a method for tracking and early warning of agricultural industry economic risks based on key indicators, including:

[0007] S1. Obtain the historical indicator sequence of agricultural industry economy within the historical time interval, and mark the high-risk period and corresponding effective warning threshold within the historical time interval in combination with the knowledge of agricultural economic experts; construct a historical training sample set based on the historical indicator sequence, high-risk period and corresponding effective warning threshold.

[0008] S2. Construct a generative adversarial network architecture consisting of a scenario generator network and a threshold discriminator network;

[0009] S3. Input the historical indicator sequences from the historical training sample set into the scenario generator network of the generative adversarial network architecture, and output the pseudo high-risk future agricultural indicator sequences and corresponding candidate warning thresholds to form generated samples; input the real samples and generated samples from the historical training sample set into the threshold discriminator network of the generative adversarial network architecture, and perform adversarial training on the threshold discriminator network. Through iterative optimization, a threshold prediction sub-network is obtained to map the optimal warning threshold from a given agricultural risk scenario; wherein, the threshold discriminator network performs dual-task discrimination: the first task is to determine the authenticity of the input sequence, and the second task is to determine the reasonableness of the matching between the input warning threshold and the corresponding risk scenario. The threshold prediction sub-network is used for collaborative training with the scenario generator network.

[0010] S4. Based on the real-time indicator sequence of the current agricultural industry economy, an agricultural time series forecasting model is used to generate a future indicator forecasting sequence; the real-time indicator sequence and the future indicator forecasting sequence are spliced ​​together to form a complete scenario sequence.

[0011] S5. Input the complete scenario sequence into the threshold prediction subnetwork and output the optimal early warning threshold that matches the current agricultural risk scenario; by comparing the current agricultural indicator value with the optimal early warning threshold, the early warning level of agricultural industry economic risk is obtained.

[0012] Secondly, this application also provides an agricultural industry economic risk tracking and early warning system based on key indicators, used to implement the method described in the first aspect, the system comprising:

[0013] The historical risk dataset construction module is used to obtain historical indicator sequences of agricultural industry economy within a historical time interval, and to label high-risk periods and corresponding effective warning thresholds within the historical time interval by combining agricultural economics expert knowledge; based on the historical indicator sequences, high-risk periods and corresponding effective warning thresholds, a historical training sample set is constructed.

[0014] The adversarial network architecture building module is used to construct a generative adversarial network architecture consisting of a scenario generator network and a threshold discriminator network.

[0015] The threshold prediction model training module is used to input historical indicator sequences from the historical training sample set into the scenario generator network of the generative adversarial network architecture, and output pseudo-high-risk future agricultural indicator sequences and corresponding candidate warning thresholds to form generated samples. The real samples and generated samples from the historical training sample set are input into the threshold discriminator network of the generative adversarial network architecture to perform adversarial training on the threshold discriminator network. Through iterative optimization, a threshold prediction sub-network is obtained to map the optimal warning threshold from a given agricultural risk scenario. The threshold discriminator network performs dual-task discrimination: the first task is to determine the authenticity of the input sequence, and the second task is to determine the reasonableness of the matching between the input warning threshold and the corresponding risk scenario. The threshold prediction sub-network is used for collaborative training with the scenario generator network.

[0016] The real-time risk scenario generation module is used to generate a future indicator prediction sequence based on the current real-time indicator sequence of the agricultural industry economy and an agricultural time series forecasting model; the real-time indicator sequence and the future indicator prediction sequence are then spliced ​​together to form a complete scenario sequence.

[0017] The dynamic early warning decision module is used to input the complete scenario sequence into the threshold prediction subnetwork and output the optimal early warning threshold that matches the current agricultural risk scenario. By comparing the current agricultural indicator value with the optimal early warning threshold, the early warning level of agricultural industry economic risk is obtained.

[0018] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement an agricultural industry economic risk tracking and early warning method based on key indicators as described in the first aspect.

[0019] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements an agricultural industry economic risk tracking and early warning method based on key indicators as described in the first aspect.

[0020] The aforementioned method and system for tracking and warning agricultural economic risks based on key indicators constructs training samples by acquiring historical agricultural indicators and expert thresholds. It then builds a generative adversarial network (GAN) containing a scenario generator and a dual-task discriminator. Historical data is input into the generator to obtain pseudo-risk scenarios and candidate thresholds. Real samples and generated samples are then input into the discriminator for adversarial training. The discriminator simultaneously performs sequence authenticity judgment and threshold-scenario matching rationality judgment. Through iterative optimization, the network learns the complex mapping between agricultural risk scenarios and warning thresholds, ultimately training a threshold prediction sub-network. In actual warning scenarios, the system predicts future trends based on real-time indicators and assembles them into a complete scenario sequence. Inputting this prediction sub-network dynamically generates the optimal warning threshold that highly matches the current specific risk scenario. This achieves an adaptive, scenario-sensitive, and intelligent warning system, effectively overcoming the shortcomings of traditional fixed or simple threshold adjustment methods that are lagging and rigid, significantly improving the accuracy and foresight of agricultural economic risk warnings. Attached Figure Description

[0021] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0022] Figure 1 A flowchart illustrating an agricultural industry economic risk tracking and early warning method based on key indicators provided by this invention;

[0023] Figure 2 This is a schematic diagram illustrating the process of training a generative adversarial network architecture in one optional embodiment of the present invention.

[0024] Figure 3 This is a schematic diagram of the structure of an agricultural industry economic risk tracking and early warning system based on key indicators, provided by the present invention. Detailed Implementation

[0025] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0026] refer to Figure 1 The document presents a flowchart illustrating a method for tracking and early warning of agricultural industry economic risks based on key indicators, as provided in this application. This method includes the following steps:

[0027] S1. Obtain the historical indicator sequence of agricultural industry economy within the historical time interval, and mark the high-risk periods and corresponding effective warning thresholds within the historical time interval in combination with the knowledge of agricultural economic experts; construct a historical training sample set based on the historical indicator sequence, high-risk periods and corresponding effective warning thresholds.

[0028] Specifically, the construction of the historical training sample set is the foundation of the entire early warning method. Its core lies in ensuring the comprehensiveness of the data, the accuracy of the annotation, and the rationality of the sample structure, providing high-quality data support for the subsequent training of the generative adversarial network. The acquisition of historical indicator sequences requires systematic screening around the core impact dimensions of the agricultural industry economy, covering four core categories: production, market, policy environment, and external impacts. Indicators under each category must possess clear economic significance and risk correlation to ensure a comprehensive depiction of the operational status and risk evolution characteristics of the agricultural industry economy. Production-side indicators focus on the core input and output factors of agricultural production, reflecting the stability of the production process; market-side indicators emphasize the price formation, circulation, and trade of agricultural products, capturing the risks caused by changes in market supply and demand; policy environment indicators focus on changes in macroeconomic control and industry support policies, reflecting the impact of policy guidance on the agricultural economy; and external impact indicators cover uncontrollable factors such as weather and the macroeconomy, characterizing the uncertainty brought about by external shocks. Data acquisition must be achieved through authoritative and stable data source interfaces. Priority should be given to statistical databases and monitoring systems that have been officially verified to ensure the authenticity and reliability of the data. The time dimension of the data must cover a sufficiently long period to encompass the characteristics of different agricultural production cycles, market fluctuation cycles, and policy adjustment cycles, so that the sample can include diverse risk scenarios and evolution patterns.

[0029] Data preprocessing is crucial for ensuring sample quality and requires systematic handling of potential missing data and anomalies in the original data. For missing data, an appropriate imputation method should be selected based on the duration of the missing data and the data characteristics. If the missing data is short-term and the data has strong temporal continuity, an interpolation method based on time-series trends should be used to imputate the data by mining the temporal evolution patterns. If the missing data is long-term or the data fluctuates significantly, a deep learning-based time-series imputation model should be used. This model takes complete data before and after the missing segment as input and generates imputation values ​​by learning the temporal dependencies and change patterns of the indicators, ensuring that the imputation data closely matches the true evolution logic of the indicators. For anomalies, outliers should first be identified using statistical methods, and then the cause of the anomaly should be determined by combining domain knowledge. If the anomaly is not due to data entry errors or other non-real anomalies, a correction method consistent with the indicator's change trend should be used for adjustment. If the anomaly is due to a real event, the data should be retained and the anomaly background recorded to provide a reference for subsequent high-risk period annotation. Data normalization is used to eliminate the impact of differences in the units of measurement between different indicators. The Min-Max normalization method is used, and its formula is: ,in This represents the normalized index value. This represents the original index value. This indicates the minimum value of the indicator within a historical time interval. This represents the maximum value of the indicator within a historical time interval. By using this formula, all indicator data can be mapped to a unified interval, which not only preserves the relative changes of the indicators but also facilitates feature learning and calculation by the model.

[0030] The labeling of high-risk periods and effective early warning thresholds relies on the knowledge of agricultural economics experts, employing a group decision-making approach to ensure the objectivity and accuracy of the labeling results. The expert team needs to cover multiple fields, including agricultural economics theoretical research, front-line risk management practice, and policy interpretation, to ensure the comprehensiveness and complementarity of expert knowledge. The labeling process adopts the Delphi method, achieving consensus through multiple rounds of independent labeling and feedback. In the first round of labeling, each expert is provided with a pre-processed historical indicator sequence, corresponding time node background information, and risk definition standards. Experts independently determine the start and end range of high-risk periods based on their professional knowledge, and for each high-risk period, analyze the core influencing indicators and their changing characteristics to determine the corresponding effective early warning threshold. This threshold must meet the core requirement of triggering an early warning in a timely manner before the arrival of a high-risk period and avoiding false triggering during non-risk periods. In the second round of labeling, the results of the first round are summarized, and the consistency coefficient of the expert labeling is calculated. If the consistency reaches the preset standard, the labeling result is valid; if it does not reach the standard, the time nodes with significant labeling differences and related data are fed back to the experts. Experts then combine the labeling reasons and basis of other members to make a second judgment and revise their own labeling results. The third round of annotation focused on the refined verification of effective early warning thresholds. Experts analyzed the timeliness and accuracy of early warnings by comparing the triggering time of early warnings under different thresholds with the actual occurrence time of high-risk periods, and further adjusted the threshold size to ensure that the early warning threshold of each indicator can accurately match the characteristics of the corresponding high-risk scenario.

[0031] The construction of the historical training sample set requires the structured integration of processed historical indicator sequences, labeled high-risk periods, and effective early warning thresholds. Each sample must contain three core parts: a time-series feature vector, a risk label vector, and a threshold vector. The time-series feature vector should select a reasonable time step to fully cover the features of an agricultural production cycle or risk evolution cycle. Samples are generated using the sliding window method to ensure that the samples can comprehensively cover the indicator change features within the historical time interval. The risk label vector is used to identify whether the time interval corresponding to the sample is a high-risk period, and the threshold vector stores the effective early warning thresholds corresponding to each indicator during high-risk periods. Threshold vectors for non-high-risk periods use a unified identifier. The sample set partitioning process should employ stratified sampling to divide the sample set into a training set and a validation set, ensuring that the proportion of high-risk samples in the training and validation sets is consistent with the original sample set. This avoids the adverse effects of data imbalance on model training performance and lays a solid data foundation for subsequent adversarial training of the model.

[0032] S2. Construct a generative adversarial network architecture consisting of a scenario generator network and a threshold discriminator network.

[0033] Specifically, the core function of the scenario generator network is to generate pseudo-high-risk future agricultural indicator sequences and corresponding candidate early warning thresholds based on the features of historical indicator sequences, conforming to the evolutionary laws of agricultural economic risks. Its network structure adopts a combined architecture of "LSTM encoder-attention mechanism-fully connected decoder," which can fully explore the deep dependencies in time-series data and highlight the impact of key features on risk scenarios and thresholds. The LSTM encoder is used to extract the temporal features and long-term dependencies of historical indicator sequences. It employs a multi-layer bidirectional LSTM structure. The bidirectional LSTM extracts features from the beginning to the end and from the end to the beginning of the time series through parallel computation of forward and backward LSTMs, respectively. The outputs of the two LSTM layers are then fused to comprehensively capture the changing patterns of the indicator sequences in different time directions. The number of hidden units in each LSTM layer needs to be adaptively adjusted according to the indicator dimension and time series length to ensure sufficient accommodation of temporal feature information and avoid problems such as insufficient feature extraction or parameter redundancy. The core of the LSTM unit lies in the synergistic effect of the input gate, forget gate and output gate to dynamically adjust the storage and forgetting of information in the cell state, thereby effectively dealing with the gradient vanishing problem in long-term data and accurately learning the long-term evolution pattern of agricultural indicator sequences.

[0034] The attention mechanism module employs a multi-head self-attention mechanism. Its core function is to enhance the model's ability to capture key features by calculating the correlation weights between different time steps and different indicators, highlighting the crucial features that contribute to the formation of high-risk scenarios and the setting of warning thresholds. The multi-head self-attention mechanism sets up multiple attention heads, calculates attention weights of different dimensions in parallel, and then fuses the outputs of each attention head. This allows for the discovery of correlations between features from multiple perspectives, avoiding the one-sided feature capture caused by a single attention head. The calculation process first maps the feature vector output by the LSTM encoder to a query vector through a linear transformation. Key vector Sum value vector The query vector represents the feature query requirement at the current location, the key vector describes the feature information of each location, and the value vector stores the feature values ​​of each location. An attention score is calculated by taking the dot product of the query vector and the key vector. This score reflects the correlation strength between the current location and features at other locations. The attention score is then normalized using the Softmax function to obtain the attention weights. Finally, the attention weights are multiplied by the value vectors to obtain the output of the attention head. The outputs of multiple attention heads are fused through a linear transformation to form an enhanced temporal feature vector. This vector highlights the impact of key time steps and key indicators on risk scenario generation, providing accurate feature support for the subsequent generation of pseudo-sequences and candidate thresholds.

[0035] The fully connected decoder is divided into a sequence generation branch and a threshold generation branch, which are used to generate pseudo-high-risk future agricultural indicator sequences and corresponding candidate warning thresholds, respectively. The two branches share features from the previous layer, ensuring that the generated pseudo-sequences and candidate thresholds have inherent consistency. The sequence generation branch transforms the enhanced temporal feature vector into a pseudo-high-risk future indicator sequence through a stepwise mapping of multiple fully connected layers. The output dimension of the fully connected layers is set according to the prediction time step and the number of indicators. The prediction time step needs to be selected to cover the key stages of the high-risk scenario evolution, ensuring that the generated pseudo-sequences can fully represent the evolutionary process of high risk from its inception to its outbreak. The ReLU activation function is used, which effectively alleviates the gradient vanishing problem and improves the model's training stability. The output layer uses the Sigmoid function to map the generated pseudo-sequence values ​​to a range consistent with the preprocessed historical data, facilitating subsequent comparison and training with real samples. The threshold generation branch also employs a multi-layer fully connected layer structure. Through deep mining of the enhanced feature vectors, it generates candidate warning thresholds for each indicator. The design of this branch must ensure that the generated thresholds match the risk level represented by the pseudo-sequence. That is, when the core risk indicators in the pseudo-sequence show an upward trend, the generated candidate warning thresholds can be adjusted accordingly to reflect the threshold requirements under high-risk scenarios. The network initialization adopts the Xavier uniform initialization method. This method ensures that the variance of the output of each layer is consistent in the early stage of model training by reasonably setting the distribution range of the initial parameters, avoiding gradient vanishing or exploding problems, and improving the stability and convergence speed of training.

[0036] The core function of the threshold discriminator network is to perform dual-task discrimination: accurately determining the authenticity of the input sequence and judging the reasonableness of the match between the warning threshold and the corresponding risk scenario. Its network structure adopts a "CNN feature extractor - dual-task classifier" architecture. This architecture can effectively extract local and global features from time-series data, providing sufficient feature support for dual-task discrimination. The CNN feature extractor part gradually extracts local temporal features and multi-indicator coupling features from the input sequence through the stacking of multiple convolutional layers. The size design of the convolutional kernels needs to consider feature capture in both the time step direction and the indicator dimension direction. Convolutional kernels in the time step direction are used to extract temporal correlation features between adjacent time steps, while convolutional kernels in the indicator dimension direction are used to capture the coupling relationship between different indicators. Each convolutional layer is followed by a BatchNorm layer and a LeakyReLU activation function. The BatchNorm layer standardizes the input of each layer, accelerating the model's training convergence and mitigating overfitting. The LeakyReLU activation function sets a small slope in the negative region to avoid neuron death caused by ReLU in the negative region, ensuring the model can fully learn feature information. The feature maps output by the convolutional layers are transformed into fixed-dimensional global feature vectors through global average pooling. This vector integrates the local and global features of the input sequence, comprehensively reflecting the feature attributes and threshold matching of the input sequence.

[0037] The dual-task classifier comprises two parallel classification branches, corresponding to the real / fake sample discrimination task and the matching plausibility discrimination task, respectively. The two branches share the global feature vector output by the CNN feature extractor, ensuring that both discrimination tasks can make judgments based on a unified feature foundation, thus improving the consistency of the discrimination results. The real / fake sample discrimination branch is used to determine whether the input sequence is a real historical sample or a fake sample generated by the context generator. Multiple fully connected layers map the global feature vector to two predicted probabilities, namely the probability distributions of "real samples" and "fake samples." The loss function adopts the binary cross-entropy loss function, the formula of which is... ,in This represents the true label of the sample; a value of 1 indicates a true sample, and a value of 0 indicates a pseudo sample. The probability that the model predicts a sample as a real sample is given by the loss function. This loss function effectively measures the difference between the predicted probability and the true label, guiding the model to learn the feature differences between real and pseudo samples. The matching rationality discrimination branch is used to determine whether the input warning threshold matches the corresponding risk scenario. It also outputs the probability distribution of "match" and "mismatch" through multiple fully connected layers. The loss function is the binary classification cross-entropy loss function, and the formula is... ,in This represents the true label of the matching relationship. A value of 1 indicates a match between the threshold and the context, while a value of 0 indicates a no-match. The loss function, representing the matching probability predicted by the model, guides the model to learn a reasonable mapping relationship between the threshold and the risk scenario. The total loss function of the threshold discriminator network is... ,in and The loss weight coefficients, used to balance the training importance of the two discrimination tasks, need to be determined through debugging on the validation set to ensure that the two tasks can be optimized synergistically, thereby improving the overall performance of the model. The network is initialized using the He normal initialization method, which is suitable for initializing the parameters of the ReLU activation function, ensuring that the variance of the outputs of each layer remains consistent, thus improving the training efficiency and stability of the model. The input dimension of the entire generative adversarial network architecture must be consistent with the sample dimension of the historical training sample set, while the output dimension is set according to the function of different network modules. This ensures that the architecture can achieve coordinated operation of scenario generation and dual-task discrimination, laying the foundation for subsequent adversarial training.

[0038] S3. Input the historical indicator sequences from the historical training sample set into the scenario generator network of the generative adversarial network architecture, and output the pseudo high-risk future agricultural indicator sequences and corresponding candidate warning thresholds to form generated samples. Input the real samples and generated samples from the historical training sample set into the threshold discriminator network of the generative adversarial network architecture, and perform adversarial training on the threshold discriminator network. Through iterative optimization, a threshold prediction sub-network is obtained to map the optimal warning threshold from a given agricultural risk scenario. The threshold discriminator network performs dual-task discrimination: the first task is to determine the authenticity of the input sequence, and the second task is to determine the reasonableness of the matching between the input warning threshold and the corresponding risk scenario. The threshold prediction sub-network is used for collaborative training with the scenario generator network.

[0039] Specifically, the core of adversarial training lies in achieving collaborative optimization of the two types of networks through the game between the scenario generator network and the threshold discriminator network. Ultimately, a threshold prediction sub-network with accurate scenario-threshold mapping capability is separated out. This process must strictly follow the training logic of generative adversarial networks, while taking into account the characteristics of agricultural economic risk data, to ensure that the trained network can effectively handle complex risk scenarios.

[0040] The sample generation stage is fundamental to adversarial training, and its quality directly impacts the model's training performance. This stage involves randomly selecting a batch of samples from the training set of historical training samples. The historical indicator sequences from these samples are input into the scenario generator network. Through feature extraction and mapping by the network, pseudo-high-risk future agricultural indicator sequences and corresponding candidate warning thresholds are generated, constituting the generated samples. The selection of batch samples must employ random sampling to ensure that each input to the network covers different historical risk scenarios, avoiding model learning bias. When generating pseudo-samples, the scenario generator network must simulate the evolution of agricultural economic risks based on the characteristics of historical indicator sequences. The generated pseudo-high-risk future indicator sequences must be similar to real high-risk sequences in terms of temporal trends and indicator correlations. Simultaneously, the candidate warning thresholds must match the risk level represented by the pseudo-sequences, ensuring the generated samples possess a certain degree of realism and rationality, effectively exerting training pressure on the threshold discriminator network. The dimensionality of the generated samples must be consistent with the real samples to facilitate subsequent input into the threshold discriminator network for training along with the real samples.

[0041] The dual-task discrimination training phase is the core of adversarial training. The threshold discriminator network needs to simultaneously judge the authenticity of input samples and the reasonableness of threshold-scenario matching, optimizing network parameters through gradient backpropagation. In this phase, real samples from the historical training sample set are mixed with pseudo-samples generated by the scenario generator network and then input into the threshold discriminator network. Real samples contain real historical indicator sequences, high-risk labels, and effective warning thresholds, while pseudo-samples contain generated pseudo-high-risk future indicator sequences and candidate warning thresholds. The threshold discriminator network first extracts the sequence features of the input samples using a CNN feature extractor, generating a global feature vector. This vector is then input into two classification branches to perform dual-task discrimination. The authenticity discrimination branch determines whether the input sample is real or pseudo based on the global feature vector and outputs the corresponding probability distribution. The reasonableness matching discrimination branch, based on the global feature vector, determines whether the warning threshold in the sample matches the corresponding risk scenario, also outputting a probability distribution. Based on the outputs of the two branches, the loss values ​​corresponding to the dual tasks are calculated, and the parameters of the threshold discriminator network are updated through the gradient backpropagation mechanism. Specifically, the predicted probability of the true / false discrimination branch and the true label are substituted into the binary classification cross-entropy loss function to calculate the first task loss. The predicted probability of the matching reasonableness discrimination branch and the matched true label are substituted into the corresponding loss function to calculate the second task loss. Then, the total loss of the threshold discriminator network is obtained by weighting and summing them according to the preset weight coefficients. Subsequently, based on the total loss, the gradient of the parameters of each layer is calculated by the stochastic gradient descent optimization algorithm. The weights and biases of the convolutional layer and fully connected layer, as well as the parameters of the BatchNorm layer, are adjusted along the gradient descent direction to update the parameters of the threshold discriminator network and improve its ability to distinguish between true / false samples and threshold matching degree.

[0042] After the threshold discriminator network completes one round of parameter updates, it enters the optimization phase of the scenario generator network. The core objective of this phase is to improve the quality of the pseudo-samples generated by the scenario generator network, enabling them to deceive the threshold discriminator network, while simultaneously enhancing the reasonableness of the matching between the generated candidate warning thresholds and pseudo-high-risk scenarios. Historical indicator sequences from the historical training sample set are input into the scenario generator network to generate new pseudo-high-risk future agricultural indicator sequences and candidate warning thresholds, forming a new round of pseudo-samples. These pseudo-samples are then input into the updated threshold discriminator network to obtain the prediction results and loss values ​​for both tasks. However, at this stage, only the loss corresponding to the scenario generator network is calculated. That is, the loss function of the scenario generator network is constructed by using the threshold discriminator network's error rate in distinguishing between true and false pseudo-samples and the error rate in judging the reasonableness of threshold matching. This loss function includes not only a loss term that makes pseudo-samples as likely as possible to be misclassified as real samples, but also a loss term that makes candidate warning thresholds as likely as possible to be judged as matching pseudo-scenarios. Through the synergistic effect of these two losses, the scenario generator network is guided to generate pseudo-samples that are both realistic and have reasonable threshold matching relationships.

[0043] Adversarial training employs an alternating iterative approach: the threshold discriminator network is trained once, followed by the scenario generator network, and this process is repeated. During each iteration, different batches of samples are randomly drawn from the training set to prevent the model from getting trapped in local optima. Simultaneously, after each iteration, the performance of both networks is evaluated using a validation set. Evaluation metrics include the dual-task accuracy of the threshold discriminator network (accuracy in distinguishing between genuine and fake scenarios and accuracy in determining the reasonableness of the match), and the quality score of the scenarios generated by the scenario generator network (obtained by calculating the feature similarity between the generated sequence and the real high-risk sequence, and the deviation between the generated threshold and the real effective threshold). Adversarial training stops when the preset maximum number of iterations is reached, or when the evaluation metrics on the validation set no longer improve after several consecutive iterations. At this point, the scenario generator network has the ability to generate high-quality pseudo-high-risk scenarios and corresponding candidate thresholds, while the threshold discriminator network can accurately distinguish between genuine and fake samples and the threshold matching degree.

[0044] The threshold prediction subnetwork is obtained based on a mature generative adversarial network architecture. Through separation and reconstruction, an independent network with context-threshold mapping capabilities is obtained. During adversarial training, the threshold generation branch in the fully connected decoder of the context generator network and the matching rationality discrimination branch of the threshold discriminator network form a collaborative learning process. The former learns how to generate thresholds that match the context, while the latter learns how to discriminate this matching relationship. This collaborative training allows the threshold generation branch to deeply explore the inherent mapping rules between context features and thresholds. Therefore, integrating the LSTM encoder, attention mechanism module, and threshold generation branch in the context generator network constitutes the threshold prediction subnetwork. This subnetwork inherits the feature extraction capabilities and context-threshold mapping relationships learned during training. It can directly receive input risk context sequences, extract deep temporal features through the encoder, strengthen key features through the attention mechanism, and finally output the optimal warning threshold that best matches the context through the threshold generation branch, achieving a precise mapping from risk contexts to warning thresholds.

[0045] S4. Based on the real-time indicator sequence of the current agricultural industry economy, an agricultural time series forecasting model is used to generate a future indicator forecasting sequence; the real-time indicator sequence and the future indicator forecasting sequence are spliced ​​together to form a complete scenario sequence.

[0046] Specifically, acquiring real-time indicator sequences requires establishing an efficient and stable data collection mechanism that covers core dimensions consistent with historical indicator sequences, ensuring data consistency and comparability. Data collection must rely on a real-time monitoring system, establishing real-time data interfaces with authoritative data sources such as agricultural production monitoring platforms, market transaction data platforms, policy release platforms, and meteorological monitoring networks to achieve automated collection and synchronous updates of indicator data. During the collection process, a data verification mechanism must be implemented to verify the integrity and validity of the transmitted data. If data transmission interruption or anomalies are detected, a backup data source switching mechanism should be immediately activated to ensure the continuity and reliability of the real-time indicator sequences. The time granularity of the real-time indicator sequences must be consistent with historical indicator sequences to ensure the continuity of temporal characteristics. The time length must be selected to fully reflect the current state of agricultural economic operation, ensuring the inclusion of recent key trends and characteristics, providing solid basic data support for future indicator forecasting.

[0047] The selection of agricultural time series forecasting models must fully consider the temporal characteristics of agricultural indicator sequences, including trends, periodicity, seasonality, and random fluctuations, to ensure that the model can accurately capture these characteristics and make effective predictions. Model selection should be adapted to the specific characteristics of agricultural time series, prioritizing deep learning models capable of handling long-term time series dependencies and nonlinear features. These models can deeply mine the inherent evolutionary patterns of indicator sequences through multi-layered network structures, improving prediction accuracy. Model training should be based on historical indicator sequences in the historical training sample set. A sliding window method should be used to construct training samples, with the first half of each window used as input features and the second half as the prediction target. The model parameters should be iteratively optimized using a gradient descent algorithm to minimize the error between predicted and true values. An early stopping strategy should be adopted during model training, using the prediction error on the validation set as a monitoring indicator. Training should be stopped when the validation set error increases continuously for multiple rounds to avoid overfitting and ensure the model has good generalization ability.

[0048] The generation of future indicator prediction sequences relies on a well-trained agricultural time series forecasting model. Using real-time indicator sequences as input, the model extracts temporal, trend, and cyclical features from the real-time sequences, combining these with evolutionary patterns learned during historical training to generate predicted values ​​for specific future periods. An uncertainty assessment mechanism must be introduced during the forecasting process. By making multiple predictions and calculating the variance of the results, the degree of uncertainty in the predicted values ​​is quantified, providing a reference for the generation of subsequent early warning thresholds. The length of the future indicator prediction sequence must be determined based on the key cycles of agricultural risk evolution, ensuring coverage of critical stages where high-risk scenarios may develop, and enabling the complete scenario sequence to fully represent the evolutionary path from the current state to potential future risk states.

[0049] The concatenation of real-time indicator sequences and future indicator prediction sequences must adhere to the principle of temporal continuity. The end of the real-time indicator sequence must be seamlessly connected to the beginning of the future indicator prediction sequence in chronological order to form a complete scenario sequence. Before concatenation, the data formats of the two types of sequences must be validated for consistency, ensuring that the indicator dimensions and data types are completely identical to avoid distortion of scenario information due to format differences. The construction of the complete scenario sequence must comprehensively integrate the current actual operating status of the agricultural economy with future predicted evolution trends. It should include both objective data that has already occurred and potential risk evolution directions, providing the threshold prediction sub-network with input data that can fully characterize the risk scenario and ensuring that the subsequently generated warning thresholds are adequately adapted to the current and future risk situation.

[0050] S5. Input the complete scenario sequence into the threshold prediction subnetwork and output the optimal early warning threshold that matches the current agricultural risk scenario; by comparing the current agricultural indicator value with the optimal early warning threshold, the early warning level of agricultural industry economic risk is obtained.

[0051] Specifically, the process of inputting the complete scenario sequence into the threshold prediction subnetwork requires ensuring that the data format fully matches the network input dimension. Based on the standards of previous data preprocessing, the complete scenario sequence is standardized to ensure consistency with the processing method of historical training samples, avoiding threshold prediction deviations caused by differences in data distribution. After receiving the complete scenario sequence, the threshold prediction subnetwork first performs deep extraction of temporal features in the sequence through an LSTM encoder to capture the dependencies and evolution trends between indicators at different time steps. Then, through a multi-head self-attention mechanism, it calculates the contribution weight of each time step and each indicator to risk formation, strengthening the feature information corresponding to key risk factors and suppressing the interference of irrelevant features. Finally, through a threshold generation module composed of fully connected layers, the extracted enhanced features are mapped to the warning thresholds corresponding to each indicator. This threshold is the optimal warning threshold that best matches the current and future risk scenarios.

[0052] The generation of the optimal early warning threshold relies on the scenario-threshold mapping law learned by the threshold prediction subnetwork during adversarial training. This mapping law fully considers the nonlinearity, time-varying nature, and multi-factor coupling characteristics of agricultural risks, overcoming the limitations of traditional static thresholds. The generated optimal early warning threshold is not a fixed value, but a personalized threshold dynamically adapted to the risk situation represented by the current complete scenario sequence. When the core risk indicators in the scenario sequence show an upward trend, the optimal early warning threshold will be adjusted accordingly to trigger an early warning; when the scenario sequence represents a mitigated risk situation, the threshold will be adaptively adjusted to avoid false alarms. The generated optimal early warning threshold needs to undergo inverse normalization processing to restore it from the normalized interval to the original indicator's dimensions. The inverse normalization formula is: Where x is the original warning threshold after restoration, The normalized threshold for the output of the threshold prediction subnetwork. and These are the minimum and maximum values ​​of the indicator within the historical time interval. Inverse normalization is used to ensure that the warning threshold has practical economic significance and interpretability, facilitating subsequent comparison with the actual current agricultural indicator values.

[0053] A scientific quantitative comparison mechanism needs to be established to compare current agricultural indicator values ​​with optimal early warning thresholds. First, the comparison logic for each core indicator should be clearly defined. For positive indicators (higher values ​​indicate greater risk), a risk signal is triggered when the current indicator value is greater than or equal to the optimal early warning threshold. For negative indicators (lower values ​​indicate greater risk), a risk signal is triggered when the current indicator value is less than or equal to the optimal early warning threshold. During the comparison process, indicator weighting coefficients need to be introduced. These coefficients are determined using the analytic hierarchy process combined with the knowledge of agricultural economic experts, reflecting the degree of impact of different indicators on agricultural economic risks. Core indicators (such as those directly affecting production stability or market supply and demand) are assigned higher weights, while secondary indicators are assigned lower weights.

[0054] The risk warning level is determined based on the comparison results and weighting coefficients of each indicator. A weighted summation method is used to calculate the comprehensive risk score. The formula for the comprehensive risk score is as follows: Where S is the overall risk score, Let be the weight coefficient of the i-th indicator. This represents the risk score for the i-th indicator (value 1 when a risk signal is triggered, and 0 when not triggered). Based on the range of the comprehensive risk score, different early warning levels are established. The classification of early warning levels must be combined with the actual needs of agricultural economic risk management to ensure that the level classification has clear decision-making guidance significance, and different levels correspond to different risk response strategies. For example, when the comprehensive risk score is in the low range, it is determined to be a low-risk level, corresponding to a routine monitoring strategy; when the score is in the middle range, it is determined to be a medium-risk level, corresponding to an enhanced monitoring and early warning strategy; and when the score is in the high range, it is determined to be a high-risk level, corresponding to an emergency response and intervention strategy.

[0055] After issuing an early warning level, a result verification and feedback mechanism needs to be established to compare the warning results with the actual agricultural economic operation status, and to assess the accuracy and timeliness of the warning. If a deviation is found between the warning level and the actual risk status, the relevant data should be fed back to the historical training sample set, and the threshold prediction subnetwork should be iteratively updated regularly to continuously optimize the scenario-threshold mapping relationship, improve the adaptability and accuracy of the early warning method, and ensure that it provides reliable support for the prevention and control of agricultural economic risks in the long term.

[0056] The aforementioned method for tracking and early warning of agricultural economic risks based on key indicators constructs training samples by acquiring historical agricultural indicators and expert thresholds. It then builds a generative adversarial network (GAN) containing a scenario generator and a dual-task discriminator. Historical data is input into the generator to obtain pseudo-risk scenarios and candidate thresholds. Real and generated samples are then input into the discriminator for adversarial training. The discriminator simultaneously performs sequence authenticity judgment and threshold-scenario matching rationality judgment. Through iterative optimization, the network learns the complex mapping between agricultural risk scenarios and early warning thresholds, ultimately training a threshold prediction sub-network. In actual early warning, the system predicts future trends based on real-time indicators and assembles them into a complete scenario sequence. Inputting this prediction sub-network dynamically generates the optimal early warning threshold that highly matches the current specific risk scenario. This achieves an adaptive, scenario-sensitive, and intelligent early warning system, effectively overcoming the shortcomings of traditional fixed or simple threshold adjustment methods that are lagging and rigid, significantly improving the accuracy and foresight of agricultural economic risk early warning.

[0057] refer to Figure 2 In an optional embodiment, S3 includes the following steps:

[0058] S11. Extract a batch of samples from the historical training sample set to obtain a batch real sample set consisting of multiple samples.

[0059] Specifically, the sampling process follows the principle of stratified random sampling, stratifying based on the risk label vectors in the historical training sample set. This ensures that the ratio of high-risk to non-high-risk samples in the batch of real samples remains consistent with the ratio in the original historical training sample set, preventing biased judgments from the threshold discriminator network in the early stages of training due to sample distribution imbalance. The size of the batch sample needs to be determined comprehensively based on the computational resources and convergence efficiency of model training. Its core requirement is to cover different types of historical risk scenarios (including various high-risk scenarios caused by production disturbances, market fluctuations, policy adjustments, and sudden changes in the external environment) while ensuring computational efficiency for each training session. Each batch of real samples fully contains three parts: a temporal feature vector, a risk label vector, and a threshold vector. The temporal feature vector maintains a uniform time step to ensure dimensionality consistency when inputting into the network. A random seed mechanism is introduced during the sampling process to ensure the randomness and repeatability of each sampling, while avoiding excessive overlap between consecutive batches of samples. By controlling the overlap rate between batches within a reasonable range, the model can continuously learn diverse historical features, improving its generalization ability. The construction of a batch of real sample sets also needs to undergo data consistency verification to ensure that the historical indicator sequences, high-risk labels and effective warning thresholds in each sample correspond one-to-one, without logical contradictions or missing data, so as to provide a reliable real reference benchmark for subsequent dual-task discrimination training.

[0060] S12. Fix the parameters of the scenario generator network, input all historical indicator sequences from the batch of real sample sets into the scenario generator network, generate a batch of corresponding pseudo-high-risk future indicator sequences, and initialize a dynamically adjustable candidate warning threshold parameter set for the pseudo-high-risk future indicator sequences.

[0061] Specifically, the design of fixing the parameters of the scene generator network is a phased strategy in adversarial training that prioritizes "optimizing the discriminator first, then the generator." Its purpose is to ensure that the threshold discriminator network can be trained on stable generated samples in the current iteration, preventing simultaneous changes in generator parameters from causing confusion in the discriminator's learning objective. Fixing the parameters involves freezing all weights and biases of the LSTM encoder, attention mechanism module, and fully connected decoder in the scene generator network, retaining only the forward propagation path and not performing gradient backpropagation updates. After inputting historical indicator sequences from a batch of real samples into the scene generator network, the network will generate pseudo-high-risk future indicator sequences based on the fixed feature extraction and mapping logic. The generation process follows the previously designed architecture of "LSTM encoder - multi-head self-attention mechanism - fully connected decoder". The LSTM encoder extracts the temporal dependence and trend features of historical indicator sequences, the attention mechanism strengthens the key feature information for high-risk formation, and the sequence generation branch of the fully connected decoder simulates the evolution of agricultural economic risks from historical states to the future based on these features. The generated pseudo-high-risk future indicator sequences must have similarity to real high-risk sequences in terms of temporal trends, coupling relationships between indicators, and risk evolution rate, while also containing a certain degree of randomness to cover potential risk patterns that have not yet appeared. The initialization of the candidate warning threshold parameter set needs to be based on the statistical distribution characteristics of historical effective warning thresholds, using a constrained random initialization method to ensure that the initial value of each candidate threshold falls within a reasonable distribution range of historical effective thresholds, avoiding excessive deviation of the initial value that would lead to difficulties in subsequent optimization. The dimension of the parameter set is consistent with the number of indicators, each parameter corresponds to a candidate warning threshold of a core indicator, and a dynamic adjustment flag is set to provide a basis for subsequent parameter updates based on discriminator feedback. The initialization process also requires the introduction of rationality constraints. For example, the candidate thresholds for price indicators must be greater than zero, and the candidate thresholds for ratio indicators must be within a reasonable range to ensure that the physical meaning of the parameter set is consistent with the economic logic.

[0062] S13. Take the batch of real sample sets as input for real sample pairs, and take the combination of parameters from the historical indicator sequence, the pseudo-high-risk future indicator sequence and the corresponding candidate warning threshold parameter set as input for generated sample pairs.

[0063] Specifically, this step constructs input sample pairs that meet the dual-task discrimination requirements of the threshold discriminator. Through a clear sample pair structure, the discriminator can simultaneously acquire sequence information and threshold information, achieving collaborative training for both "true / false discrimination" and "matching rationality discrimination." The construction of real sample pairs is based on a single sample from a batch of real sample sets. Each real sample pair consists of three parts: "historical indicator sequence - high-risk label - effective warning threshold." The historical indicator sequence and effective warning threshold are the core input information for the discriminator, while the high-risk label serves as auxiliary information for subsequent loss calculation. The construction of generated sample pairs is based on the pseudo-high-risk future indicator sequence and candidate warning threshold parameter set generated in S12. Each generated sample pair consists of three parts: "historical indicator sequence - pseudo-high-risk future indicator sequence - candidate warning threshold." The historical indicator sequence is consistent with the input in the batch of real sample sets, ensuring the comparability of the input basis between the generated sample pairs and the real sample pairs. The correspondence between the pseudo-high-risk future indicator sequence and the candidate warning threshold is bound by an index, ensuring that each pseudo-sequence has a unique corresponding candidate threshold parameter. The construction of sample pairs must strictly ensure dimensional consistency between real and generated sample pairs. This includes complete matching of the time step size, number of indicators, and dimensionality of the threshold vector for the temporal feature vector. This avoids discriminator network errors or feature extraction biases caused by differences in input dimensions. Furthermore, sample pairs must include sample type identifiers (real sample identifier or generated sample identifier) ​​and matching relationship identifiers (real match identifier or match to be discriminated against identifier). This provides a clear basis for calculating the loss of the discriminator's dual-task output, ensuring accurate quantification of the discriminator's judgment error during subsequent training.

[0064] S14. Input both the real sample pairs and the generated sample pairs into the threshold discriminator network. Calculate the total loss of the threshold discriminator network based on its discrimination output for the real sample pairs and the generated sample pairs. Update the parameters of the threshold discriminator network by minimizing the total loss, and simultaneously update the candidate warning threshold parameter set.

[0065] Specifically, when mixing real and generated sample pairs and inputting them into the threshold discriminator network, a random shuffling method is used to avoid the input order of the sample pairs affecting the discriminator training. The threshold discriminator network first extracts features from the sequence information (real historical sequences or "history + pseudo-future" sequences) in the sample pairs using a CNN feature extractor, generating a global feature vector containing temporal local features and global coupled features. Then, it enhances the feature vector by combining threshold information (effective warning threshold or candidate warning threshold), and then inputs it into two classification branches to perform dual-task discrimination. The true / false discrimination branch outputs the probability distribution of each sample pair as a "real sample pair" or a "generated sample pair", while the matching rationality discrimination branch outputs the probability distribution of each sample pair as "threshold matches the scenario" or "does not match". The total loss is calculated based on a weighted sum of the losses from both tasks. The true / false discrimination loss uses binary cross-entropy loss, calculated based on the output probability of the true / false discrimination branch and the sample type identifier. The matching reasonableness discrimination loss also uses binary cross-entropy loss, calculated based on the output probability of the matching reasonableness branch and the matching relationship identifier. The total loss formula is as follows: ,in To determine the loss in order to verify authenticity, To determine the reasonableness of the loss, and The loss weight coefficients are determined through validation set testing to ensure balanced weights for both tasks during training. Parameter updates employ a stochastic gradient descent optimization algorithm. The parameters are adjusted along the gradient descent direction by calculating the gradient of the total loss with respect to the parameters of each layer of the threshold discriminator network (convolutional layer weights and biases, fully connected layer weights and biases, and BatchNorm layer parameters) to minimize the total loss. Simultaneously, the candidate warning threshold parameter set is optimized based on the matching rationality discrimination loss. Specifically, for candidate thresholds in the generated sample pairs that the discriminator determines are "mismatched," the threshold size is adjusted according to the direction of the loss gradient. If the loss gradient is positive, the current threshold is higher than the optimal matching value and needs to be adjusted towards decreasing; if the loss gradient is negative, it is adjusted towards increasing. The adjustment step size is kept consistent with the learning rate of the discriminator parameters to avoid excessive adjustment that could cause the threshold to exceed a reasonable range. The update of the candidate threshold parameter set must also follow the constraints to ensure that the adjusted threshold still conforms to the physical meaning and logical range of agricultural economic indicators. For example, the threshold of output indicators must not be lower than zero, and the threshold of price volatility must not be negative. Through parameter updates, the candidate warning thresholds are gradually moved toward matching the sequence of pseudo-high-risk future indicators.

[0066] S15. Fix the parameters of the threshold discriminator network, extract another batch of historical indicator sequences, generate a new batch of pseudo-high-risk future indicator sequences through the scenario generator network, and use the threshold prediction sub-network to generate corresponding proposed warning threshold sets for the new pseudo-high-risk future indicator sequences.

[0067] Specifically, the core design of this step is to switch training targets. With the threshold discriminator network parameters fixed, the parameters of the scenario generator network and the threshold prediction sub-network are optimized to achieve alternating iterations of adversarial training. The operation of fixing the threshold discriminator network parameters is consistent with the logic of fixing the generator parameters in S12, i.e., freezing the weights and biases of all layers of the discriminator, retaining only the forward propagation function, ensuring that it evaluates the generated samples with stable discrimination criteria in the current iteration. The extraction of another batch of historical indicator sequences still adopts the stratified random sampling principle, consistent with the sampling logic of S11, but it must be ensured that this batch of samples has no overlap or only a small overlap with the samples extracted in S11, to ensure the diversity of training samples and avoid overfitting the model to a specific batch of samples. During the generation of new pseudo-high-risk future indicator sequences, although the parameters of the scenario generator network are not updated, due to the different historical indicator sequences input and the network's own random generation mechanism, it can generate pseudo sequences different from those in S12. These new pseudo sequences not only continue the evolutionary pattern of agricultural economic risks but also contain new scenario features, providing diversified inputs for the training of subsequent prediction sub-networks. The process of generating proposed warning threshold sets by the threshold prediction sub-network is a key step in its participation in collaborative training. This process takes the new pseudo-high-risk future indicator sequences output by the scenario generator network as input. First, the temporal features and risk evolution features of the pseudo sequences are extracted by the LSTM encoder inherited from the scenario generator. Then, the feature information of key risk indicators in the pseudo sequences is strengthened by a multi-head self-attention mechanism. Finally, these features are mapped to the proposed warning threshold set through a fully connected threshold generation branch. The dimension of the proposed warning threshold set is consistent with the number of indicators. Each threshold is generated for a specific risk scenario of the new pseudo sequence. Compared with the candidate warning threshold parameter set initialized in S12, the proposed warning threshold set is more targeted and can initially reflect the matching relationship between thresholds and scenarios. During the generation process, the prediction subnetwork will, based on the learned preliminary mapping rules and combined with the changing trends of risk indicators in the pseudo-sequence (such as a continuous rise in indicator values ​​corresponding to a higher proposal threshold, and a sharp fluctuation in indicator values ​​corresponding to a more sensitive proposal threshold), ensure that the set of proposal thresholds is adapted to the risk level of the new pseudo-high-risk future indicator sequence.

[0068] S16. Combine another batch of historical indicator sequences, new pseudo-high-risk future indicator sequences, and the corresponding proposed early warning threshold set into a new set of generated sample pairs as input. Input the new set of generated sample pairs as input to a threshold discriminator network with fixed parameters. Calculate the generation loss of the scenario generator network based on the discriminator network's output on the new set of generated sample pairs as input. Simultaneously update the parameters of the scenario generator network and the threshold prediction sub-network by minimizing the generation loss.

[0069] Specifically, a discriminator with fixed parameters provides stable evaluation feedback, guiding the generator to produce more realistic pseudo-sequences while allowing the prediction sub-network to learn a more accurate scenario-threshold mapping. The construction of the new generated sample pair input set is centered on the new pseudo-high-risk future indicator sequence and proposed warning threshold set generated in S15. Each new generated sample pair consists of three parts: "another batch of historical indicator sequences - new pseudo-high-risk future indicator sequences - proposed warning thresholds," maintaining the same structure as the generated sample pairs in S13 to ensure correct parsing by the threshold discriminator network. After inputting this input set into the threshold discriminator network with fixed parameters, the discriminator outputs the true / false judgment result and the matching reasonableness judgment result for each new generated sample pair based on the established discrimination criteria. Because the discriminator parameters are fixed, its discrimination logic reflects the real sample features and threshold-scenario matching rules learned in the previous iteration, enabling an objective evaluation of the output quality of the current generator and prediction sub-network. The generation loss is calculated primarily based on two dimensions: first, the true / false discrimination loss, where the lower the probability that a newly generated sample pair is judged as a "real sample pair" by the discriminator, the greater the loss. This loss guides the scenario generator network to optimize and generate more realistic pseudo-sequences. Second, the matching reasonableness discrimination loss, where the lower the probability that the proposed warning threshold is judged as "matching the scenario" by the discriminator, the greater the loss. This loss guides the threshold prediction sub-network to optimize the mapping relationship and generate more suitable proposed thresholds. The formula for the generation loss is as follows: ,in To determine the loss in order to verify authenticity, To determine the reasonableness of the loss, and These are the loss weight coefficients, whose values ​​are related to those used in the discriminator training. , This ensures that the optimization directions of the generator and prediction subnetworks are consistent with the training objectives of the discriminator.

[0070] During parameter updates, the gradient of the generation loss is backpropagated to both the scenario generator network and the threshold prediction subnetwork. The scenario generator network's parameter updates focus on improving the realism of the pseudo-sequences. This is achieved by adjusting the hidden layer weights of the LSTM encoder, the correlation weights of the attention mechanism, and the mapping weights of the fully connected decoder, making the generated pseudo-sequences closer to real sequences in terms of temporal features and indicator coupling relationships. The threshold prediction subnetwork's parameter updates focus on improving the accuracy of the scenario-threshold mapping. This is achieved by adjusting the weights of the encoder and threshold generation branches, strengthening the mapping correlation between key risk features and warning thresholds, enabling the prediction subnetwork to accurately capture the intrinsic connection between indicator change patterns and threshold adjustment logic under different risk scenarios. During the update process, gradient backpropagation prioritizes correcting parameters that contribute significantly to the loss of matching rationality. For example, when the proposed threshold for a certain type of risk scenario (such as production-side risks caused by meteorological disasters) is consistently judged as mismatched by the discriminator, the network will focus on adjusting the extraction weights of relevant features for that type of scenario and the threshold mapping parameters. By strengthening the weights of core features such as meteorological indicators and production input indicators, the logic of threshold generation is optimized.

[0071] Simultaneously, the parameter updates of the scenario generator network focus on improving the scenario realism of the pseudo-sequences. For example, it optimizes the parameters related to the risk evolution rate in the LSTM encoder, making the generated pseudo-high-risk future indicator sequences closer to the characteristics of real high-risk scenarios in key dimensions such as price fluctuations and production decline trends, thus reducing the probability of the discriminator identifying pseudo-sequences. This collaborative update mechanism ensures a positive interaction between the scenario generator and the threshold prediction sub-network. The generator provides higher-quality training scenarios, and the prediction sub-network learns more accurate mapping relationships based on high-quality scenarios, gradually narrowing the gap between generated samples and real samples in terms of sequence features and threshold matching. After the parameter updates, the network parameters need to be validated to ensure that all parameters are within a reasonable range, without gradient explosion or numerical overflow issues, maintaining the stable operation of the network.

[0072] S17. Repeat steps S11 to S16 until the generative adversarial network architecture training converges, and obtain the trained threshold prediction subnetwork.

[0073] Specifically, each iteration follows the sequence of "extracting a batch of real samples → fixing the generator and optimizing the discriminator and candidate thresholds → fixing the discriminator and optimizing the generator and prediction sub-networks," ensuring that the alternating optimization of the two types of networks creates continuous game dynamics. During iteration, a dynamic batch adjustment mechanism is introduced, adaptively adjusting the batch sample size based on the loss changes in each training round. For example, when the discriminator loss decreases too quickly, the batch size is appropriately increased to enhance sample diversity and prevent premature convergence of the discriminator, leading to insufficient generalization ability. When the generator loss fluctuates significantly, the batch size is appropriately reduced to improve training stability and help the network quickly find the optimal parameter direction. Simultaneously, the samples extracted in each iteration need to be further refined through stratified sampling. In addition to stratification based on risk labels, secondary stratification is also required according to risk type (production-side risk, market-side risk, policy adjustment risk, external shock risk, etc.) to ensure that each batch of samples covers the typical characteristics of various risk scenarios, enabling the network to comprehensively learn the scenario-threshold mapping rules for different types of risks.

[0074] The judgment of training convergence requires the establishment of a multi-dimensional evaluation index system to avoid judgment bias caused by a single index. The core evaluation indexes include three categories: The first category is the dual-task performance index of the threshold discriminator network, including the accuracy of true / false discrimination and the accuracy of matching reasonableness discrimination. When the accuracy of both types remains stable for multiple rounds on the validation set and reaches the preset performance threshold, it indicates that the discriminator has fully learned the matching rules between real sample features and thresholds. The second category is the generation quality index of the scenario generator network, which is calculated by measuring the feature similarity between the generated pseudo-high-risk future indicator sequence and the real high-risk sequence, and the average deviation between the generated threshold and the real effective threshold. When the feature similarity increases to a reasonable range for multiple rounds and the average deviation decreases to a preset range for multiple rounds, it indicates that the generator can generate high-quality pseudo samples. The third category is the mapping accuracy index of the threshold prediction sub-network, which is calculated by measuring the matching error between real risk scenarios and predicted thresholds in the validation set, and the warning recall and precision based on the predicted thresholds. When the matching error does not decrease significantly for multiple rounds and the warning recall and precision remain at a high level, it indicates that the prediction sub-network has accurate scenario-threshold mapping capabilities. Convergence determination requires that three types of indicators reach a stable state simultaneously, and the number of consecutive iterations is not less than the preset minimum number of iterations, so as to avoid premature termination of training due to accidental fluctuations.

[0075] A dynamic learning rate adjustment strategy and an early stopping mechanism are introduced during iterative training to improve training efficiency and avoid overfitting. The learning rate adjustment employs an exponential decay strategy, gradually reducing the learning rate based on the number of iterations. The initial learning rate is set based on the network parameter size and sample feature dimensions. Subsequent learning rates are adjusted by a fixed decay coefficient after each preset decay period, ensuring rapid convergence in the early stages of training and precise parameter fine-tuning in later stages. The early stopping mechanism monitors the overall performance metrics on the validation set. When the overall performance metrics show a continuous downward trend for several iterations, early stopping protection is triggered, stopping iterative training and backtracking to the network parameters of the iteration with the best overall performance, preventing the model from experiencing a decline in generalization ability due to overtraining. Simultaneously, a snapshot of the network parameters is saved after each iteration, recording various evaluation metrics for the current iteration, facilitating model performance backtracking and parameter optimization analysis after training.

[0076] Once the iterative training meets the convergence condition, the execution of the loop from S11 to S16 is stopped. At this point, the threshold prediction subnetwork has completed the entire co-training process, and its internal parameters have fully learned the mapping relationship between different agricultural risk scenarios and the optimal warning threshold. When obtaining the trained threshold prediction subnetwork, its complete network structure and parameter configuration need to be separated and saved, including the hierarchical structure of the LSTM encoder, the configuration of hidden units, the number of heads and dimension settings of the attention mechanism, the hierarchy and output dimension of the fully connected threshold generation branch, etc. At the same time, the normalization parameters (minimum and maximum values ​​of each indicator) during the data preprocessing process should be recorded to ensure that the data format can be consistently converted in subsequent practical applications. The trained threshold prediction subnetwork needs to undergo final performance verification through an independent test set. The test set should include historical risk scenario samples that were not involved in training and verification, as well as corresponding real and valid early warning thresholds. By calculating the threshold matching error, early warning accuracy, recall, and F1 score on the test set, the generalization ability and practical application effect of the prediction subnetwork are comprehensively evaluated to ensure that it can stably output the optimal early warning threshold that best matches the current scenario in unknown risk scenarios, thus providing reliable technical support for subsequent agricultural industry economic risk early warning.

[0077] In one optional embodiment, the total loss of the threshold discriminator network is calculated based on the discriminant output of the threshold discriminator network for the input of real sample pairs and the input of generated sample pairs, including the following steps:

[0078] S21. Based on the discrimination results of the threshold discriminator network on the first task output head of the input real sample pairs, calculate the adversarial loss. .

[0079] Specifically, the first task output head of the threshold discriminator network focuses on distinguishing between real and generated sample pairs. Its output is a two-dimensional probability distribution vector, corresponding to the predicted probabilities of "real sample pairs" and "generated sample pairs," respectively, satisfying the constraint that the sum of the probabilities is 1. The adversarial loss is designed to measure the discriminator's ability to distinguish between real and generated sample pairs. It uses a binary classification cross-entropy loss function as its computational basis. This function effectively characterizes the difference between the predicted probability distribution and the true label distribution, possessing the characteristics of smooth gradient and ease of optimization. Regarding label setting, the true / false label for real sample pairs is "real," corresponding to a value of 1 for the "real sample pair" dimension and 0 for the "generated sample pair" dimension in the label vector. The true / false label for generated sample pairs is "generated," corresponding to a value of 1 for the "generated sample pair" dimension and 0 for the "real sample pair" dimension in the label vector. The label vector uses one-hot encoding to ensure a perfect match with the probability distribution dimension of the output head. The specific calculation process of adversarial loss needs to be performed in two steps: First, for a batch of real sample pairs, substitute the predicted probability of the first task output head of each sample pair and the corresponding real label vector into the binary classification cross-entropy formula to calculate the adversarial loss component of a single sample pair; Second, perform an arithmetic mean of the adversarial loss components of all real sample pairs within the batch to obtain the adversarial loss corresponding to that batch of samples. Its mathematical expression can be further refined as follows: Where N is the number of true sample pairs in the batch. The true / false label of the i-th real sample pair (with a value of 1). To predict the probability that the i-th sample pair is a "true sample pair" for the discriminator, This loss value is used to predict the probability that the i-th sample pair is a "generated sample pair" for the discriminator. The smaller this loss value, the higher the discriminator's accuracy in recognizing real sample pairs and the stronger its ability to distinguish between real and generated samples. Conversely, a larger loss value indicates that the discriminator has significant room for improvement in the task of distinguishing between real and generated samples.

[0080] S22. Based on the discrimination results of the threshold discriminator network on the second task output head of the generated sample pair input, calculate the threshold matching loss. .

[0081] Specifically, the output head of the second task of the threshold discriminator network focuses on evaluating the reasonableness of the match between the warning threshold and the corresponding risk scenario. Its output is also a two-dimensional probability distribution vector, corresponding to the predicted probabilities of "match" and "mismatch". The core role of the threshold matching loss is to guide the discriminator to learn the inherent adaptation rules between the risk scenario and the warning threshold, enabling the discriminator to accurately identify the warning threshold that truly matches the scenario. It is also calculated using the binary classification cross-entropy loss function. The label setting follows the inherent logic of the sample pairs: for real sample pairs, the effective warning thresholds they contain have been labeled and verified by agricultural economics experts in multiple rounds, and can accurately match the corresponding historical risk scenarios. Therefore, the matching label is "match", and the "match" dimension in the corresponding label vector is 1, while the "mismatch" dimension is 0. For generated sample pairs, their candidate warning thresholds are obtained through constrained random initialization and have not yet been optimized and adjusted. The matching degree with the pseudo-high-risk future indicator sequence is low. Therefore, the matching label is "mismatch", and the "mismatch" dimension in the corresponding label vector is 1, while the "match" dimension is 0. The label encoding format is consistent with the first task to ensure the uniformity of the loss calculation logic. The calculation process for threshold matching loss is similar to that of adversarial loss. First, the matching loss component for each sample pair (including real and generated sample pairs) within the batch is calculated. This involves substituting the second task output probability and the corresponding matching label vector for each sample pair into the binary classification cross-entropy formula. Then, the arithmetic mean of the loss components for all sample pairs is taken to obtain the threshold matching loss for that batch. Its detailed mathematical expression is as follows: , where M is the total number of batch sample pairs (the sum of the number of real sample pairs and the number of generated sample pairs). The true label for the j-th sample pair (the true sample pair has a value of 1, and the generated sample pair has a value of 0). To predict the probability that the j-th sample pair is a "match" for the discriminator, This loss value is used to predict the probability of a "mismatch" for the j-th sample pair in the discriminator. The magnitude of this loss value directly reflects the discriminator's accuracy in judging the threshold-scenario matching relationship. The smaller the loss value, the more accurately the discriminator can identify a reasonable threshold. Conversely, a larger loss value indicates that the discriminator has not yet fully learned the adaptation rules between the threshold and the scenario and needs further optimization.

[0082] S23. The adversarial loss and threshold matching loss are weighted and summed to obtain the total loss of the threshold discriminator network. Total loss The calculation formula is:

[0083]

[0084] in, and These are preset positive weighting coefficients.

[0085] Specifically, by balancing the importance of the two tasks in discriminator training, we ensure that the discriminator can simultaneously improve its ability to distinguish between true and false data and its threshold matching ability, avoiding a single task dominating the training process and causing performance imbalance in the model. The calculation of the total loss follows... ,in and The value is determined through systematic debugging using a validation set, rather than being subjectively set. The specific debugging process can employ a grid search method. and The value range is limited to the interval (0,2]. Several equally spaced value points are divided to construct a weight combination matrix. For each weight combination, a discriminator is trained, and the dual-task accuracy (true / false detection accuracy and matching reasonableness detection accuracy) on the validation set is recorded. Finally, the weight combination that maximizes the weighted average of the dual-task accuracy is selected as the optimal one. and . The larger the value, the higher the proportion of adversarial loss in the total loss, and the more the training process focuses on improving the discriminator's ability to distinguish between true and false targets. The larger the value, the higher the weight of the threshold matching loss, and the more the training process focuses on enhancing the discriminator's accuracy in judging the threshold-context matching relationship. In practical applications, considering that the core of adversarial training is the game between the generator and the discriminator, and threshold matching is the key to overcoming the limitations of traditional static thresholds, this method can... and The value is set to a similar positive number, for example, obtained through a grid search. , or , Combining these elements ensures coordinated optimization of the two tasks. Total loss. The calculation is performed after each batch of samples has been trained. The backpropagation algorithm transforms the total loss into the gradients of the parameters in each layer. All trainable parameters of the discriminator, including convolutional layers, fully connected layers, and BatchNorm layers, are updated along the gradient descent direction. This allows the discriminator to simultaneously improve its dual-task performance in each iteration, providing a reliable discrimination criterion for the subsequent optimization of the scene generator network and the threshold prediction sub-network. Furthermore, a numerical stability guarantee mechanism is introduced during the calculation of the total loss, incorporating a minimum value (e.g., ...) into the logarithmic operation. This avoids the logarithmic meaninglessness problem caused by the predicted probability approaching 0, ensures the continuity and effectiveness of loss calculation, and provides support for stable training of the model.

[0086] In one alternative embodiment, for a set of batch samples, the threshold matching loss... The calculation formula is:

[0087]

[0088] in, This represents the batch size of the samples. Indicates the first Historical indicator sequences of a sample; Indicates the first The true high-risk future indicator sequence corresponding to each sample; Indicates the first Each sample corresponds to an expert-defined threshold; This represents the first scenario generated by the scenario generator network. A pseudo-high-risk future indicator sequence; Indicates the relationship with the first Each generated sample pair is associated with the current candidate warning threshold parameter; This indicates that the output head of the second task of the threshold discriminator network is given a complete sequence of agricultural indicators. Under the given conditions, the evaluation value for the reasonableness of matching the input threshold.

[0089] Specifically, threshold matching loss The core is to quantify the accuracy of the threshold discriminator network in recognizing the matching relationship between "expert threshold and real scenario" and its ability to distinguish the matching relationship between "candidate threshold and pseudo scenario", so as to provide accurate loss feedback for the optimization of discriminator parameters. Its formula design is based on dual-task discrimination logic.

[0090] In the formula, N is the number of samples in the batch, which is adapted to the computing power of the training hardware and the convergence efficiency of the model to ensure the sample diversity and computational feasibility of a single round of training. It is the historical indicator sequence of the i-th sample, covering the four core indicator categories, which, after standardization, provides a historical feature basis for risk scenarios; yes The subsequent evolution of the true high-risk future indicator sequence was confirmed by experts, fully presenting the true risk evolution process; It is experts targeting Effective warning thresholds labeled with real-world scenarios provide an authoritative reference for the rationality of matching; It is a scenario generator based on The generated pseudo-high-risk future indicator sequence simulates the evolution of real risks and contains potential patterns; Is with The bound candidate warning thresholds can be dynamically adjusted after constrained initialization; This is the conditional probability evaluation value output by the discriminator's second task, taking values ​​[0,1]. Values ​​closer to 1 indicate a higher probability of the input threshold being equal to the output threshold. The higher the scenario matching degree.

[0091] The formula focuses on two core discrimination errors: the first term For real sample pairs, because and True match, expectation If the output approaches 1, the logarithm of this term approaches 0, and its contribution to the loss is small; if the discriminator fails to recognize the matching relationship, it indicates a small loss. The output is too small, the logarithm is negative and the absolute value is large, which increases the loss and guides the discriminator to strengthen its ability to identify true matches. (Second term) For the generated sample pairs, because and Low match, expected The output approaches 0. As the logarithm approaches 1, the logarithm of that term approaches 0; if the discriminator misjudges a match, The output is too large. If the value is too small, the logarithm is negative and the absolute value is large, the loss increases, which guides the discriminator to improve the accuracy of distinguishing false matches.

[0092] The two logarithmic results are batch-summed, averaged, and then negativeened to form the final threshold matching loss. The smaller the loss value, the higher the accuracy of the discriminator in judging the matching relationship; conversely, the parameters need to be optimized through gradient backpropagation. The total loss of the discriminator is formed by the weighted sum of this loss and the adversarial loss, which provides a reliable matching judgment standard for the collaborative optimization of the generator and the threshold prediction sub-network, ensuring that the model learns the accurate adaptation rules between the scenario and the threshold.

[0093] In one optional embodiment, the formula for calculating the updated candidate warning threshold parameter is as follows:

[0094]

[0095] in, The current candidate warning threshold parameter, This is the learning rate.

[0096] Specifically, The current candidate warning threshold parameter to be updated is related to the i-th generated sample pair ( The bound vector has the same dimension as the number of core indicators, and the initial value comes from the constrained random initialization and meets the physical meaning constraints of the indicators (such as the price threshold being positive and the ratio threshold being within a reasonable range). The learning rate is a positive coefficient that controls the threshold update step size. Its value directly affects the update stability and convergence efficiency. It needs to be matched with the learning rate of the threshold discriminator network to avoid the threshold oscillation or exceeding the reasonable range due to the step size being too large, and the convergence being too slow due to the step size being too small. Logarithmic terms about The gradient vector, each element of which corresponds to the partial derivative of a candidate threshold for a core indicator, reflects the direction and intensity of the influence of a small change in the threshold on the matching rationality evaluation value. It is still the conditional probability evaluation value output by the second task of the discriminator, representing And pseudo-situations ( The degree of matching.

[0097] The update logic employs a gradient ascent strategy, with the core objective being to maximize... Even if the threshold discriminator determines And pseudo-situations ( The probability of a match is increased. Gradient vector The gradient directly determines the direction of threshold updates: when the gradient is positive, it indicates that increasing the candidate threshold for the corresponding indicator can improve the matching degree, and the threshold will be adjusted in the positive direction; when the gradient is negative, it indicates that decreasing the candidate threshold for the corresponding indicator can improve the matching degree, and the threshold will be adjusted in the negative direction. The magnitude of the absolute value of the gradient reflects the urgency of the adjustment requirement; the larger the absolute value, the greater the deviation between the current threshold and the optimal matching state, and the more important it is to adjust in the corresponding direction.

[0098] Learning rate The value of needs to be determined through validation set testing, and is usually set within a small range to ensure that each update is gradual and to avoid the threshold exceeding a reasonable range due to excessively large step sizes or causing training oscillations. In practice, A dynamic adjustment strategy can be adopted, using a larger value in the early stages of training to accelerate the threshold's convergence to a reasonable range, and then gradually decreasing it in the later stages for precise fine-tuning, maintaining consistency with the learning rate adjustment rhythm of the threshold discriminator network. A reasonableness verification mechanism should be added during the update process to validate the adjusted values. Implement interval constraints to ensure that the thresholds of different types of indicators, such as price and ratio indicators, always conform to their economic meaning and physical attributes, and avoid invalid thresholds.

[0099] The core value of this update mechanism lies in freeing the candidate threshold from a fixed initial state and making it an adaptive parameter that dynamically evolves with adversarial training: by continuously receiving matching feedback from the discriminator, the candidate threshold continuously corrects the adaptation deviation with the pseudo-scenario, making the generated sample pairs ( The quality of the data has gradually improved, providing more challenging training samples for the threshold discriminator and training data that more closely matches the real-world matching relationship for the subsequent collaborative optimization of the scenario generator and the threshold prediction sub-network. Ultimately, this has enabled the entire generative adversarial network architecture to learn the intrinsic mapping pattern between risk scenarios and warning thresholds more accurately.

[0100] The aforementioned method for tracking and early warning of agricultural economic risks based on key indicators constructs training samples by acquiring historical agricultural indicators and expert thresholds. It then builds a generative adversarial network (GAN) containing a scenario generator and a dual-task discriminator. Historical data is input into the generator to obtain pseudo-risk scenarios and candidate thresholds. Real and generated samples are then input into the discriminator for adversarial training. The discriminator simultaneously performs sequence authenticity judgment and threshold-scenario matching rationality judgment. Through iterative optimization, the network learns the complex mapping between agricultural risk scenarios and early warning thresholds, ultimately training a threshold prediction sub-network. In actual early warning, the system predicts future trends based on real-time indicators and assembles them into a complete scenario sequence. Inputting this prediction sub-network dynamically generates the optimal early warning threshold that highly matches the current specific risk scenario. This achieves an adaptive, scenario-sensitive, and intelligent early warning system, effectively overcoming the shortcomings of traditional fixed or simple threshold adjustment methods that are lagging and rigid, significantly improving the accuracy and foresight of agricultural economic risk early warning.

[0101] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0102] Based on the same inventive concept, this application also provides a system for implementing the above-mentioned method for tracking and early warning of agricultural industry economic risks based on key indicators. The solution provided by this system is similar to the solution described in the above method. Therefore, the specific limitations of one or more embodiments of the agricultural industry economic risk tracking and early warning system based on key indicators provided below can be found in the limitations of the method for tracking and early warning of agricultural industry economic risks based on key indicators described above, and will not be repeated here.

[0103] In one exemplary embodiment, such as Figure 3 As shown, an agricultural industry economic risk tracking and early warning system 30 based on key indicators is provided to implement the methods in the above-described embodiments. The system includes:

[0104] The historical risk dataset construction module 31 is used to obtain the historical indicator sequence of agricultural industry economy within a historical time interval, and to mark the high-risk period and corresponding effective warning threshold within the historical time interval in combination with the knowledge of agricultural economic experts; and to construct a historical training sample set based on the historical indicator sequence, high-risk period and corresponding effective warning threshold.

[0105] The adversarial network architecture building module 32 is used to build a generative adversarial network architecture consisting of a scenario generator network and a threshold discriminator network.

[0106] The threshold prediction model training module 33 is used to input historical indicator sequences from the historical training sample set into the scenario generator network of the generative adversarial network architecture, and output pseudo-high-risk future agricultural indicator sequences and corresponding candidate warning thresholds to form generated samples. The real samples and generated samples from the historical training sample set are input into the threshold discriminator network of the generative adversarial network architecture to perform adversarial training on the threshold discriminator network. Through iterative optimization, a threshold prediction sub-network is obtained to map the optimal warning threshold from a given agricultural risk scenario. The threshold discriminator network performs dual-task discrimination: the first task is to determine the authenticity of the input sequence, and the second task is to determine the reasonableness of the matching between the input warning threshold and the corresponding risk scenario. The threshold prediction sub-network is used for collaborative training with the scenario generator network.

[0107] The real-time risk scenario generation module 34 is used to generate a future indicator prediction sequence based on the real-time indicator sequence of the current agricultural industry economy and an agricultural time series prediction model; the real-time indicator sequence and the future indicator prediction sequence are spliced ​​together to form a complete scenario sequence.

[0108] The dynamic early warning decision module 35 is used to input the complete scenario sequence into the threshold prediction subnetwork and output the optimal early warning threshold that matches the current agricultural risk scenario; by comparing the current agricultural indicator value with the optimal early warning threshold, the early warning level of agricultural industry economic risk is obtained.

[0109] Embodiments of this application also provide a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the aforementioned method embodiments.

[0110] Embodiments of this application also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the above-described method embodiments.

[0111] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The components described as separate parts may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this disclosure according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0112] The above-described embodiments are merely illustrative of several implementation methods of the embodiments of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of the patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the embodiments of this application, and these modifications and improvements all fall within the protection scope of the embodiments of this application.

Claims

1. A key indicator-based agricultural industry economic risk tracking and early warning method, characterized in that, The method comprises: S1, obtaining a historical index sequence of an agricultural industry economy in a historical time interval, and combining agricultural economic expert knowledge to mark a high-risk period and a corresponding effective early warning threshold value in the historical time interval; constructing a historical training sample set according to the historical index sequence, the high-risk period and the corresponding effective early warning threshold value; S2, constructing a generative adversarial network architecture composed of a scenario generator network and a threshold discriminator network; S3, inputting the historical index sequence in the historical training sample set into the scenario generator network of the generative adversarial network architecture, outputting a pseudo-high-risk future agricultural index sequence and a corresponding candidate early warning threshold value to form a generated sample; inputting the real sample in the historical training sample set and the generated sample into the threshold discriminator network of the generative adversarial network architecture, performing adversarial training on the threshold discriminator network, and obtaining a threshold predictor network for mapping the optimal early warning threshold value from a given agricultural risk scenario through iterative optimization; wherein the threshold discriminator network performs double-task discrimination, the first task discriminates the authenticity of the input sequence, and the second task discriminates the matching appropriateness of the input early warning threshold value and the corresponding risk scenario, and the threshold predictor network is used for collaborative training with the scenario generator network; S4, based on a real-time index sequence of a current agricultural industry economy, using an agricultural time series prediction model to generate a future index prediction sequence; splicing the real-time index sequence and the future index prediction sequence to form a complete scenario sequence; S5, inputting the complete scenario sequence into the threshold predictor network to output an optimal early warning threshold value matched with the current agricultural risk scenario; obtaining an agricultural industry economic risk early warning grade by comparing the current agricultural index value with the optimal early warning threshold value.

2. The method of claim 1, wherein, The S3 comprises: S11, extracting a batch of samples from the historical training sample set to obtain a batch of real sample sets composed of multiple samples; S12, fixing the parameters of the scenario generator network, inputting all historical index sequences in the batch of real sample sets into the scenario generator network, generating a batch of corresponding pseudo-high-risk future index sequences, and initializing a dynamically adjustable candidate early warning threshold value parameter set for the pseudo-high-risk future index sequences; S13, inputting the batch of real sample sets as real sample pairs, and inputting a combination composed of the historical index sequences, the pseudo-high-risk future index sequences and the parameters in the candidate early warning threshold value parameter set as generated sample pairs; S14, inputting the real sample pair input and the generated sample pair input into the threshold discriminator network together, calculating the total loss of the threshold discriminator network according to the discrimination output of the threshold discriminator network on the real sample pair input and the generated sample pair input; update the parameters of the threshold discriminator network by minimizing the total loss, and update the candidate early warning threshold value parameter set synchronously; S15, fix the parameters of the threshold discriminator network, extract another batch of historical index sequences, generate a batch of new pseudo-high-risk future index sequences through the scenario generator network, and generate a corresponding set of proposed early warning threshold values for the new pseudo-high-risk future index sequences using the threshold predictor network; S16, combine the other batch of historical index sequences, the new pseudo-high-risk future index sequences and the corresponding set of proposed early warning threshold values into a new generated sample pair input set; input the new generated sample pair input set into the threshold discriminator network with fixed parameters, calculate the generation loss of the scenario generator network according to the discrimination output of the threshold discriminator network on the new generated sample pair input set, and update the parameters of the scenario generator network and the threshold predictor network by minimizing the generation loss; S17, repeat steps S11 to S16 until the generative adversarial network architecture training converges, and obtain the trained threshold predictor network.

3. The method of claim 2, wherein, The total loss of the threshold discriminator network is calculated according to the discrimination output of the threshold discriminator network on the real sample pair input and the generated sample pair input, including: S21、according to the threshold discriminator network, the first task output head of the real sample pair input discriminant result, calculate the loss of confrontation ; S22、According to the threshold discriminator network, the discrimination result of the second task output head input by the generated sample pair is calculated to obtain a threshold matching loss ; S23. The adversarial loss and the threshold matching loss are weighted and summed to obtain the total loss of the threshold discriminator network. The total loss The calculation formula is: wherein, and are preset positive weight coefficients.

4. The method of claim 3, wherein, For a set of batch samples, the threshold matching loss is calculated as: wherein, is a batch size of samples; denotes a history indicator sequence of the th sample; denotes a real high-risk future indicator sequence corresponding to the th sample; denotes an expert-set threshold value corresponding to the th sample; denotes a pseudo high-risk future indicator sequence generated by the scenario generator network for the th sample; denotes a current candidate early-warning threshold parameter associated with the th generated sample pair; denotes a fitness evaluation value of the threshold discriminator network second task output head for an input threshold value given a complete agricultural indicator sequence pair .

5. The method of claim 4, wherein, The calculation formula for updating the candidate early warning threshold parameters is: wherein, is the current candidate early warning threshold parameter, is the learning rate.

6. A key indicator-based agricultural industry economic risk tracking and early warning system for implementing the method of any one of claims 1 to 5, characterized in that, The system comprises: A historical risk data set construction module is configured to obtain historical index sequences of an agricultural industry economy in a historical time interval, and label high-risk periods and corresponding effective early warning threshold values in the historical time interval in combination with agricultural economic expert knowledge; and construct a historical training sample set according to the historical index sequences, the high-risk periods and the corresponding effective early warning threshold values; An adversarial network architecture construction module is configured to construct a generative adversarial network architecture composed of a scenario generator network and a threshold discriminator network; A threshold prediction model training module is configured to input the historical index sequences in the historical training sample set into the scenario generator network of the generative adversarial network architecture, output pseudo-high-risk future agricultural index sequences and corresponding candidate early warning threshold values to form generated samples; input real samples and the generated samples in the historical training sample set into the threshold discriminator network of the generative adversarial network architecture, and perform adversarial training on the threshold discriminator network to obtain a threshold predictor network for mapping an optimal early warning threshold from a given agricultural risk scenario through iterative optimization; wherein the threshold discriminator network performs double-task discrimination, the first task discriminates the authenticity of the input sequence, and the second task discriminates the matching appropriateness of the input early warning threshold and the corresponding risk scenario, and the threshold predictor network is used for collaborative training with the scenario generator network; A real-time risk scenario generation module is configured to generate a future index prediction sequence based on a real-time index sequence of a current agricultural industry economy using an agricultural time series prediction model; and splice the real-time index sequence and the future index prediction sequence to form a complete scenario sequence. A dynamic early warning decision module is configured to input the complete scenario sequence into the threshold prediction sub-network, output an optimal early warning threshold matched with the current agricultural risk scenario, and obtain an agricultural industry economic risk early warning grade by comparing a current agricultural index value with the optimal early warning threshold. 7.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is configured to perform the method according to any one of claims 1-6 when the computer program is executed by the processor. The computer program, when executed by the processor, implements the method of any one of claims 1 to 5.

8. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program, when executed by the processor, implements the method of any one of claims 1 to 5.