A soybean early warning system based on multivariate time series interpretable data

By using the TimePro model and counterfactual framework, the problems of insensitive response and training disconnect in soybean price early warning systems when processing diverse time-series data were solved, achieving efficient capture of sudden changes and improved early warning accuracy.

CN122153751APending Publication Date: 2026-06-05NORTHWEST A & F UNIV +2

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NORTHWEST A & F UNIV
Filing Date
2026-05-09
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing soybean price early warning systems cannot effectively distinguish between regular and sudden components when processing multivariate time-series data, resulting in insensitive responses, a disconnect between preprocessing and training, a lack of feature feedback mechanisms, and an inability to iteratively optimize, thus affecting the accuracy of early warnings.

Method used

The TimePro model is used for pre-training, and the accuracy of the warning status is verified by combining the time-series sliding window dataset and the warning status. Effective counterfactual samples are generated by the counterfactual loss function and the counterfactual distance perturbation function to locate the anomaly driving features and iteratively optimize the model.

Benefits of technology

It enhances the ability to capture sudden changes, dynamically adapts to the distribution of input data and model training, and achieves high response sensitivity and accuracy of the early warning system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122153751A_ABST
    Figure CN122153751A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of time series data processing, and discloses a soybean early warning system based on multivariate time series interpretable data, which solves the technical problems that, in the prior art, a multivariate time series prediction model has a lagging response to sudden fluctuations, data distribution deviation is caused by disconnection between preprocessing and training, and an abnormal early warning lacks a feature feedback mechanism and cannot iteratively optimize a model. The TimePro model of the application processes time series data in parallel, efficiently captures dynamic dependence and time delay differences between target time series features and covariant time series features, introduces an counterfactual framework, constructs a target programming function from a counterfactual loss function, a counterfactual distance disturbance function and a counterfactual diversity function to generate effective counterfactual samples, and realizes the dual goals of accurate positioning of abnormal driving features and self-iteration of the model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of time series data processing technology, and in particular to a soybean early warning system based on multivariate time series interpretable data. Background Technology

[0002] Time series data are data streams collected sequentially at different points in time, and are widely used in industrial sensing and monitoring, network traffic analysis, and scientific computing. With the development of deep learning technology, using deep neural networks to infer future trends from multivariate time series data has become a research hotspot in the field of data science.

[0003] As soybean price data is a multivariate time-series data, existing soybean early warning systems typically use a uniform feature extraction structure to process all input data. When the data contains both gradually changing, regular components and sudden, rapidly changing components, the indiscriminate processing can easily dilute the signal of the sudden components during multi-layer network computation, resulting in insufficient sensitivity of the early warning system to data inflection points and inaccurate prediction results reflecting sudden, drastic changes. Missing value imputation methods and sliding window truncation lengths are usually pre-set based on experience and are not adjusted according to model training. This causes a deviation between the distribution characteristics of the input data and the distribution pattern that best fits the model during actual training, affecting the accuracy of the early warning system in fitting time-series dependencies. When existing soybean early warning systems detect abnormal fluctuations, they can only output warning signals and cannot locate the key features causing the anomalies, nor can they quantify the degree of disturbance of each feature to the abnormal results. This prevents the soybean early warning system from iteratively optimizing the model through key features and further improving the early warning accuracy. Summary of the Invention

[0004] The purpose of this invention is to address the problems in existing soybean price early warning systems, such as the lag in response to sudden fluctuations by the multivariate time-series prediction model, the disconnect between preprocessing and training leading to data distribution bias, and the lack of a feature feedback mechanism for abnormal early warnings, which prevents iterative optimization of the model. The invention provides a soybean early warning system based on multivariate time-series interpretable data.

[0005] To achieve the above-mentioned objectives, the embodiments of the present invention provide the following technical solutions:

[0006] A soybean early warning system based on multivariate time-series interpretable data includes a data acquisition module, a model pre-training module, an early warning time series generation module, a target sample generation module, an effective counterfactual sample generation module, and an iterative optimization module.

[0007] The data acquisition module collects the time-series features of soybeans to be predicted and the time-series features of covariates, and performs preprocessing on the time-series features to be predicted and the time-series features of covariates to be predicted by filling in missing values ​​and truncating by sliding window to form a time-series sliding window dataset.

[0008] The model pre-training module creates a TimePro model based on the input layer, feature embedding layer, feature interaction layer and output layer, and pre-trains the TimePro model using a time-series sliding window dataset.

[0009] The early warning time series generation module inputs the time series sliding window dataset into the trained TimePro model. The TimePro model outputs soybean price prediction values. Based on the accuracy of the early warning state between the soybean price prediction values ​​and the actual soybean price values, it determines whether to retrain the TimePro model. If retraining is not performed, a historical early warning time series result table of the time series sliding window dataset is generated.

[0010] The target sample generation module defines a quantitative index for early warning intensity, and uses this index to filter out target samples for counterfactual interpretation from the historical early warning time series result table.

[0011] The effective counterfactual sample generation module obtains the target feature matrix through the target sample, constructs a target planning function by the counterfactual loss function, the counterfactual distance perturbation function and the counterfactual diversity function, selects the current optimal sample through the target planning function, generates new candidate samples through constraint filtering and performs iterative loop to obtain effective counterfactual samples;

[0012] The iterative optimization module determines the adjustment magnitude weight and prediction sensitivity of the covariate time series features by adjusting the effective counterfactual samples and the target samples, locates the anomaly driving features, and iteratively optimizes the TimePro model using the anomaly driving features.

[0013] To address the technical problem that existing model feature extraction structures lack the ability to process signals with different fluctuation characteristics separately, resulting in insufficient sensitivity to data inflection points, this invention collects target time-series features and covariate time-series features, performs missing value completion and sliding window truncation preprocessing to form a time-series sliding window dataset, constructs a TimePro model and pre-trains it on this dataset, and combines an early warning state accuracy verification mechanism to determine whether to retrain, effectively improving the model's ability to capture sudden changes.

[0014] To address the technical problem in existing technologies where data preprocessing strategies are disconnected from the model training process, resulting in a deviation between the distribution characteristics of input data and the model's fit, this invention addresses this issue by standardizing the preprocessing of time-series sliding window datasets and incorporating feedback adjustments based on the accuracy verification results of early warning states during model training. This allows the input data distribution to dynamically adapt to the model training process, thereby improving the fitting accuracy of time-series dependencies.

[0015] To address the technical problem in existing technologies where models lack a feature feedback mechanism when detecting abnormal fluctuations, making it impossible to locate abnormal driving features and iteratively optimize the model accordingly, this invention introduces a counterfactual interpretable framework. It defines a quantitative index for warning intensity to screen target samples, obtains a target feature matrix from the target samples, constructs a target programming function, obtains effective counterfactual samples through constraint filtering and iterative iteration, determines the adjustment magnitude weights of the covariate time series features, locates the abnormal driving features, and feeds the abnormal driving features back to the TimePro model for iterative optimization.

[0016] Compared with the prior art, the beneficial effects of the present invention are as follows: the soybean early warning system achieves separate processing of regular components and sudden components through the branch feature extraction structure of the TimePro model, thereby improving the response sensitivity to data inflection points; through the linkage mechanism of preprocessing and training processes, the distribution of input data is dynamically adapted to model training, thereby improving the fitting accuracy of time-series dependencies; and through the generation of effective counterfactual samples by the counterfactual framework, the abnormal driving features are located and the TimePro model is driven to iteratively optimize, thereby achieving continuous improvement in early warning accuracy.

[0017] Furthermore, a soybean early warning system based on multivariate time-series interpretable data, wherein the data acquisition module includes a feature determination submodule, a missing value processing submodule, and a missing value verification submodule;

[0018] The feature determination submodule determines the time-series features to be predicted for soybeans and the time-series features of covariates. The time-series features to be predicted for soybeans are soybean prices, and the time-series features of covariates include soybean meal prices, soybean oil prices, and port soybean inventory. ;

