Method for local financial budget prediction and early warning based on time-series deep learning model
Patent Information
- Application Number
- CN202611333089.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-31
- Publication Date
- 2026-10-20
AI Technical Summary
[0004]但是现有技术方案的特征提取环节缺乏刚性因果约束,无法有效剥离经济周期与财税政策对预算收支的混杂影响,多政策叠加场景下预算预测失真问题突出
本发明提供的基于时序深度学习模型的地方财政预算预测预警方法,通过时序因果图与后门准则筛选最小后门调整集并生成固定二元掩码,通过样本逆概率加权与特征级因果门控实现双层去混杂。
Smart Images

Figure FT_1
Abstract
Description
Technical Field
[0001] This invention relates to the field of deep learning technology, and in particular to a method for forecasting and early warning of local fiscal budgets based on a time-series deep learning model. Background Technology
[0002] With the increasing demands for refined local fiscal management, the accelerating frequency of fiscal and tax policy issuance, and the growing complexity of the causes of fiscal revenue and expenditure fluctuations, accurate local fiscal budget forecasting and risk warning have become core requirements for digital fiscal governance. In recent years, time-series deep learning, with its ability to model long-term time-series dependencies, has gradually replaced traditional empirical calculations and simple econometric models, becoming the mainstream technological development direction in the field of local fiscal budget forecasting.
[0003] Existing local government budget forecasting and early warning methods based on time-series deep learning models typically use historical fiscal revenue and expenditure, macroeconomic indicators, and other time-series data as input. They employ classic time-series networks such as LSTM and TFT to extract long-term and short-term time-series dependent features and directly output fiscal revenue and expenditure forecast results. Some schemes introduce propensity score inverse probability weighting to correct sample confounding bias, and generally adopt a step-by-step training mode of first calculating fixed sample weights offline and then training the prediction model separately.
[0004] However, existing technical solutions lack rigid causal constraints in the feature extraction stage, failing to effectively isolate the confounding effects of economic cycles and fiscal policies on budget revenue and expenditure. This leads to significant budget forecast distortion in scenarios with multiple overlapping policies. Furthermore, during joint optimization, existing end-to-end causal inference models tend to deviate from their semantic objective of estimating policy probabilities in order to reduce prediction errors, thus degenerating into auxiliary prediction latent variables. This results in the IPW weights losing their causal correction effectiveness. Summary of the Invention
[0005] To overcome the aforementioned deficiencies of the prior art, embodiments of the present invention provide a local fiscal budget forecasting and early warning method based on a time-series deep learning model to address the problems mentioned in the background art.
[0006] To achieve the above objectives, the present invention provides the following technical solution: a local fiscal budget forecasting and early warning method based on a time-series deep learning model, comprising the following steps: Obtain heterogeneous time-series data containing discrete policy markers and continuous fiscal indicators, and preprocess the heterogeneous time-series data to obtain a standard time-series dataset; A fiscal causal graph is constructed based on the standard time series dataset. All backdoor paths are traversed, and the minimum backdoor adjustment set is selected using the backdoor criterion and a binary mask matrix is generated. Construct a dynamic weight model to estimate the dynamic score of each data sample, and substitute the dynamic score into the inverse probability formula to obtain the data sample with weight label. Substitute the data samples with weight labels into the time-series fusion model to obtain the time-series coding vector. The time-series fusion model adds a causal gating mechanism inside the standard TFT encoder. It uses the value of the binary mask matrix to control the gating to open or close the gate channel by channel to filter out interference features. The time-series coding vector is input into the prediction output layer to obtain the fiscal budget prediction results and perform risk warning.
[0007] Preferably, the preprocessing of heterogeneous time-series data includes: Mixing and alignment are performed on heterogeneous time-series data with different acquisition frequencies, and linear interpolation is used to fill in missing data values; The administrative regions are grouped and stratified Z-score standardization is performed to calculate the mean and standard deviation within each region. A multicollinearity test is performed on the standardized heterogeneous time series data, the variance inflation factor of each heterogeneous time series data is calculated, and heterogeneous time series data with variance inflation factors greater than the threshold are removed to obtain the standard time series dataset.
[0008] Preferably, the content of constructing the fiscal causal graph includes: We import machine-executable edge constraints corresponding to knowledge in the field of public finance and economics, and use these machine-executable edge constraints as rigid prior constraints of the causal graph. We then use a PC algorithm with time constraints to complete the conditional independence test, and retain only robust causal edges whose occurrence frequency is higher than a set threshold. After traversing all backdoor paths, select the blocking subset with the fewest variables as the minimum backdoor adjustment set. Assign a value of 1 to the variables belonging to the minimum backdoor adjustment set, and assign a value of 0 to the other variables to generate a binary mask matrix.
[0009] Preferably, the content of constructing the dynamic weight model includes: Set a historical window length, divide the standard time series dataset according to the historical window length, and extract the standard time series dataset within the window as the data sample; A dynamic weight model is constructed, which includes an LSTM encoding layer, an attention aggregation layer, and a Sigmoid output layer. The attention aggregation layer applies a financial time decay penalty to the sequence output by the LSTM encoding layer and sets a minimum threshold for attention weights. Weights below the minimum threshold are forced to equal the minimum threshold and then renormalized to preserve long-term financial baseline information.
[0010] Preferably, the timing fusion model is constructed based on an improved standard TFT encoder, comprising a feature embedding layer, a causal gating layer, a timing coding layer, a weighted aggregation layer, and a coding output layer connected in sequence. The causal gating layer is a new module added on the basis of the standard TFT encoder. Its input end is connected to the timing embedding feature output by the feature embedding layer, and its output end is connected to the input end of the timing coding layer. The weighted aggregation layer introduces sample weights output by a dynamic weight network to perform weighted aggregation on the sequence output by the temporal coding layer; The causal gating layer has a built-in binary mask matrix, which generates dynamic gating through learnable parameters to filter temporal features dimension by dimension.
[0011] Preferably, the step of generating dynamic gating through learnable parameters and filtering temporal features dimension by dimension includes: Within the causal gating layer, a gating matrix and a gating bias vector that match the temporal embedding feature dimension are configured as learnable parameters for dynamic gating. These learnable parameters participate in gradient descent training iterations as a whole with the temporal fusion model. A linear transformation is performed on the temporal embedded features output by the feature embedding layer to generate gated intermediate variables, wherein the linear transformation formula is composed of the gate matrix and the gate bias vector; An activation function is applied to the gating intermediate variable one dimension at a time, mapping the values to the (0, 1) interval to obtain the dynamic gating coefficients; The temporal embedding features, binary mask matrix, and dynamic gating coefficients are multiplied element by element. When the mask element is 0, the corresponding dimension feature output is always 0. The gating is forced to close to truncate interfering features. When the mask element is 1, the corresponding dimension feature is adaptively adjusted by the dynamic gating coefficients to output causal temporal features.
[0012] Preferably, the prediction output layer is configured with three sets of independent fully connected branches, corresponding to three core fiscal indicators: general public budget revenue, general public budget expenditure, and revenue and expenditure gap, respectively. Each branch initializes parameters independently and updates parameters independently.
[0013] As described above, the local fiscal budget forecasting and early warning method based on a time-series deep learning model provided by this invention has at least the following beneficial effects: The local fiscal budget forecasting and early warning method based on a time-series deep learning model provided by this invention selects the minimum backdoor adjustment set and generates a fixed binary mask by using a time-series causal graph and backdoor criterion, and achieves two-layer decontamination by using sample inverse probability weighting and feature-level causal gating.
[0014] A closed-loop training architecture combining a dynamic weight model and a time-series fusion model is constructed. The loss weights are dynamically adjusted based on the overall balance deviation, and the sample weighting strategy and feature encoding rules are corrected simultaneously. This improves the accuracy of budget forecasting while continuously ensuring the causal correction effectiveness of the propensity score, effectively addressing the problems of budget forecast distortion and insufficient accuracy of risk warning in scenarios with multiple overlapping policies. Attached Figure Description
[0015] The present invention will be further described with reference to the accompanying drawings, but the embodiments in the drawings do not constitute any limitation on the present invention. For those skilled in the art, other drawings can be obtained based on the following drawings without creative effort.
[0016] Figure 1 This is a flowchart illustrating the local fiscal budget forecasting and early warning method based on a time-series deep learning model according to the present invention. Detailed Implementation
[0017] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0018] Please see Figure 1 As shown, this invention provides a method for local fiscal budget forecasting and early warning based on a time-series deep learning model, comprising the following steps: S1. Obtain heterogeneous time-series data containing discrete policy markers and continuous fiscal indicators, and preprocess the heterogeneous time-series data to obtain a standard time-series dataset. The preprocessing of heterogeneous time-series data includes: Mixing and alignment are performed on heterogeneous time-series data with different acquisition frequencies, and linear interpolation is used to fill in missing data values; The administrative regions are grouped and stratified Z-score standardization is performed to calculate the mean and standard deviation within each region. A multicollinearity test is performed on the standardized heterogeneous time series data, the variance inflation factor of each heterogeneous time series data is calculated, and heterogeneous time series data with variance inflation factors greater than the threshold are removed to obtain the standard time series dataset.
[0019] In this embodiment, heterogeneous time-series data containing discrete policy markers and continuous fiscal indicators are obtained. The continuous fiscal indicators can be obtained from fiscal business systems, budget and final accounts disclosure platforms, and statistical public data sources, including but not limited to quantitative indicators such as monthly or quarterly general public budget revenue, general public budget expenditure, tax revenue, government debt, regional GDP, and fixed asset investment. Discrete policy tags are derived from publicly released fiscal and tax policy documents from governments and finance departments at all levels. Sources include normative documents, policy notices, and reform implementation plans from the finance department's official website. The original policy texts are parsed to extract the policy's effective date, applicable administrative region, and policy category. A corresponding binary tag field is generated for each policy on a unified timeline. Specifically, if a policy is in effect after a certain time step in a given region, the tag is assigned a value of 1; if the policy has not yet taken effect or has been repealed, the tag is assigned a value of 0. Using the regional code and timestamp as a joint primary key, continuous fiscal numerical indicators are concatenated and merged with discrete policy tags to obtain heterogeneous time-series data.
[0020] Next, the heterogeneous fiscal time-series data underwent a unified mixing process. Low-frequency fiscal indicators such as quarterly and annual data were upsampled to the monthly time granularity using a stepped equal-distribution filling method, unifying the sampling period of the entire data and ensuring alignment of the time-series dimensions. Discrete features such as binary policy markers and regional identifiers were preserved in their original time-series state without numerical equal-distribution filling to avoid policy distortion. Subsequently, missing value repair was performed. For continuous fiscal time-series indicators, linear interpolation within the same region was used to fill in gaps, and fiscal and tax policy markers that were ineffective or lacked information were uniformly filled with zero. Furthermore, the variance inflation factor was calculated for all continuous fiscal quantitative indicators. ,in, Let be the variance inflation factor of the j-th continuous feature. The coefficient of determination is obtained by performing a multiple linear regression with the j-th continuous feature as the dependent variable and all other continuous features as independent variables. The variance inflation factor is compared with an inflation threshold (e.g., 10), and heterogeneous time-series data with variance inflation factors greater than the threshold are removed. Then, regional stratified normalization is performed, and Z-score standardization is applied to the stabilized continuous fiscal indicators according to administrative regions, with the regional coding field in the data table used as the basis for grouping.
[0021] After preprocessing, the standard time series dataset is divided into a training set and a validation set in an 8:2 ratio according to the time sequence. The training set is used for subsequent model parameter training, and the validation set is used for overall balance deviation verification and model convergence determination.
[0022] S2. Construct a fiscal causal graph based on the standard time series dataset, traverse all backdoor paths, use the backdoor criterion to filter the minimum backdoor adjustment set and generate a binary mask matrix. The construction of the fiscal causal graph includes: We import machine-executable edge constraints corresponding to knowledge in the field of public finance and economics, and use these machine-executable edge constraints as rigid prior constraints of the causal graph. We then use a PC algorithm with time constraints to complete the conditional independence test, and retain only robust causal edges whose occurrence frequency is higher than a set threshold. After traversing all backdoor paths, select the blocking subset with the fewest variables as the minimum backdoor adjustment set. Assign a value of 1 to the variables belonging to the minimum backdoor adjustment set, and assign a value of 0 to the other variables to generate a binary mask matrix.
[0023] In this embodiment, the steps for constructing a fiscal time-series causal graph are as follows: Pre-set machine-enforceable hard constraints on time-series causality as fixed preconditions for the PC algorithm. These constraints include: prohibiting reverse causal edges in time; variables with later timeframes cannot point to variables with earlier timeframes; preventing the same variable from generating self-looping causal edges; and ensuring that causal edges conform to basic fiscal logic, such as preventing fiscal expenditures from affecting previous fiscal revenues concurrently, and preventing policy effectiveness from being reverse-causally linked to economic outcomes. Next, a constraint-based PC algorithm combined with hard causal constraints is used to learn the causal structure. The PC algorithm employs a partial correlation test based on Fisher's Z-transform as a conditional independence test method, setting a significance level. =0.05, maximum number of variables in the condition set =3. To address the computational complexity and causal uncertainty of multivariate variables, a multi-layered order reduction and bootstrap aggregation mechanism is adopted. Specifically, candidate variables are divided into four modules according to economic semantics: macroeconomics, fiscal revenue, fiscal expenditure, and policy intervention. Causal discovery is first performed within each module, and then potential edges across modules are examined. The computational complexity is significantly reduced through temporal constraints and prior constraints. Then, bootstrap sampling with replacement is performed 50 times on the training set. The causal discovery algorithm is run independently for each group of samples, and only robust edges with a frequency ≥60% are retained. Finally, a directed acyclic fiscal temporal causal graph is generated.
[0024] Using income, expenditure, and income-expenditure gap as result nodes, all backdoor paths in the entire graph are traversed. A greedy iterative algorithm with minimum vertex cover is used to filter the set of variables that block all backdoor paths, selecting the set with the fewest variables as the minimum backdoor adjustment set. Next, based on the minimum backdoor adjustment set, a binary mask matrix with the same dimension as the number of feature channels is generated, where variables belonging to the minimum backdoor adjustment set are assigned a value of 1, and the remaining variables are assigned a value of 0. This mask matrix remains fixed throughout model training, does not participate in gradient updates, and is directly input into subsequent causal gating layers as a rigid causal prior constraint.
[0025] S3. Construct a dynamic weight model to estimate the dynamic score of each data sample. Substitute the dynamic score into the inverse probability formula to obtain the data sample with weight labels. The construction of the dynamic weight model includes: Set a historical window length, divide the standard time series dataset according to the historical window length, and extract the standard time series dataset within the window as the data sample; A dynamic weight model is constructed, which includes an LSTM encoding layer, an attention aggregation layer, and a Sigmoid output layer. The attention aggregation layer applies a financial time decay penalty to the sequence output by the LSTM encoding layer and sets a minimum threshold for attention weights. Weights below the minimum threshold are forced to equal the minimum threshold and then renormalized to preserve long-term financial baseline information.
[0026] In this embodiment, for the i-th data sample, the smallest backdoor adjustment set time series variable within the historical time window preceding the current period and the historical policy data of the same period are horizontally concatenated to form the input feature vector. Where T is the total number of months in the selected historical time window. Let T be the time series variable of the minimum backdoor adjustment set of the i-th sample data period prior. Let T-1 be the historical policy data preceding the i-th sample data, with 1 representing implementation and 0 representing non-implementation. The input feature vector is fed into the dynamic weight model, and the dynamic score is solved through network forward propagation.
[0027] The specific steps of the network forward propagation are as follows: First, the input feature vector is input into the LSTM recurrent unit, and the dependencies across time steps are extracted layer by layer, outputting the hidden state sequence. Second, the hidden state sequence is input into the attention aggregation layer. This layer is superimposed with fiscal time-series lag decay penalties and weight lower bound truncation constraints to match the objective law of fiscal policy lag decay and prevent the complete loss of long-term information. The learning parameters of this layer are the attention weight matrix. and attention bias vector Calculate the raw score with time decay penalty. ,in Let be the unnormalized dynamic score vector for month t. Let be the hidden state vector for month t. For a fixed attenuation coefficient, To extract the interval months at the end of the current time step from the extraction window, the vector will be... The overall score scalar is obtained by summing the values of all dimensions. Then perform the Softmax operation, and... Substituting the values into the Softmax normalization formula and setting a minimum threshold for attention weights, values less than the minimum threshold are forced to equal the minimum threshold to obtain the attention weight for month t, ensuring the sum of the attention weights is 1. The attention weights for month t are then weighted and aggregated globally in time sequence to obtain the total attention weight for the i-th sample data in month T. Thirdly, the total attention weight is input into the Sigmoid output layer, which undergoes linear transformation and Sigmoid activation to output a dynamic score. The dynamic score is then substituted into the inverse probability formula to obtain the weight labels for the data samples. ,in For sample i, the policy implementation data for the current period, =1 represents the policy implementation group. =0 represents the control group. This is the dynamic score for sample i.
[0028] Setting a minimum threshold for attention weights is to prevent the weights of long-term historical months from approaching zero infinitely after applying Softmax and time-series decay penalties, thus completely losing the long-term fiscal causal baseline. The minimum threshold for attention weights... The selection is achieved using a cross-validation strategy. Specifically, the candidate threshold interval is first determined by a fixed window of months, and the minimum threshold value for the attention weight is satisfied. Then, the candidate intervals are coarsely screened by gradient. The coarsely screened candidate intervals are traversed. For each candidate threshold, a dynamic weight model is trained on the training set, and the deviation between the binary cross-entropy loss term and the overall balance is measured on the validation set. The candidate threshold corresponding to the minimum value of the weighted sum of the binary cross-entropy loss term and the overall balance deviation is found, which is the minimum attention weight threshold.
[0029] The overall balance deviation calculation steps are as follows: First, calculate the weighted mean of a certain backdoor adjustment variable policy group and control group. Then, divide the difference between the two group means by the standard deviation of the variable itself to obtain the standardized mean difference. Scale the difference to a uniform dimensionless interval. Finally, sum the standardized mean differences of each backdoor adjustment variable to obtain the overall balance deviation.
[0030] The dynamic weight model training employs a composite loss function, consisting of a binary cross-entropy loss term and a distribution equilibrium regularization term. The formula for the local composite loss of dynamic weights is as follows: ,in This is the binary cross-entropy loss term. To balance the regularization terms, The loss weights are calculated using the binary cross-entropy loss formula. The balance regularization term equals the overall balance deviation. Substituting this into the composite loss function, the loss weights increase linearly with the overall balance deviation.
[0031] The overall training process is divided into two stages: separate pre-training of the dynamic weight model and joint training across the entire network. During separate pre-training of the dynamic weight model, only the dynamic weight model is optimized; the temporal fusion model and the prediction output layer are frozen and do not participate in parameter updates. Temporal batch gradient descent is used, and after each round of parameter updates, the overall batch balance bias is recalculated in real time, and the loss weights are updated. This continues until the overall balance bias on the validation set shows no decrease for 10 consecutive rounds, at which point the network is considered converged, and training in this stage is stopped. During joint training, the parameters of the encoding and output layers of the dynamic weight model are fixed, while the parameters of the attention aggregation layer participate in the joint training across the entire network. Simultaneously, all parameters of the temporal fusion model and the prediction output layer are completely unfrozen, and the global loss gradient is backpropagated synchronously. The gradient is only propagated to the attention aggregation layer, cutting off the gradient path to the output layer of the dynamic weight model. The global loss value on the validation set is monitored; if the global composite loss on the validation set shows no decrease for 10 consecutive training rounds, the joint training is considered converged, and training is terminated.
[0032] Specifically, when the dynamic weight model deviates from the policy probability estimate due to fitting prediction errors, the overall balance bias will increase synchronously, triggering adaptive loss weight amplification. Gradient backpropagation forces correction of the attention layer parameters, driving the dynamic score to regress to the accurate probability estimate, ensuring the continued effectiveness of the causal correction of inverse probability weighting. This avoids the problem of dynamic scores degenerating into auxiliary prediction latent variables in traditional end-to-end training.
[0033] S4. Substitute the data samples with weight labels into the time-series fusion model to obtain the time-series coding vector. The time-series fusion model adds a causal gating mechanism inside the standard TFT encoder. It uses the value of the binary mask matrix to control the gating to open or close the gate channel by channel to filter interference features. The timing fusion model is an improved version of the standard TFT encoder, comprising a feature embedding layer, a causal gating layer, a timing coding layer, a weighted aggregation layer, and a coding output layer, which are connected in sequence. The causal gating layer is a new module added on the basis of the standard TFT encoder. Its input end is connected to the timing embedding feature output by the feature embedding layer, and its output end is connected to the input end of the timing coding layer. The weighted aggregation layer introduces sample weights output by a dynamic weight network to perform weighted aggregation on the sequence output by the temporal coding layer; The causal gating layer has a built-in binary mask matrix, which generates dynamic gating through learnable parameters to filter temporal features dimension by dimension.
[0034] The method of generating dynamic gating through learnable parameters to filter time-series features dimension by dimension includes: Within the causal gating layer, a gating matrix and a gating bias vector that match the temporal embedding feature dimension are configured as learnable parameters for dynamic gating. These learnable parameters participate in gradient descent training iterations as a whole with the temporal fusion model. A linear transformation is performed on the temporal embedded features output by the feature embedding layer to generate gated intermediate variables, wherein the linear transformation formula is composed of the gate matrix and the gate bias vector; An activation function is applied to the gating intermediate variable one dimension at a time, mapping the values to the (0, 1) interval to obtain the dynamic gating coefficients; The temporal embedding features, binary mask matrix, and dynamic gating coefficients are multiplied element by element. When the mask element is 0, the corresponding dimension feature output is always 0. The gating is forced to close to truncate interfering features. When the mask element is 1, the corresponding dimension feature is adaptively adjusted by the dynamic gating coefficients to output causal temporal features.
[0035] In this embodiment, time-series samples carrying sample weight labels are input into the feature embedding layer of the time-series fusion model. The feature embedding layer performs dimensionality mapping through a learnable linear transformation matrix and a bias vector, projecting the original standard features into the model's unified embedding space. Then, layer normalization is used to smooth the feature distribution at each time step, ensuring that the feature distribution input to subsequent networks is stable, and finally outputting the time-series embedded features.
[0036] Next, the temporal embedded features are input into the causal gating layer, and a gating matrix is built into the causal gating layer. With gated bias vector As a learnable parameter for dynamic gating, the learnable parameter participates in the gradient descent training iterations of the time-series fusion model. A linear transformation is performed on the temporal embedded features to generate gating intermediate variables, where the linear transformation formula consists of the gating matrix and the gating bias vector, specifically: ,in To control intermediate variables, The temporal embedding features are then used. A sigmoid activation function is applied dimension-by-dimensionally to the gated intermediate variables, mapping the values to the (0, 1) interval to obtain the dynamic gating coefficient matrix. Element-by-element multiplication is performed on the temporal embedding features, the binary mask matrix, and the dynamic gating coefficient matrix to obtain the causal temporal features. The binary mask matrix is a rigid constraint with fixed 0s and 1s; feature channels with a mask value of 0 are directly set to zero, permanently blocking that dimension's feature from participating in subsequent calculations. Only channel temporal embedding features with a mask value of 1 can be multiplied by the dynamic gating coefficients, with the learnable gating autonomously adjusting the feature contribution weights.
[0037] The causal time-series features are then input into the time-series coding layer. Time-series modeling is completed using the TFT's native gated recurrent unit and time attention mechanism. The hidden state sequence acquisition steps are as follows: First, the gated recurrent unit captures the short-term inertia and long-term cyclical patterns of fiscal revenue and expenditure, fitting the autocorrelation of fiscal data. Then, the time attention mechanism adaptively allocates attention weights for different historical months, focusing on capturing the lagged transmission effect 3-6 months after the implementation of fiscal and tax policies, matching the objective laws governing the effects of fiscal policies. Finally, the hidden state sequence is output, fully preserving the time-series dimension information.
[0038] Finally, the hidden state sequence is input into the weighted aggregation layer, the sample weights corresponding to this sample are retrieved, and weighted aggregation is performed on the hidden state sequences of all time steps of this sample to adjust the contribution of this sample to the encoding result. Then, fully connected compression is performed on the weighted aggregated features to output a fixed-length one-dimensional temporal encoding vector.
[0039] The temporal fusion model is based on the standard TFT encoder as its framework. A new causal gating layer is inserted between the original feature embedding layer and the temporal coding layer. A binary mask matrix is connected to achieve rigid causal opening and closing of feature channels and adaptive amplitude adjustment. At the same time, the original feature aggregation layer is transformed into a weighted aggregation layer, which introduces global inverse probability weights of samples. Weighted aggregation is performed after the temporal coding is completed, replacing the original equal-weight aggregation logic and taking over the spurious correction effect at the sample level.
[0040] The temporal fusion model is not trained independently, but rather forms a closed-loop training architecture together with the dynamic weight model and the prediction output layer. The global loss function used in the joint training consists of a budgeted prediction loss, a distribution balance regularization term, and loss weights that are dynamically adjusted according to the overall balance deviation. The specific formula for the global loss is as follows: ,in For the total predicted loss, Forecast losses in the budget, This is the distribution balance regularization term.
[0041] S5. Input the time-series coding vector into the prediction output layer to obtain the fiscal budget prediction result and perform risk warning.
[0042] The prediction output layer is set up with three sets of independent fully connected branches, which correspond to three core fiscal indicators: general public budget revenue, general public budget expenditure, and revenue and expenditure gap. Each branch initializes parameters independently and updates parameters independently.
[0043] In this embodiment, a multi-branch parallel fully connected structure is used to predict the output layer. Independent prediction branches are set for the three core fiscal budget indicators: general public budget revenue, general public budget expenditure, and current revenue and expenditure gap. The inputs of the three prediction branches are all connected in parallel to the encoding output of the time series fusion model. Each prediction branch adopts a two-level fully connected structure with a hidden fully connected layer and an output fully connected layer. All weight parameters and bias parameters of the hidden layer and output layer of the three branches are initialized independently and participate in gradient updates independently.
[0044] The temporal encoding vector output by the temporal fusion model is input into the prediction layer, and the same temporal encoding vector is input into the three prediction branches respectively. After the nonlinear mapping of the hidden layer and the linear regression operation of the output layer, the results are summarized to form a standardized prediction result set containing three indicators.
[0045] Next, retrieve the global mean and standard deviation of each indicator from the data preprocessing stage, perform Z-score inverse normalization on the standardized forecast values output by each branch, restore the forecast values to the original business dimension values, and output the fiscal forecast revenue series, forecast expenditure series, and forecast revenue and expenditure gap series.
[0046] Finally, the deviation rates of general public budget revenue and expenditure are calculated based on the current budget management targets. The deviation rate is the difference between the predicted value and the target value, divided by the target value. The current revenue and expenditure gap rate is calculated by dividing the predicted revenue and expenditure gap by the current available financial resources. The calculated values of the three early warning indicators are compared with their corresponding thresholds one by one. When any early warning indicator exceeds the corresponding threshold, a fiscal operation risk warning is immediately triggered, and the name of the abnormal indicator and the predicted value are output simultaneously. The revenue and expenditure gap rate threshold is based on the statutory warning line for local fiscal risk control, and the revenue and expenditure deviation rate threshold is the standard deviation of the average data of the same period over the past three years. The thresholds are updated periodically according to the annual budget targets and the status of local fiscal operation.
[0047] After a risk warning is triggered, the fiscal time-series causal graph and the minimum backdoor adjustment set are linked to calculate the causal contribution of each backdoor adjustment variable to the current prediction deviation, identify the core driving factors that cause the indicator to exceed the threshold, and sort out the risk transmission path to provide targeted support for budget adjustment and risk management.
[0048] In the end-to-end joint training phase, the current layer is used as the starting point for calculating the end-to-end loss. For each prediction branch, the mean squared error between its predicted value and the corresponding true label is calculated. The total prediction loss is obtained by summing the three errors. The loss function is then formed by weighted fusion with the overall balance deviation, where the weight of the distribution balance regularization term corresponding to the balance deviation is dynamically adjusted linearly with the balance deviation value. The gradient is propagated backward from the prediction output layer, updating the fully connected parameters of the prediction output layer, all learnable parameters of the temporal fusion model, and learnable parameters of the dynamic weight model in sequence.
[0049] The gradient of the global loss is simultaneously propagated back to the dynamic weight model, the temporal fusion model, and the prediction output layer. On the one hand, it updates the parameters of the attention aggregation layer of the dynamic weight model and corrects the calculation accuracy of the bias score and the sample inverse probability weight. On the other hand, it updates all learnable parameters of the causal gating layer and the temporal coding layer of the temporal fusion model in reverse, optimizes the causal feature filtering rules and the temporal dependency extraction effect. At the same time, it updates the fully connected parameters of the prediction output layer to optimize the regression mapping relationship of fiscal budget indicators.
[0050] In conclusion, the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
[0051] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for forecasting and early warning of local fiscal budgets based on a time-series deep learning model, characterized in that, include: Obtain heterogeneous time-series data containing discrete policy markers and continuous fiscal indicators, and preprocess the heterogeneous time-series data to obtain a standard time-series dataset; A fiscal causal graph is constructed based on the standard time series dataset. All backdoor paths are traversed, and the minimum backdoor adjustment set is selected using the backdoor criterion and a binary mask matrix is generated. Construct a dynamic weight model to estimate the dynamic score of each data sample, and substitute the dynamic score into the inverse probability formula to obtain the data sample with weight label. Substitute the data samples with weight labels into the time-series fusion model to obtain the time-series coding vector. The time-series fusion model adds a causal gating mechanism inside the standard TFT encoder. It uses the value of the binary mask matrix to control the gating to open or close the gate channel by channel to filter out interference features. The time-series coding vector is input into the prediction output layer to obtain the fiscal budget prediction results and perform risk warning.
2. The method for local fiscal budget forecasting and early warning based on a time-series deep learning model according to claim 1, characterized in that, The preprocessing of the heterogeneous time-series data includes: Mixing and alignment are performed on heterogeneous time-series data with different acquisition frequencies, and linear interpolation is used to fill in missing data values; The administrative regions are grouped and stratified Z-score standardization is performed to calculate the mean and standard deviation within each region. A multicollinearity test is performed on the standardized heterogeneous time series data, the variance inflation factor of each heterogeneous time series data is calculated, and heterogeneous time series data with variance inflation factors greater than the threshold are removed to obtain the standard time series dataset.
3. The local fiscal budget forecasting and early warning method based on a time-series deep learning model according to claim 1, characterized in that, The construction of the fiscal causal graph includes: We import machine-executable edge constraints corresponding to knowledge in the field of public finance and economics, and use these machine-executable edge constraints as rigid prior constraints of the causal graph. We then use a PC algorithm with time constraints to complete the conditional independence test, and retain only robust causal edges whose occurrence frequency is higher than a set threshold. After traversing all backdoor paths, select the blocking subset with the fewest variables as the minimum backdoor adjustment set. Assign a value of 1 to the variables belonging to the minimum backdoor adjustment set, and assign a value of 0 to the other variables to generate a binary mask matrix.
4. The method for local fiscal budget forecasting and early warning based on a time-series deep learning model according to claim 1, characterized in that, The construction of the dynamic weight model includes: Set a historical window length, divide the standard time series dataset according to the historical window length, and extract the standard time series dataset within the window as the data sample; A dynamic weight model is constructed, which includes an LSTM encoding layer, an attention aggregation layer, and a Sigmoid output layer. The attention aggregation layer applies a financial time decay penalty to the sequence output by the LSTM encoding layer and sets a minimum threshold for attention weights. Weights below the minimum threshold are forced to equal the minimum threshold and then renormalized to preserve long-term financial baseline information.
5. The method for local fiscal budget forecasting and early warning based on a time-series deep learning model according to claim 1, characterized in that, The timing fusion model is an improved version of the standard TFT encoder, comprising a feature embedding layer, a causal gating layer, a timing coding layer, a weighted aggregation layer, and a coding output layer, which are connected in sequence. The causal gating layer is a new module added on the basis of the standard TFT encoder. Its input end is connected to the timing embedding feature output by the feature embedding layer, and its output end is connected to the input end of the timing coding layer. The weighted aggregation layer introduces sample weights output by a dynamic weight network to perform weighted aggregation on the sequence output by the temporal coding layer; The causal gating layer has a built-in binary mask matrix, which generates dynamic gating through learnable parameters to filter temporal features dimension by dimension.
6. The method for local fiscal budget forecasting and early warning based on a time-series deep learning model according to claim 5, characterized in that, The method of generating dynamic gating through learnable parameters to filter time-series features dimension by dimension includes: Within the causal gating layer, a gating matrix and a gating bias vector that match the temporal embedding feature dimension are configured as learnable parameters for dynamic gating. These learnable parameters participate in gradient descent training iterations as a whole with the temporal fusion model. A linear transformation is performed on the temporal embedded features output by the feature embedding layer to generate gated intermediate variables, wherein the linear transformation formula is composed of the gate matrix and the gate bias vector; An activation function is applied to the gating intermediate variable one dimension at a time, mapping the values to the (0, 1) interval to obtain the dynamic gating coefficients; The temporal embedding features, binary mask matrix, and dynamic gating coefficients are multiplied element by element. When the mask element is 0, the corresponding dimension feature output is always 0. The gating is forced to close to truncate interfering features. When the mask element is 1, the corresponding dimension feature is adaptively adjusted by the dynamic gating coefficients to output causal temporal features.
7. The method for local fiscal budget forecasting and early warning based on a time-series deep learning model according to claim 1, characterized in that, The prediction output layer is set up with three sets of independent fully connected branches, which correspond to three core fiscal indicators: general public budget revenue, general public budget expenditure, and revenue and expenditure gap. Each branch initializes parameters independently and updates parameters independently.