[0019] The missing value processing submodule collects the time-series features and covariate time-series features of soybeans to be predicted from multiple trading days, groups the time-series features and covariate time-series features of soybeans to be predicted by each trading day, integrates multiple sets of trading data, processes the missing values ​​of multiple sets of trading data, fills in the missing time-series data, and forms a time-series dataset.

[0020] The missing value verification submodule extracts sliding window samples from the continuous time-series dataset using feature windows and target values, performs missing value verification on the feature windows and target values ​​of all sliding window samples, and forms a time-series sliding window dataset after verification.

[0021] In the above scheme, the feature determination submodule identifies the time-series characteristics of soybeans to be predicted and the time-series characteristics of core covariates, collects transaction data from multiple trading days and performs missing value completion processing, and then uses the missing value processing submodule to perform sliding window truncation and missing value verification to form a time-series sliding window dataset. This solves the technical problems of messy variable selection, incomplete time-series data, and insufficient sample validity in traditional data preprocessing, which lead to low accuracy of subsequent model training and large warning bias. The present invention accurately selects key variables, combines dual missing value processing (completion + verification) with sliding window truncation, ensures the integrity, validity and relevance of time-series data, provides high-quality data support for TimePro model pre-training, and thus improves the accuracy of model prediction and warning. Overall, it achieves optimization at the soybean price warning data level and lays a reliable foundation for subsequent warning results.

[0022] Furthermore, a soybean early warning system based on multivariate time-series interpretable data is provided. The TimePro model includes an input layer, a feature embedding layer, a feature interaction layer, and an output layer. The output of the input layer is connected to the input of the feature embedding layer, the output of the feature embedding layer is connected to the input of the feature interaction layer, and the output of the feature interaction layer is connected to the input of the output layer.

[0023] In the above scheme, this invention constructs a hierarchical TimePro model comprising an input layer, a feature embedding layer, a feature interaction layer, and an output layer. By adopting an architecture design where each layer is sequentially connected, it solves the technical problems of traditional models, such as disjointed feature processing, inefficiency in capturing multivariate temporal dependencies, leading to low prediction accuracy and poor computational efficiency. This invention clearly defines the connection relationships between each layer and has a well-defined hierarchical design, achieving efficient end-to-end processing of time-series data from input and feature processing to prediction output. This improves the targeting of feature extraction and interaction, effectively capturing the dynamic correlation between soybean prices and various influencing factors, and overall improving the model's computational efficiency and prediction accuracy, providing reliable model support for subsequent early warning.

[0024] Furthermore, in a soybean early warning system based on multivariate time-series interpretable data, the processing procedure of the TimePro model is as follows:

[0025] The input layer performs instance normalization on the temporal sliding window data and outputs the temporal feature sequence to the feature embedding layer.

[0026] The feature embedding layer splits the time-series feature sequence by dimension into soybean meal price sequence, soybean oil price sequence, and port soybean inventory sequence. The soybean meal price sequence, soybean oil price sequence, and port soybean inventory sequence are then spliced ​​together after being overlapped and linearly mapped, to obtain the embedding matrix, which is then output to the feature interaction layer.

[0027] The feature interaction layer performs cross-variable and cross-temporal interactions on the embedding matrix through sequentially stacked ProBlock modules, and outputs enhanced interactive features to the output layer;

[0028] The output layer flattens the enhanced interactive features and converts them into 1D vector features. The 1D vector features are then mapped to single-valued normalized predicted values. The normalized predicted values ​​are then denormalized using the mean μ and standard deviation σ to obtain the soybean price prediction.

[0029] In the above scheme, this invention uses a refined processing flow of each layer of the TimePro model. The input layer normalizes instances to unify the data scale, the feature embedding layer splits sequences and concatenates them after overlapping patches and linear mapping, the feature interaction layer realizes cross-variable and cross-time interaction through the ProBlock module, and the output layer completes feature transformation and inverse normalization to output predicted values. This solves the technical problems of traditional models, such as coarse time series data processing, insufficient multi-variable interaction, and large deviation between predicted values ​​and actual prices. The coordinated cooperation of the refined processing steps of each layer of this invention effectively unifies the data scale, fully explores the temporal correlation and interaction relationship between multiple variables, improves the accuracy of predicted values, makes the predicted results more consistent with the actual soybean price, further improves the predictive performance of the model, and provides accurate predictive basis for subsequent early warning judgments.

[0030] Furthermore, a soybean early warning system based on multivariate time-series interpretable data, wherein the early warning time series generation module specifically comprises:

[0031] The target value is obtained by using the historical price series of soybeans over T historical trading days. The dynamic early warning threshold range is defined by the following formula:

[0032] ;

[0033] in, The minimum warning threshold, The maximum warning threshold, Let T be the average price of soybeans over historical trading days. The standard deviation of soybeans over T historical trading days;

[0034] Using a trained TimePro model, inference is performed on a time-series sliding window dataset to obtain soybean price predictions through forward propagation and inverse normalization. ;

[0035] Based on the soybean price forecast for T+1 trading day The relationship between the dynamic early warning threshold range and the early warning status is used to mark the early warning status:

[0036] like If so, it will be marked as a surge warning status;

[0037] like If so, it will be marked as a sharp reduction warning status;

[0038] like If so, it is marked as normal.

[0039] Record the timestamp, alert status, and soybean price forecast for each time-series sliding window data point. The system generates a historical early warning time series result table by using the dynamic early warning threshold range, the average and standard deviation of soybeans over T historical trading days.

[0040] Based on the actual value of soybeans on T+1 trading day The accuracy of the warning status is determined by the dynamic warning threshold range, if the actual value of soybeans... And soybean price forecast If the warning status is consistent, the warning is accurate. If the warning accuracy of the time-series sliding window dataset is less than 90%, the TimePro model should be retrained and iterated for optimization.

[0041] In the above scheme, the early warning time series generation module dynamically calculates the early warning threshold range based on historical trading day data. Combined with the early warning status accuracy judgment mechanism of model prediction value and actual value, it realizes the iterative optimization of the TimePro model. This solves the technical problems of fixed early warning thresholds in traditional early warning methods, which cannot adapt to dynamic market changes, and the lack of effective feedback on model training effects, which makes it difficult to guarantee the accuracy and timeliness of early warnings. This invention constructs a model iterative optimization module that combines dynamic threshold calculation and early warning status accuracy evaluation. It can adaptively adjust the early warning standard according to the historical fluctuation pattern of soybean prices, and drive the optimization of model parameters through continuous accuracy verification. This significantly improves the dynamic adaptability and accuracy of soybean price early warning, effectively reduces early warning lag and false alarm rate, and realizes the self-evolution and continuous performance improvement of the early warning model.

[0042] Furthermore, a soybean early warning system based on multivariate time-series interpretable data includes a target sample generation module comprising an early warning state definition submodule, a target sample determination submodule, and a target sample verification submodule.

[0043] The warning status submodule defines a warning intensity quantification index S, with the following formula:

[0044] For time-series sliding window data with a warning status of "surge in warning status" ;

[0045] For time-series sliding window data with a warning status of "drastic reduction warning status". ;

[0046] in, The minimum warning threshold, The maximum warning threshold, This is a forecast for soybean prices;

[0047] The target sample determination submodule filters time-series sliding window data with alarm states showing a sharp increase or decrease from the historical alarm time-series result table. The time-series sliding window data is then sorted in descending order according to the alarm intensity quantification index. The time-series sliding window data ranked first is determined as the target sample for counterfactual interpretation. The target sample includes a feature window. Forecast of soybean prices for T+1 trading day Dynamic early warning threshold range, quantitative indicators of early warning intensity, and early warning status;

[0048] The target sample verification submodule checks the feature window of the target sample. Does it contain missing values? And check the soybean price forecast for the target sample on trading day T+1. If any outliers are found, and if any missing values ​​or outliers are found, the second-ranked time-series sliding window data is selected as the target sample, and the presence of missing values ​​or outliers is checked again until it is determined that there are no missing values ​​and no outliers are found in the target sample.

[0049] In the above scheme, this invention defines a quantitative index for warning intensity, filters time-series sliding window data of sharply increasing and sharply decreasing warning states, and sorts them according to warning intensity. It combines missing values ​​and extreme outliers for dual verification to select target samples, thus solving the technical problem of blind and insufficiently effective target sample selection in counterfactual interpretation, which leads to large biases in subsequent counterfactual analysis and inability to accurately locate anomaly-driving features. This invention, through the combination of warning intensity quantification, ordered sorting, and dual verification, ensures the relevance, effectiveness, and reliability of target samples, providing high-quality sample support for subsequent effective counterfactual sample generation and anomaly-driving feature localization, improving the accuracy of counterfactual analysis, and ensuring the traceability of anomaly-driving feature extraction.

[0050] Furthermore, in a soybean early warning system based on multivariate time-series interpretable data, the objective programming function construction submodule is composed of a counterfactual loss function, a counterfactual distance perturbation function, and a counterfactual diversity function, as shown in the following formula:

[0051] ;

[0052] Where argmin is the argmin function, j=1,2,…,k, j is the j-th generated counterfactual, and k is the total number of generated counterfactuals. For counterfactual loss function, For counterfactual characteristic values, The counterfactual distance perturbation function reflects the counterfactual eigenvalues. and original eigenvalues distance, , These are the weighting coefficients. Let c be the counterfactual diversity function, reflecting the diversity of k generating counterfactual features c. Counterfactual features reflect the original feature values. The perturbed eigenvalues Let be the objective programming function generated by the counterfactual method at time step t.

[0053] In the above solution, this invention deeply integrates the counterfactual interpretability framework with the TimePro model, achieving a dual improvement in the accuracy of anomaly state judgment and the model's self-iterative capability. It solves the technical problem that traditional counterfactual analysis methods are independent of the prediction model and cannot be effectively coupled with multivariate time-series prediction scenarios, leading to a disconnect between the counterfactual sample generation results and the model's prediction logic, making it difficult to drive targeted model optimization. This invention tightly connects the counterfactual analysis module with the prediction output of the TimePro model, using the model's prediction results as a basis for counterfactual sample generation and anomaly-driven feature localization. This ensures the consistency between the counterfactual samples and the internal operational logic of the prediction model, and feeds back the located anomaly-driven features to the TimePro model training stage for iterative optimization, constructing a closed-loop mechanism of prediction-feedback-optimization. This effectively improves the model's continuous learning ability and judgment stability regarding anomaly fluctuation patterns.

[0054] Furthermore, in a soybean early warning system based on multivariate time-series interpretable data, the formula for the counterfactual loss function is as follows:

[0055] ;

[0056] Specifically, when the expected counterfactual state is the normal state, When the expected counterfactual state is a surge warning state, When the expected counterfactual state is a sharp reduction warning state, .

[0057] Furthermore, a soybean early warning system based on multivariate time-series interpretable data includes an iterative optimization module comprising a relative adjustment amount acquisition submodule, an adjustment amount direction acquisition submodule, an anomaly-driven feature acquisition submodule, and an update model submodule.

[0058] The relative adjustment acquisition submodule calculates the relative adjustment of the covariate temporal features at each time step in each valid counterfactual sample and target sample;

[0059] The adjustment direction acquisition submodule calculates the adjustment correlation coefficient between the time series features of the covariates and analyzes the adjustment direction relationship of the adjustment correlation coefficient.

[0060] The anomaly driving feature acquisition submodule obtains the adjustment magnitude weight and prediction sensitivity based on the adjustment direction relationship and relative adjustment amount of the counterfactual samples, and obtains and verifies the anomaly driving features for soybean price anomaly early warning.

[0061] The updated model submodule updates the TimePro model weights and dynamic early warning threshold ranges through anomaly-driven features.

[0062] In the above scheme, this invention decomposes the iterative optimization module into a relative adjustment amount acquisition submodule, an adjustment amount direction acquisition submodule, an anomaly driving feature acquisition submodule, and a model update submodule. These submodules work collaboratively to calculate the relative adjustment amounts of the covariate time-series features in the effective counterfactual samples and the target samples at each time step. They analyze the correlation coefficients and adjustment direction relationships between the adjustment amounts of the covariate time-series features, and combine the adjustment direction relationship with the relative adjustment amount to obtain the adjustment magnitude weights and predictive sensitivity. This allows for the location of anomaly driving features, and the TimePro model weights and dynamic warning threshold range are updated using these anomaly driving features. This solves the technical problem of existing warning systems that can only output abnormal state indication signals but cannot locate anomaly driving features and iteratively optimize the model accordingly. This invention refines the iterative optimization module into four submodules, achieving multi-dimensional analysis and feature perturbation quantification of effective counterfactual samples through multi-module collaboration. This accurately locates anomaly driving features and feeds them back to the model training stage for weight updates and threshold adjustments, constructing a closed-loop optimization mechanism from feature location to model update, thus improving the self-iterative capability of the warning system. Attached Figure Description

[0063] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0064] Figure 1 This is a structural diagram of a soybean early warning system based on multivariate time-series interpretable data.

[0065] Figure 2 This is a schematic diagram of the TimePro model.

[0066] Figure 3 This is a schematic diagram of the feature embedding layer.

[0067] Figure 4 This is a structural diagram of the ProBlock module.

[0068] Figure 5 This is a structural diagram of the TimeFFN module. Detailed Implementation

[0069] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.

[0070] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this invention, the terms "first," "second," etc., are used only for distinguishing descriptions and should not be construed as indicating or implying relative importance, or suggesting any such actual relationship or order between these entities or operations. Additionally, the terms "connected," "linked," etc., can refer to a direct connection between elements or an indirect connection via other elements.

[0071] It should be noted that those prefixed with "overlapping patch" are all overlapping patch partitioning modules with the same structure, those prefixed with "fully connected" are all fully connected layers with the same structure, those prefixed with "LayerNorm" are all LayerNorm layers with the same structure, and those prefixed with "Conv1d" are all Conv1d layers with the same structure. The numbers such as "1, 2, 3" are added after the prefix only to distinguish the connection relationship.

[0072] This invention is achieved through the following technical solutions, such as... Figure 1 As shown, a soybean early warning system based on multivariate time-series interpretable data includes a data acquisition module, a model pre-training module, an early warning time series generation module, a target sample generation module, an effective counterfactual sample generation module, and an iterative optimization module.

[0073] The data acquisition module collects the time-series characteristics of soybeans to be predicted. Time-series characteristics of covariates For predicting time series features Time-series characteristics of covariates Preprocessing steps, including missing value completion and sliding window truncation, are performed to form a time-series sliding window dataset.

[0074] Specifically, the data acquisition module includes a feature identification submodule, a missing value handling submodule, and a missing value verification submodule.

[0075] The feature determination submodule determines the time-series features of soybeans to be predicted. Time-series characteristics of covariates The time-series characteristics of the soybean to be predicted For soybean prices, the time-series characteristics of the covariates Including soybean meal prices Soybean oil price Port soybean inventory .

[0076] The missing value processing submodule collects the time-series features of soybeans to be predicted from multiple trading days. Time-series characteristics of covariates The time-series characteristics of soybeans to be predicted Time-series characteristics of covariates The data is grouped by each trading day, and multiple sets of trading data are integrated. Missing values ​​in the multiple sets of trading data are processed to fill in the missing time series data, forming a time series dataset.

[0077] Specifically, missing value handling is performed as follows:

[0078] If there are missing values ​​in the transaction data of group t, they are filled by the same variable data of group t-1; if the same variable data of group t-1 is still missing, it is filled by the same variable data of group t+1; if the same variable data of both groups t-1 and t+1 are missing, the transaction data of group t is deleted directly.

[0079] The missing value verification submodule uses feature windows to extract data from continuous time-series datasets. and target value Extract sliding window samples, and extract the feature windows of all sliding window samples. and target value Missing values ​​are checked, and the results are used to form a time-series sliding window dataset.

[0080] Specifically, the missing value validation submodule constructs a feature window from the covariate time-series features X of soybeans over T consecutive trading days. The T=30 refers to the price of soybean meal over 30 trading days. Soybean oil price Port soybean inventory A three-dimensional array of shape [30, 3] is defined as a feature window. Predictable time series characteristics of soybeans in the T+1 trading day Target value A sliding window approach is used to extract features from the time-series dataset. and target value The sliding window samples consist of a total of N-30 trading days (time steps); the feature windows of all sliding window samples are... and target value Perform missing value validation. If missing values ​​are found, return to the missing value processing submodule to re-process the missing values ​​until the feature windows of all sliding window samples are identified. and target value There are no missing values. Once there are no missing values, all sliding window samples are integrated to form a time-series sliding window dataset.

[0081] The model pre-training module creates a TimePro model based on the input layer, feature embedding layer, feature interaction layer and output layer, and pre-trains the TimePro model using a time-series sliding window dataset.

[0082] The TimePro model includes an input layer, a feature embedding layer, a feature interaction layer, and an output layer.

[0083] Specifically, the connection structure of the TimePro model is as follows:

[0084] The output of the input layer is connected to the input of the feature embedding layer, the output of the feature embedding layer is connected to the input of the feature interaction layer, and the output of the feature interaction layer is connected to the input of the output layer.

[0085] Specifically, the processing procedure of the input layer is as follows:

[0086] The input layer performs instance normalization on the temporal sliding window data and outputs the temporal feature sequence to the feature embedding layer.

[0087] Specifically regarding soybean meal prices Soybean oil price Port soybean inventory Target value A reversible instance normalization operation is performed uniformly to eliminate the influence of different units of measurement (e.g., soybean meal price is in yuan / ton, inventory is in 10,000 tons) and data distribution bias, unifying all variables to a standard distribution range with zero mean and unit variance. The input layer also retains data from each time-series sliding window (soybean meal price). Soybean oil price Port soybean inventory Target value The mean μ and standard deviation σ of the current sample window.

[0088] It is important to note that the patch length is 5, meaning each patch contains 5 consecutive time steps, and the overlap rate is 0.5, meaning adjacent patches overlap by 2 time steps. Taking the soybean meal price sequence (30, 1) as an example, after the overlapping patch division module is processed, it calculates (30-5) / (5×0.5)+1=11, generating 11 consecutive patches. Each patch is a subsequence of length 5, i.e., the soybean meal price vector (11, 5). In (30, 1), 30 is the price sequence of 30 trading days, and 1 is the number of covariate time series features.

[0089] Specifically, the feature embedding layer includes a feature separator, an overlapping patch partitioning module, a fully connected layer, and a feature concatenation layer; the overlapping patch partitioning module includes overlapping patch partitioning module 1, overlapping patch partitioning module 2, and overlapping patch partitioning module 3; the fully connected layer includes fully connected layer 1, fully connected layer 2, and fully connected layer 3.

[0090] The connection structure of the feature embedding layer is as follows: the first output of the feature separator is connected to the input of the overlapping patch partitioning module 1; the second output of the feature separator is connected to the input of the overlapping patch partitioning module 2; the third output of the feature separator is connected to the input of the overlapping patch partitioning module 3; the output of the overlapping patch partitioning module 1 is connected to the input of the fully connected layer 1; the output of the overlapping patch partitioning module 2 is connected to the input of the fully connected layer 2; the output of the overlapping patch partitioning module 3 is connected to the input of the fully connected layer 3; the output of the fully connected layer 1 is connected to the first input of the feature splicing layer; the output of the fully connected layer 2 is connected to the second input of the feature splicing layer; and the output of the fully connected layer 3 is connected to the third input of the feature splicing layer.

[0091] Specifically, the processing of the feature embedding layer is as follows: the feature embedding layer splits the time-series feature sequence by dimension into soybean meal price sequence, soybean oil price sequence, and port soybean inventory sequence. The soybean meal price sequence, soybean oil price sequence, and port soybean inventory sequence are then spliced ​​together after being overlapped and linearly mapped to obtain the embedding matrix, which is then output to the feature interaction layer.

[0092] More specifically, the time-series feature sequence (30,3) is input into the feature separator and split into soybean meal price sequence (30,1), soybean oil price sequence (30,1), and port soybean inventory sequence (30,1) according to the dimension, and output to the overlapping patch partitioning module 1, overlapping patch partitioning module 2, and overlapping patch partitioning module 3, respectively.

[0093] The overlapping patch partitioning module uses a patch length of 5 and an overlap rate of 0.5 to convert the soybean meal price sequence (30, 1) into a soybean meal price vector (11, 5), and outputs it to the fully connected layer 1.

[0094] The overlapping patch partitioning module uses a patch length of 5 and an overlap rate of 0.5 to convert the soybean oil price sequence (30, 1) into a soybean oil price vector (11, 5), and outputs it to a fully connected 2-layer layer.

[0095] The overlapping patch partitioning module uses a patch length of 5 and an overlap rate of 0.5 to convert the port soybean inventory sequence (30, 1) into a port soybean inventory vector (11, 5), and outputs it to a fully connected 3-layer layer.

[0096] S223: The fully connected layer 1 linearly projects the soybean meal price vector (11, 5) into a soybean meal price embedding vector (11, 64) through the weight vector (5, 64) and the bias vector (64), and outputs it to the feature splicing layer;

[0097] The fully connected 2-layer linearly projects the soybean oil price vector (11, 5) into a soybean oil price embedding vector (11, 64) through the weight vector (5, 64) and the bias vector (64), and outputs it to the feature concatenation layer.

[0098] The fully connected 3-layer vector linearly projects the port soybean inventory vector (11, 5) into the port soybean inventory embedding vector (11, 64) through the weight vector (5, 64) and the bias vector (64), and outputs it to the feature splicing layer.

[0099] The feature splicing layer splices the soybean meal price embedding vector (11, 64), the soybean oil price embedding vector (11, 64), and the port soybean inventory embedding vector (11, 64) to obtain the embedding matrix (11, 192), which is then output to the feature interaction layer.

[0100] Specifically, the feature interaction layer includes six stacked ProBlock modules; the stacked ProBlock modules are connected in sequence; the feature interaction layer performs cross-variable and cross-time interactions on the embedding matrix through the stacked ProBlock modules, and outputs the enhanced interaction feature (11, 192) to the output layer.

[0101] Specifically, such as Figure 4 As shown, the ProBlock module includes a HyperMamba module, a LayerNorm1 layer, a TimeFFN module, and a LayerNorm2 layer.

[0102] The connection structure of the ProBlock module is as follows: the first input of the ProBlock module is connected to the input of the HyperMamba module; the output of the HyperMamba module is connected to the second input of the ProBlock module, and then residually connected to the input of the LayerNorm1 layer; the first output of the LayerNorm1 layer is connected to the input of the TimeFFN module; and the output of the TimeFFN module and the second output of the LayerNorm1 layer are residually connected to the input of the LayerNorm2 layer.

[0103] Specifically, the processing procedure of the ProBlock module is as follows:

[0104] The input embedding matrix (11, 192) is fed into the HyperMamba module. The HyperMamba module performs a linear transformation on the input embedding matrix (11, 192) to generate a query vector Q (11, 192), a key vector K (11, 192), a value vector V (11, 192), and a gate vector G (11, 192). These are then processed through a dot product. The correlation matrix A(3,3) is obtained by normalizing the variable dimension D=3. The value vector V(11,192) is weighted and fused using the correlation matrix A(3,3). The fused feature (11,192) and the gate vector G(11,192) are multiplied element-wise. The element-wise multiplied feature (11,192) and the embedding matrix (11,192) are residually connected to output the cross-variable interaction feature (11,192) to the LayerNorm1 layer.

[0105] in, As a matrix transpose, the correlation matrix A quantifies soybean meal prices. Soybean oil price Port soybean inventory Interactions and time series characteristics to be predicted Time-series characteristics of covariates The mutual influence between them is used to weight and fuse the value vector V(11,192) using the correlation matrix A(3,3) to make each soybean meal price Soybean oil price Port soybean inventory By incorporating information from the time-series features X of other covariates, the gating vector G controls soybean meal prices through a sigmoid activation function. Soybean oil price Port soybean inventory The contribution weight.

[0106] LayerNorm1 normalizes the intervariate interaction features (11, 192) and outputs the normalized features (11, 192) to the TimeFFN module;

[0107] The TimeFFN module performs convolution operations on the normalized features (11, 192) to capture short-term and long-term temporal correlations, fuses the short-term and long-term temporal correlations to obtain cross-time interaction features, performs residual connections with the normalized features (11, 192), and outputs the interaction fusion features (11, 192) to the LayerNorm2 layer.

[0108] Specifically, such as Figure 5 As shown, the TimeFFN module includes a Conv1d1 layer, a Conv1d2 layer, and a Linear layer;

[0109] The connection structure of the TimeFFN module is as follows: the first input terminal of the TimeFFN module is connected to the input terminal of the Conv1d1 layer, the second input terminal of the TimeFFN module is connected to the input terminal of the Conv1d2 layer, the output terminal of the Conv1d1 layer is connected to the output terminal of the Conv1d2 layer and then connected to the input terminal of the Linear layer, and the output terminal of the Linear layer is connected to the third input terminal of the TimeFFN module.

[0110] Specifically, the processing procedure of the TimeFFN module is as follows:

[0111] The normalized features (11, 192) are input into the Conv1d1 layer and the Conv1d2 layer respectively. The Conv1d1 layer captures the short-term temporal association (association between 3 adjacent patches) of the normalized features (11, 192) through a convolution kernel of size 3, and outputs the short-term temporal association features (11, H).

[0112] Conv1d2 layer captures long-term temporal associations (long-term associations between 2 patches) of the normalized features (11, 192) through a convolution kernel of size 3, and outputs long-term temporal association features (11, H).

[0113] The short-term temporal correlation feature (11, H) and the long-term temporal correlation feature (11, H) are added element by element to obtain the fused temporal correlation feature (11, H). Nonlinearity is introduced through the GeLU activation function, and the activated feature (11, H) is input into the Linear layer.

[0114] The Linear layer maps the dimensions of the activated feature (11, H) back to the original dimensions, and performs residual connections on the output dimension-changing features (11, 192) and the normalized features (11, 192) to obtain the cross-time interaction features (11, 192).

[0115] Where H is the dimension of the hidden layer (e.g., 384 or 768).

[0116] The LayerNorm2 layer normalizes the interaction fusion features (11, 192) and outputs enhanced interaction features (11, 192).

[0117] The output layer flattens the enhanced interaction feature (11, 192) and converts it into a 1D vector feature (2112, 1). This 1D vector feature (2112, 1) is then mapped to a single-valued normalized predicted value. The normalized predicted value is then denormalized using the mean μ and standard deviation σ to obtain the soybean price prediction for trading day T+1. .

[0118] The TimePro model is pre-trained using soybean price forecasts for trading day T+1. The true value of soybeans on T+1 trading day Minimizing the difference between them is the optimization objective; configuration , The AdamW optimizer and maximum training epochs = 50, after 50 training epochs the learning rate drops to The cosine annealing learning rate scheduling strategy introduces an early stopping strategy that terminates training if the loss on the test set does not decrease after 10 consecutive rounds.

[0119] The specific training process of the model pre-training module is as follows:

[0120] Dataset partitioning: The time-series sliding window data was split into training and test sets in an 8:2 ratio according to the time sequence;

[0121] Batch Iterative Training: The training set is input into the TimePro model in batches of 32, and soybean price predictions are calculated through forward propagation. The predicted soybean price for trading day T+1 is calculated using a loss function. The true value of soybean prices on T+1 trading day The loss value;

[0122] Backpropagation optimization: The gradient of the loss value with respect to all trainable parameters of the TimePro model is calculated through backpropagation. The parameters are adjusted using the AdamW optimizer to minimize the loss value. The learning rate is updated after each training round.

[0123] Test set validation: After each round of training, the TimePro model performance is validated using a test set, the test set loss value is calculated, and the model parameters corresponding to the minimum test set loss are recorded.

[0124] Convergence determination: Training is stopped when the training rounds reach 50 or the early stopping strategy is triggered. The model weight file corresponding to the minimum test set loss is saved, and the pre-training of the TimePro model is completed.

[0125] The early warning time series generation module inputs the time series sliding window dataset into the trained TimePro model. The TimePro model outputs soybean price predictions. Based on the accuracy of the early warning status between the soybean price predictions and the actual soybean prices, it determines whether to retrain the TimePro model. If retraining is not performed, a historical early warning time series result table of the time series sliding window dataset is generated.

[0126] The early warning timing generation module obtains the target value from the historical soybean price sequence of T historical trading days. The dynamic early warning threshold range is defined by the following formula:

[0127] ;

[0128] in, The minimum warning threshold, The maximum warning threshold, Let T be the average price of soybeans over historical trading days. The standard deviation of soybeans over T historical trading days;

[0129] Using a trained TimePro model, inference is performed on a time-series sliding window dataset to obtain soybean price predictions through forward propagation and inverse normalization. ;

[0130] Based on the soybean price forecast for T+1 trading day The relationship between the dynamic early warning threshold range and the early warning status is used to mark the early warning status:

[0131] like If so, it will be marked as a surge warning status;

[0132] like If so, it will be marked as a sharp reduction warning status;

[0133] like If so, it is marked as normal.

[0134] Record the timestamp, alert status, and soybean price forecast for each time-series sliding window data point. The system generates a historical early warning time series result table by using the dynamic early warning threshold range, the average and standard deviation of soybeans over T historical trading days.

[0135] Based on the actual value of soybeans on T+1 trading day The accuracy of the warning status is determined by the dynamic warning threshold range, if the actual value of soybeans... And soybean price forecast If the warning status is consistent, the warning is accurate. If the warning accuracy of the time-series sliding window dataset is less than 90%, the TimePro model should be retrained and iterated for optimization.

[0136] The target sample generation module defines a quantitative index for early warning intensity, and uses this index to filter out target samples with counterfactual interpretations from the historical early warning time series results table.

[0137] The target sample generation module includes a warning status definition submodule, a target sample determination submodule, and a target sample verification submodule.

[0138] The warning status submodule defines a warning intensity quantification index S, with the following formula:

[0139] For time-series sliding window data with a warning status of "surge in warning status" ;

[0140] For time-series sliding window data with a warning status of "drastic reduction warning status". ;

[0141] The target sample determination submodule filters time-series sliding window data with alarm states showing a sharp increase or decrease from the historical alarm time-series result table. The time-series sliding window data is then sorted in descending order according to the alarm intensity quantification index. The time-series sliding window data ranked first is determined as the target sample for counterfactual interpretation. The target sample includes a feature window. Forecast of soybean prices for T+1 trading day Dynamic early warning threshold range, quantitative indicators of early warning intensity, and early warning status.

[0142] It should be noted that if there are several quantitative indicators for the highest warning intensity, that is, the time-series sliding window data ranked first is not displacement, then the time-series sliding window data with the latest timestamp is selected as the target sample.

[0143] The target sample verification submodule checks the feature window of the target sample. Does it contain missing values? And check the soybean price forecast for the target sample on trading day T+1. If any outlier extreme values ​​are found (e.g., values ​​much higher than the historical high or much lower than the historical low), and if any missing values ​​or outlier extreme values ​​are found, the second-ranked time-series sliding window data is reselected as the target sample, and the presence of missing values ​​or outlier extreme values ​​is checked again until it is determined that there are no missing values ​​and no outlier extreme values ​​among the target samples.

[0144] The effective counterfactual sample generation module obtains the target feature matrix through the target sample, constructs a target planning function by the counterfactual loss function, the counterfactual distance perturbation function and the counterfactual diversity function, selects the current optimal sample through the target planning function, generates new candidate samples through constraint filtering and performs iterative loops to obtain effective counterfactual samples.

[0145] The effective counterfactual sample generation module includes a target sample normalization submodule, a target programming function construction submodule, and an effective counterfactual sample acquisition submodule.

[0146] The target sample normalization submodule will normalize the feature window of the target sample. Normalization is performed (using the mean μ and standard deviation σ from the input layer) to obtain the normalized target feature matrix. ;

[0147] The objective programming function construction submodule is composed of a counterfactual loss function, a counterfactual distance perturbation function, and a counterfactual diversity function, as shown in the following formula:

[0148] ;

[0149] Where argmin is the argmin function, j=1,2,…,k, j is the j-th generated counterfactual, and k is the total number of generated counterfactuals. For counterfactual loss function, For counterfactual characteristic values, The counterfactual distance perturbation function reflects the counterfactual eigenvalues. and original eigenvalues distance, , These are the weighting coefficients. Let c be the counterfactual diversity function, reflecting the diversity of k generating counterfactual features c. Counterfactual features reflect the original feature values. The perturbed eigenvalues Let be the objective programming function generated by the counterfactual method at time step t.

[0150] In the above scheme, this application constructs a counterfactual loss function, a counterfactual distance perturbation function, and a counterfactual diversity function, and integrates these three functions to build a target programming function. The strength of each function is adjusted by weighting coefficients. All three functions are specifically designed to meet the needs of counterfactual sample generation in multivariate time series prediction scenarios. The generated counterfactual samples not only closely match the correlation patterns between the time series features to be predicted and the time series features of the covariates, but also possess sufficient sample diversity to accurately match the feature interaction logic of the TimePro model. Based on the generated effective counterfactual samples, this application can further determine the key abnormal features of the time series features to be predicted during periods of abnormal fluctuation, and feed the analysis results of these key abnormal features back to the training phase of the TimePro model, guiding the model to iteratively optimize for these key abnormal features, thereby improving the model's response accuracy to similar abnormal patterns in subsequent predictions.

[0151] The objective programming function construction submodule includes a counterfactual loss function construction submodule, a counterfactual distance perturbation function construction submodule, and a counterfactual diversity function construction submodule.

[0152] The counterfactual loss function construction submodule calculates the original feature value of the j-th counterfactual pair at time step t. Disturbance-induced soybean price forecast and the expected counterfactual state The degree of consistency is used to generate a counterfactual loss function, and the effectiveness of counterfactual generation is determined by the following formula:

[0153] ;

[0154] Specifically, when the expected counterfactual state is the normal state, When the expected counterfactual state is a surge warning state, When the expected counterfactual state is a sharp reduction warning state, ;

[0155] Specifically, when the predicted soybean price is in a state of sharp increase warning, if the expected counterfactual state is a normal state, the counterfactual loss function is 0, indicating a valid counterfactual; if the expected counterfactual state is a state of sharp increase warning, the counterfactual loss function is... This is an invalid counterfactual; if the desired counterfactual state is a sharp reduction warning state, then the counterfactual loss function is... This is invalid counterfactual;

[0156] When the predicted soybean price is in a state of sharp decline warning, if the expected counterfactual state is a normal state, the counterfactual loss function is 0, indicating a valid counterfactual; if the expected counterfactual state is a state of sharp increase warning, the counterfactual loss function is... This is an invalid counterfactual; if the desired counterfactual state is a sharp reduction warning state, then the counterfactual loss function is... This is invalid and counterfactual.

[0157] In this embodiment, the soybean price prediction generated by the TimePro model at time step t is a surge warning state, while the expected counterfactual state is a normal state. This is achieved by perturbing the counterfactual eigenvalues. (For example, lowering the price of soybean meal) so that the soybean price forecast generated by the TimePro model at time step t falls within the dynamic early warning threshold range. Within this context, the generated soybean price forecast value is considered normal, and because... , , , ,so:

[0158] If the counterfactual loss function is 0, then the counterfactual generation condition is satisfied.

[0159] It is important to note that if the counterfactual loss function is inconsistent, the counterfactual loss function will generate a more ineffective counterfactual state. Usually, the expected counterfactual state is the normal state.

[0160] The factual distance perturbation function construction submodule uses the standardized absolute difference mean to calculate the antifactual distance perturbation function, as shown in the formula:

[0161] ;

[0162] Where d is the total number of factors in a single sample (d=3). Let be the absolute median difference of the p-th factor, used for standardized distance and stable capture of disturbances, where p = 1, 2, 3. Let j be the value of the j-th counterfactual sample on the p-th factor. This represents the true value of the p-th factor in the original sample at time step t.

[0163] It should be noted that soybean meal prices, soybean oil prices, and port soybean inventory are all quantitative factors, therefore there are no qualitative factors.

[0164] The counterfactual diversity function construction submodules are combined to determine the counterfactual diversity function, and the formula is as follows:

[0165] ;

[0166] in, Let b = j+1, j+2, ..., k, where b is the b-th generated counterfact. For the j-th counterfactual feature value and the b-th counterfactual characteristic value The distance.

[0167] The effective counterfactual sample acquisition submodule uses the target feature matrix as the initial value, and obtains an effective candidate set through random perturbation, constraint filtering and TimePro model screening. The effective candidate set is optimized by the objective programming function and gradient iteration to obtain the optimal counterfactual sample. The optimal counterfactual sample is verified to obtain the effective counterfactual sample.

[0168] The effective counterfactual sample acquisition submodule includes a counterfactual sample candidate sample generation submodule, an effective candidate set generation submodule, an optimal counterfactual sample generation submodule, a counterfactual sample integration submodule, and an effective counterfactual sample verification submodule.

[0169] The counterfactual sample candidate sample generation submodule uses the target feature matrix Using these as initial values, a candidate set of 100 initial counterfactual samples is generated through random perturbation. (Dimension [30,3]), the filter value range constraint is not satisfied. Alternatively, if the temporal continuity constraint does not satisfy the disturbance amplitude ≤ 5%, then the initial counterfactual sample candidate is obtained.

[0170] Where i = 1, 2, 3... 100, p = 1, 2, 3, Let p be the p-th dimension of the i-th initial counterfactual sample candidate sample. and Let be the upper and lower boundaries of the legal values ​​for the p-th dimension.

[0171] The effective candidate set generation submodule inputs the counterfactual sample candidate samples into the TimePro model, and inputs the original feature value x of the j-th counterfactual pair at the i-th time step. t Disturbance-induced soybean price forecast Normalization restores the data to its original scale, allowing for the selection of soybean price forecasts. Candidate samples in the normal state are integrated into an effective candidate set.

[0172] It should be noted that if the number of valid candidate set samples is 0, the random perturbation amplitude is increased to 10%, the initial candidate set is regenerated and screened until the number of valid candidate set samples is ≥20.

[0173] The optimal counterfactual sample generation submodule selects the current optimal sample through a target programming function, adjusts the time-series feature values ​​of covariates based on gradients, generates new candidate samples through constraint filtering, and iterates to obtain the optimal counterfactual sample.

[0174] Specifically, the optimal counterfactual sample generation submodule processes the following:

[0175] Calculate the objective programming function for each valid candidate sample, select the valid candidate sample with the smallest objective programming function as the current optimal sample, and calculate the covariate time-series characteristics of the objective programming function for the current optimal sample at each time step. (soybean meal price) Soybean oil price Port soybean inventory )gradient;

[0176] Covariate time-series features adjusted based on gradient direction for the current best sample The values ​​taken at each time step are used to generate new candidate samples with smaller objective programming functions;

[0177] The newly generated candidate samples are filtered by value range constraints and temporal continuity constraints;

[0178] Repeat the above steps 1000 times. Record the objective programming function of the current best sample every 100 iterations. If the objective programming function of the current best sample fluctuates ≤0.001 after 200 consecutive iterations, stop the iteration and output the best counterfactual sample.

[0179] The counterfactual sample integration submodule uses different initial random perturbations to repeatedly generate 10 optimal counterfactual samples through the counterfactual sample candidate sample generation submodule, the effective candidate set generation submodule, and the optimal counterfactual sample generation submodule, forming a counterfactual sample set.

[0180] The valid counterfactual sample verification submodule verifies the generated counterfactual sample set to obtain valid counterfactual samples.

[0181] Specifically, the effective counterfactual sample verification submodule inputs each optimal counterfactual sample into the TimePro model for validity verification. If the predicted values ​​of each optimal counterfactual sample are all in the normal state and the objective programming function is less than the objective programming function of the initial target, then it is a valid counterfactual sample.

[0182] The iterative optimization module determines the adjustment magnitude weight and prediction sensitivity of the covariate time series features by adjusting the effective counterfactual samples and the target samples, locates the anomaly driving features, and iteratively optimizes the TimePro model using the anomaly driving features.

[0183] The iterative optimization module includes a relative adjustment amount acquisition submodule, an adjustment amount direction acquisition submodule, an anomaly-driven feature acquisition submodule, and an update model submodule.

[0184] The relative adjustment acquisition submodule calculates the relative adjustment of the covariate temporal features at each time step in each valid counterfactual sample and target sample.

[0185] Specifically, calculate the temporal features of covariates in each valid counterfactual sample and the target sample. (soybean meal price) Soybean oil price Port soybean inventory The absolute adjustment at each time step is calculated using the following formula:

[0186] ;

[0187] in, For absolute adjustment amount, For the effective counterfactual sample, the predicted soybean price at time step t, This is the predicted soybean price output at time step t for the target sample.

[0188] Calculate the time-series features of covariates in each valid counterfactual sample and the target sample. (soybean meal price) Soybean oil price Port soybean inventory The relevant adjustment amounts at each time step are calculated using the following formula:

[0189] ;

[0190] in, This is a relative adjustment amount;

[0191] For each soybean meal price Soybean oil price Port soybean inventory The relative adjustment amounts at T (T=30) time steps are statistically analyzed to calculate the average adjustment magnitude, maximum adjustment magnitude, and cumulative adjustment magnitude, thereby obtaining a relative adjustment scale.

[0192] In the example, the soybean meal price in the univariate adjustment scale The average adjustment was 8%, the maximum adjustment was 12%, and the cumulative adjustment was 240%.

[0193] The adjustment direction acquisition submodule calculates the adjustment correlation coefficient between the time-series features of the covariates and analyzes the adjustment direction relationship of the adjustment correlation coefficient:

[0194] If the correlation coefficient of the adjustment amount is approximately 1, then the adjustment directions of the time series characteristics of the two covariates are consistent.

[0195] If the correlation coefficient of the adjusted amount is less than 0, then the time series characteristics of the two covariates are adjusted in opposite directions.

[0196] The anomaly driving feature acquisition submodule obtains the adjustment magnitude weight and prediction sensitivity based on the adjustment direction relationship and relative adjustment amount of the counterfactual samples, and obtains and verifies the anomaly driving features for soybean price anomaly early warning.

[0197] The anomaly-driven feature acquisition submodule includes an adjustment magnitude weight generation submodule, a prediction sensitivity generation submodule, a feature perturbation contribution calculation submodule, and an anomaly-driven feature verification submodule.

[0198] The integer amplitude weight generation submodule obtains the adjustment amplitude weight of each covariate time series feature based on the cumulative adjustment amplitude, using the following formula:

[0199] ;

[0200] in, The adjustment magnitude weight for the time series feature of the p-th covariate. Let $\frac{p}{p}$ be the cumulative adjustment magnitude of the time series feature of the $p$-th covariate. For soybean meal prices The cumulative adjustment range, For soybean oil prices The cumulative adjustment range, For port soybean inventory The cumulative adjustment range;

[0201] In the example, the price of soybean meal The cumulative adjustment range is 240%, soybean oil prices The cumulative adjustment is 180%, and the port soybean inventory... The cumulative adjustment is 80%, then , , This indicates the price of soybean meal. The adjustment made the biggest contribution.

[0202] The prediction sensitivity generation submodule fixes the values ​​of two covariate time-series features, adjusts the values ​​of the remaining covariate time-series features, forms an adjusted feature matrix, inputs it into the TimePro model, and calculates the prediction sensitivity using the following formula:

[0203] ;

[0204] Let p be the predictive sensitivity of the time-series feature of the p-th covariate. The change in soybean predicted price caused by adjusting the time-series characteristics of covariates. This represents the adjustment magnitude of the time series feature of the p-th covariate.

[0205] In the example, the price of soybean meal Predictive sensitivity (i.e., soybean meal price) For every 1% change, the predicted price change is 5.2% (soybean oil price). Predictive sensitivity Port soybean inventory of This indicates the price of soybean meal. Soybean meal prices have the highest forecast sensitivity. It has the greatest impact on soybean price forecasts; even minor fluctuations can trigger abnormal price warnings.

[0206] The feature perturbation contribution calculation submodule combines the adjustment magnitude weight and prediction sensitivity to obtain the feature perturbation contribution of each covariate time-series feature, as shown in the formula:

[0207] ;

[0208] in, The contribution of the characteristic perturbation to the time series features of p covariates;

[0209] The contribution of each covariate time series feature to the feature perturbation is sorted in descending order. The covariate time series feature with the first feature perturbation contribution is the abnormal driving feature, the covariate time series feature with the second feature perturbation contribution is the secondary driving feature, and the covariate time series feature with the third feature perturbation contribution is the general driving feature.

[0210] The abnormal driving feature verification is conducted through a controlled variable control experiment to verify whether the abnormal driving feature is correct. The controlled variable control experiment verifies that adjusting only the abnormal driving feature will bring the soybean price forecast to a normal state, while adjusting only the secondary or general driving features will not bring the soybean price forecast back to a normal state.

[0211] The updated model submodule updates the TimePro model weights and dynamic early warning threshold ranges through anomaly-driven features.

[0212] Specifically, the update model submodule obtains the anomaly-driven features and feature perturbation contribution, constructs a weighted loss function based on the feature perturbation contribution, incrementally fine-tunes the TimePro model, and updates the model weights; adaptively adjusts the minimum and maximum warning thresholds according to the maximum value of the feature perturbation contribution, and updates the dynamic warning threshold range.

[0213] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A soybean early warning system based on multivariate time-series interpretable data, characterized in that, It includes a data acquisition module, a model pre-training module, an early warning time series generation module, a target sample generation module, an effective counterfactual sample generation module, and an iterative optimization module; The data acquisition module collects the time-series features of soybeans to be predicted and the time-series features of covariates, and performs preprocessing on the time-series features to be predicted and the time-series features of covariates to be predicted by filling in missing values ​​and truncating by sliding window to form a time-series sliding window dataset. The model pre-training module creates a TimePro model based on the input layer, feature embedding layer, feature interaction layer and output layer, and pre-trains the TimePro model using a time-series sliding window dataset. The early warning time series generation module inputs the time series sliding window dataset into the trained TimePro model. The TimePro model outputs soybean price prediction values. Based on the accuracy of the early warning state between the soybean price prediction values ​​and the actual soybean price values, it determines whether to retrain the TimePro model. If retraining is not performed, a historical early warning time series result table of the time series sliding window dataset is generated. The target sample generation module defines a quantitative index for early warning intensity, and uses this index to filter out target samples for counterfactual interpretation from the historical early warning time series result table. The effective counterfactual sample generation module obtains the target feature matrix through the target sample, constructs a target planning function by the counterfactual loss function, the counterfactual distance perturbation function and the counterfactual diversity function, selects the current optimal sample through the target planning function, generates new candidate samples through constraint filtering and performs iterative loop to obtain effective counterfactual samples; The iterative optimization module determines the adjustment magnitude weight and prediction sensitivity of the covariate time series features by adjusting the effective counterfactual samples and the target samples, locates the anomaly driving features, and iteratively optimizes the TimePro model using the anomaly driving features.

2. The soybean early warning system based on multivariate time-series interpretable data according to claim 1, characterized in that, The data acquisition module includes a feature determination submodule, a missing value processing submodule, and a missing value verification submodule; The feature determination submodule determines the time series features to be predicted and the covariate time series features of soybeans. The time series features to be predicted of soybeans are soybean prices, and the covariate time series features include soybean meal prices, soybean oil prices, and port soybean inventory. The missing value processing submodule collects the time-series features and covariate time-series features of soybeans to be predicted from multiple trading days, groups the time-series features and covariate time-series features of soybeans to be predicted by each trading day, integrates multiple sets of trading data, processes the missing values ​​of multiple sets of trading data, fills in the missing time-series data, and forms a time-series dataset. The missing value verification submodule extracts sliding window samples from the continuous time-series dataset using feature windows and target values, performs missing value verification on the feature windows and target values ​​of all sliding window samples, and forms a time-series sliding window dataset after verification.

3. The soybean early warning system based on multivariate time-series interpretable data according to claim 1, characterized in that, The TimePro model includes an input layer, a feature embedding layer, a feature interaction layer, and an output layer. The output of the input layer is connected to the input of the feature embedding layer, the output of the feature embedding layer is connected to the input of the feature interaction layer, and the output of the feature interaction layer is connected to the input of the output layer.

4. The soybean price early warning method with multivariate time-series interpretability according to claim 3, characterized in that, The processing procedure for the TimePro model is as follows: The input layer performs instance normalization on the temporal sliding window data and outputs the temporal feature sequence to the feature embedding layer. The feature embedding layer splits the time-series feature sequence by dimension into soybean meal price sequence, soybean oil price sequence, and port soybean inventory sequence. The soybean meal price sequence, soybean oil price sequence, and port soybean inventory sequence are then spliced ​​together after being overlapped and linearly mapped, to obtain the embedding matrix, which is then output to the feature interaction layer. The feature interaction layer performs cross-variable and cross-temporal interactions on the embedding matrix through sequentially stacked ProBlock modules, and outputs enhanced interactive features to the output layer; The output layer flattens the enhanced interactive features and converts them into 1D vector features. The 1D vector features are then mapped to single-valued normalized predicted values. The normalized predicted values ​​are then denormalized using the mean μ and standard deviation σ to obtain the soybean price prediction.

5. The soybean early warning system based on multivariate time-series interpretable data according to claim 1, characterized in that, The early warning timing generation module is specifically as follows: The target value is obtained by using the historical price series of soybeans over T historical trading days. The dynamic early warning threshold range is defined by the following formula: ; in, The minimum warning threshold, The maximum warning threshold, Let T be the average price of soybeans over historical trading days. The standard deviation of soybeans over T historical trading days; Using a trained TimePro model, inference is performed on a time-series sliding window dataset to obtain soybean price predictions through forward propagation and inverse normalization. ; Based on the soybean price forecast for T+1 trading day The relationship between the dynamic early warning threshold range and the early warning status is used to mark the early warning status: like If so, it will be marked as a surge warning status; like If so, it will be marked as a sharp reduction warning status; like If so, it is marked as normal. Record the timestamp, alert status, and soybean price forecast for each time-series sliding window data point. The system generates a historical early warning time series result table by using the dynamic early warning threshold range, the average and standard deviation of soybeans over T historical trading days. Based on the actual value of soybeans on T+1 trading day The accuracy of the warning status is determined by the dynamic warning threshold range, if the actual value of soybeans... And soybean price forecast If the warning status is consistent, the warning is accurate. If the warning accuracy of the time-series sliding window dataset is less than 90%, the TimePro model should be retrained and iterated for optimization.

6. The soybean early warning system based on multivariate time-series interpretable data according to claim 1, characterized in that, The target sample generation module includes a warning status definition submodule, a target sample determination submodule, and a target sample verification submodule; The warning status submodule defines a warning intensity quantification index S, with the following formula: For time-series sliding window data with a warning status of "surge in warning status" ; For time-series sliding window data with a warning status of "drastic reduction warning status". ; in, The minimum warning threshold, The maximum warning threshold, This is a forecast for soybean prices; The target sample determination submodule filters time-series sliding window data with alarm states showing a sharp increase or decrease from the historical alarm time-series result table. The time-series sliding window data is then sorted in descending order according to the alarm intensity quantification index. The time-series sliding window data ranked first is determined as the target sample for counterfactual interpretation. The target sample includes a feature window. Forecast of soybean prices for T+1 trading day Dynamic early warning threshold range, quantitative indicators of early warning intensity, and early warning status; The target sample verification submodule checks the feature window of the target sample. Does it contain missing values? And check the soybean price forecast for the target sample on trading day T+1. If any outliers are found, and if any missing values ​​or outliers are found, the second-ranked time-series sliding window data is selected as the target sample, and the presence of missing values ​​or outliers is checked again until it is determined that there are no missing values ​​and no outliers are found in the target sample.

7. The soybean early warning system based on multivariate time-series interpretable data according to claim 1, characterized in that, The objective programming function construction submodule is composed of a counterfactual loss function, a counterfactual distance perturbation function, and a counterfactual diversity function, as shown in the following formula: ; Where argmin is the argmin function, j=1,2,…,k, j is the j-th generated counterfactual, and k is the total number of generated counterfactuals. For counterfactual loss function, For counterfactual characteristic values, The counterfactual distance perturbation function reflects the counterfactual eigenvalues. and original eigenvalues distance, , These are the weighting coefficients. Let c be the counterfactual diversity function, reflecting the diversity of k generating counterfactual features c. Counterfactual features reflect the original feature values. The perturbed eigenvalues Let be the objective programming function generated by the counterfactual method at time step t.

8. The soybean early warning system based on multivariate time-series interpretable data according to claim 7, characterized in that, The formula for the counterfactual loss function is: ; Specifically, when the expected counterfactual state is the normal state, When the expected counterfactual state is a surge warning state, When the expected counterfactual state is a sharp reduction warning state, .

9. The soybean early warning system based on multivariate time-series interpretable data according to claim 1, characterized in that, The iterative optimization module includes a relative adjustment amount acquisition submodule, an adjustment amount direction acquisition submodule, an anomaly-driven feature acquisition submodule, and an update model submodule. The relative adjustment acquisition submodule calculates the relative adjustment of the covariate temporal features at each time step in each valid counterfactual sample and target sample; The adjustment direction acquisition submodule calculates the adjustment correlation coefficient between the time series features of the covariates and analyzes the adjustment direction relationship of the adjustment correlation coefficient. The anomaly driving feature acquisition submodule obtains the adjustment magnitude weight and prediction sensitivity based on the adjustment direction relationship and relative adjustment amount of the counterfactual samples, and obtains and verifies the anomaly driving features for soybean price anomaly early warning. The updated model submodule updates the TimePro model weights and dynamic early warning threshold ranges through anomaly-driven features.