Multi-user power consumption prediction method and model based on causal guidance
By combining a causal discovery framework with graph convolutional networks, the problems of spurious correlation interference and error accumulation in multivariate time series forecasting are solved, and stable and accurate forecasting of electricity consumption for multiple users is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- YUNNAN UNIV
- Filing Date
- 2026-06-08
- Publication Date
- 2026-07-03
AI Technical Summary
In multivariate time series forecasting, shared exogenous influencing factors are prone to spurious correlations, leading to error accumulation and affecting the accuracy of load warning and demand-side response for distribution areas.
A causal discovery framework is used to learn the causal relationships between variables and generate an initial causal strength matrix. Through multi-hop enhancement processing and dynamic adjacency matrix fusion, a causal enhancement adjacency matrix is constructed. Combined with a graph convolutional network, the prediction results are corrected to suppress spurious correlation interference and correct errors.
It improves the stability and interpretability of multi-user long window prediction, removes spurious correlation interference, suppresses error accumulation, and improves prediction accuracy.
Smart Images

Figure CN122332736A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of deep learning technology, and in particular to a causal-guided method and model for predicting multi-user electricity consumption. Background Technology
[0002] The load management and multi-user collaborative monitoring of distribution network areas place higher demands on hourly electricity consumption forecasting. Users within these areas are diverse (industrial, commercial, residential, etc.), and their electricity consumption behavior is influenced by both industrial and social activity patterns and exogenous factors such as weather and time. These exogenous factors include meteorological factors like temperature and humidity, and temporal factors such as holidays, weekday / weekend transitions, and monthly / seasonal cycles. The superposition of these exogenous factors results in multi-timescale characteristics in electricity consumption within distribution areas, including hourly intraday peaks and valleys, daily weekday / weekend differences, and weekly / monthly / seasonal variations. Furthermore, users in the same area share exogenous factors such as weather and time, which can easily lead to periodic synchronous fluctuations. This can cause correlation-based models to misinterpret common-cause synchronization as transmission relationships between users or variables, introducing spurious correlation edges that accumulate and amplify over long-term propagation. Under long forecast windows, errors continue to accumulate and cause forecast accuracy degradation, directly impacting operational decisions such as distribution area load warnings, peak-shifting scheduling, and demand-side response.
[0003] Therefore, this application proposes a new method for predicting user electricity consumption, which aims to characterize the causal structure between influencing factors and use causal graphs to constrain and guide the prediction process, so as to improve the stability and interpretability of multi-user long window prediction. Summary of the Invention
[0004] The main purpose of this application is to provide a causal-guided multi-user electricity consumption prediction method, which aims to solve the problems of avoiding spurious interference caused by shared exogenous influencing factors in multivariate time series prediction, and the degradation of prediction accuracy due to error accumulation during long-sequence propagation.
[0005] To achieve the above objectives, this application provides a causal-guided multi-user electricity consumption prediction method, the method comprising:
[0006] S10, Using a causal discovery framework, learn the causal relationships between variables in a multivariate time series dataset, generate an initial causal strength matrix, perform multi-hop enhancement processing on the initial causal strength matrix to obtain a causal matrix, and perform feature propagation based on the causal matrix;
[0007] S20, the causal matrix is expanded into a time-segment level dynamic causal matrix, and the dynamic causal matrix is fused with a dynamic adjacency matrix obtained by dynamic learning based on input data to construct a causal enhanced adjacency matrix;
[0008] S30, after the causal enhancement adjacency matrix is subjected to noise reduction propagation processing and normalization, the current layer input and output features of the obtained matrix are sequentially subjected to residual fusion and residual update, and all processed fragment features are rearranged and aggregated according to variable index to obtain aggregated feature tensor;
[0009] S40, based on the aggregated feature tensor, output the basic prediction result, use a graph convolutional network and a self-loop-free causal matrix constructed based on the causal matrix to perform cross-variable influence aggregation on the basic prediction result to obtain a correction amount, fuse the correction amount with the basic prediction result to obtain the corrected multi-user electricity consumption prediction result and output it.
[0010] Optionally, in step S10, the step of generating the initial causal intensity matrix includes:
[0011] S11, Obtain the multivariate time series dataset :
[0012]
[0013] In the formula:
[0014] Indicates the first One sample;
[0015] Indicates at time The sampled input variable vector; Enter the length of the history window; For time steps; Number of variables;
[0016] S12, Calculate the multivariate time series dataset The mean and standard deviation of the dataset are calculated, and each data point in the dataset is normalized based on the mean and standard deviation.
[0017] (1-1)
[0018]
[0019] In the formula, The mean; The data is after normalization; For sequence length, For the first The raw data at each time step , where is the standard deviation; for the , One variable, , For variables In the dataset The maximum value in, For variables In the dataset The minimum value in;
[0020] S13, let the normalized data For each variable, learn an embeddable vector. :
[0021]
[0022] In the formula, For embedding matrix, No. Learnable embedding vectors of variables;
[0023] S14 learns the strength of directional influence between variables through temporal convolution and attention mechanisms, and quantifies implicit dependencies into interpretable causal strength through regression correlation propagation. This forms the initial causal strength matrix R:
[0024]
[0025] In the formula, Representing variables For variables The intensity of the impact; For the first Variables in a sample The predicted value, For the corresponding input value, This represents the number of samples.
[0026] Optionally, in step S10, the initial causal intensity matrix is subjected to multi-hop enhancement processing to obtain a causal matrix, specifically including:
[0027] S15, normalize and cluster the initial causal intensity matrix to obtain the causal adjacency matrix;
[0028] S16, calculate the multi-hop propagation relationship of the causal adjacency matrix, and perform weighted summation and normalization alignment on the multi-hop propagation relationship to obtain the causal matrix, wherein,
[0029] The causality matrix The expression is:
[0030]
[0031] in:
[0032]
[0033]
[0034]
[0035] In the formula, The maximum number of propagation hops, This is the inter-jump attenuation coefficient. express Skipping causal propagation; R represents the normalized initial causality strength matrix; This represents the binary structure matrix constructed by cluster filtering in the initial causal strength matrix R.
[0036] Optionally, S20 specifically includes:
[0037] S21, using the Kronecker product to transform the causal matrix The causal edges between each variable are synchronously extended to the corresponding fragment pairs to obtain a dynamic causal matrix. :
[0038]
[0039] In the formula, It is a matrix whose elements are all 1s;
[0040] S22, dynamic causal matrix Constructed as a priori amplification term The dynamic adjacency matrix obtained by dynamic learning based on input data. Perform element-wise multiplication to construct a causal-enhancing adjacency matrix. :
[0041]
[0042] In the formula, To enhance the causal adjacency matrix, This represents Hadamard element-wise multiplication. A matrix consisting entirely of 1s of the same dimension. This is a learnable causal scaling factor.
[0043] Optionally, the dynamic adjacency matrix The structure specifically includes:
[0044] S221, [This appears to be a partial sentence fragment, possibly related to a causal matrix.] Modulated features Reorder by variable and fragment index, then concatenate to form the main input. :
[0045]
[0046]
[0047]
[0048] In the formula, Indicates the first In the nth sample The modulated feature vector of each node, Indicates the first The backbone input feature matrix of each sample This represents the main input feature tensor of the entire batch. For batch size, For the number of variables, The number of time segments corresponding to each variable. This represents the total number of dynamic nodes after rearrangement. For feature dimension, For variable index, For time segment indexing, For the reason The one-dimensional node index obtained by mapping, For sequential stacking operations;
[0049] S222, Characteristics of power consumption of main input lines A linear mapping is performed to map the original fragment representation to a query space and a key space of the same dimension, enabling the fragment nodes to dynamically calculate the relevance based on the features of the current input sample, resulting in the query matrix and the key matrix:
[0050]
[0051]
[0052] In the formula, and These are the learnable parameter matrices for the query projection layer and the key projection layer, respectively, which are obtained through joint learning via backpropagation during the training process.
[0053] S223, query matrix AND key matrix transpose Perform matrix multiplication to obtain the pairwise matching scores between segments, and then... Activation functions enhance nonlinear discrimination capabilities, and adjacency score matrices are constructed accordingly. :
[0054]
[0055] In the formula, This represents the segment-level correlation matrix obtained through dynamic learning based on the current input samples. This is the Gaussian error linear unit activation function, used to enhance nonlinear expressive power.
[0056] Optionally, in step S30, the causal enhancement adjacency matrix is subjected to noise reduction propagation processing and normalization, specifically including:
[0057] S31, for the enhanced adjacency matrix Each row is sorted from highest to lowest score. Only high-confidence structural neighbors that meet the set criteria are selected as connected objects and the network connection is marked as valid state 1. A K-nearest neighbor mask matrix is constructed. :
[0058]
[0059] In the formula, Denotes the K-nearest neighbor mask matrix. This represents the number of high-scoring neighbors retained by each node. This indicates selecting the row with the highest score. The operation of setting each element to 1;
[0060] S32 determines whether propagation is allowed based on routing rules; if allowed, it sets to 1, otherwise it sets to 0, and outputs only the location indication results containing allowed propagation paths, constructing a routing mask matrix. To control the areas where transmission is permitted:
[0061]
[0062] S33, enhance the causal adjacency matrix K-nearest neighbor mask matrix and routing mask matrix Perform element-wise multiplication to obtain the denoised adjacency matrix. To preserve connections between electricity consumption influencing factors that simultaneously satisfy the following criteria: high impact score, conformity to electricity consumption characteristic routing, and causal support:
[0063]
[0064] S34, adjacency matrix for noise reduction Row normalization is performed by dividing each row element by the sum of the row elements to ensure stable propagation weights across different nodes, resulting in a row-normalized adjacency matrix. This completes the noise reduction propagation process and normalization.
[0065] .
[0066] Optionally, in S30, the current layer input and output features of the obtained matrix are sequentially subjected to residual fusion and residual update. All processed fragment features are rearranged and aggregated according to variable indices to obtain an aggregated feature tensor, specifically including:
[0067] S35 uses a linear mapping layer to combine the user's electricity consumption segment input to the current layer with environmental features. Projecting the model onto the new high-dimensional electricity consumption pattern feature space yields the preliminary transformed feature matrix. Normalize the adjacency matrix With characteristic matrix Perform multiplication operations for noise reduction propagation:
[0068]
[0069] In the formula, For output features, The learnable parameter matrix of the linear mapping layer is automatically learned during the training of the backbone network.
[0070] S36, after noise reduction propagation, the current layer input Output after noise reduction Perform residual fusion:
[0071]
[0072] S37 introduces a feedforward network to update features using residuals, in order to fit the complex changes in multi-user load during peak-valley switching:
[0073]
[0074] In the formula, Indicates a feedforward network;
[0075] S38, the variable indices are rearranged and all fragment features under the same variable are concatenated, aggregating the information scattered in the fragments into a user-level representation, resulting in the aggregated feature tensor. :
[0076]
[0077] In the formula, This indicates a tensor dimension rearrangement operation that changes only the data organization structure without changing the values of the elements.
[0078] Optionally, in S40, a graph convolutional network is used, and a loop-free causal matrix is constructed based on the causal matrix to perform cross-variable influence aggregation on the basic prediction results to obtain a correction amount. The correction amount is then fused with the basic prediction results to obtain and output the corrected multi-user electricity consumption prediction results, specifically including:
[0079] S41, the normalized causal matrix and the self-loop shielding matrix are multiplied element-wise to remove self-feedback terms. By eliminating local self-reinforcing effects, the model is forced to focus on cross-external external connections, thus constructing a diagonalized, self-loop-free causal matrix that reflects the multi-agent association structure. :
[0080]
[0081] In the formula, It is a causal matrix without self-loops. It is a causal matrix. A matrix consisting entirely of 1s of the same dimension. for 3D identity matrix;
[0082] S42, the graph convolutional network includes two graph convolutional layers, wherein the first graph convolutional layer aggregates direct upstream influences and incorporates cross-variable influences into the correction:
[0083]
[0084] In the formula, This is the output of the first causal convolution layer. Based on the prediction results, and These are the weight matrix and bias vector of the first linear mapping layer, respectively. The time dimension is hidden in the middle;
[0085] The second-layer causal graph convolution enhances the influence of indirect electricity consumption causality and maps intermediate features back to the output time dimension, thereby applying multi-hop causal transmission to the output and reducing structural bias in long window prediction.
[0086]
[0087] In the formula, This is the output of the second causal convolution layer. and These are the weight matrix and bias vector of the second linear mapping layer, which are automatically updated during the training phase through backpropagation.
[0088] S43, causal correction amount As a basis for the prediction results The supplementary items yield the corrected multi-user electricity consumption prediction results:
[0089]
[0090] In the formula, This is the feature matrix of the final multi-user electricity consumption prediction result after correction by the causal graph convolution correction unit. This is a learnable correction intensity parameter.
[0091] Optionally, the method further includes:
[0092] Construct the total loss function:
[0093]
[0094] In the formula, To weighted predict losses, For MoE load balancing losses, For sparse regularization loss of causal graphs, This indicates calculating the mean of the matrix elements. and These are the MoE loss weights and the sparse regularization weights, respectively.
[0095] The learning rate is adjusted using a cosine annealing strategy, and the prediction model is trained based on the total loss function.
[0096] Furthermore, to achieve the above objectives, this application also provides a causal-guided multi-user electricity consumption prediction model, which includes:
[0097] The causal guidance module is used to learn the causal relationships between variables in a multivariate time series dataset using a causal discovery framework, generate an initial causal strength matrix, perform multi-hop enhancement processing on the initial causal strength matrix to obtain a causal matrix, and expand the causal matrix into a dynamic causal matrix at the time segment level. The dynamic causal matrix is then fused with a dynamic adjacency matrix obtained by dynamic learning based on the input data to construct a causal enhancement adjacency matrix.
[0098] The feature modulation and propagation module is used to perform feature propagation based on the causal matrix, and to perform noise reduction propagation processing and normalization on the causal enhanced adjacency matrix, and then perform residual fusion and residual update on the current layer input and output features of the obtained matrix in sequence, and rearrange and aggregate all processed fragment features according to variable index to obtain an aggregated feature tensor.
[0099] The prediction correction module is used to output a basic prediction result based on the aggregated feature tensor, and to perform cross-variable influence aggregation on the basic prediction result using a graph convolutional network and a self-loop-free causal matrix constructed based on the causal matrix to obtain a correction amount. The correction amount is then fused with the basic prediction result to obtain and output the corrected multi-user electricity consumption prediction result.
[0100] This application has at least the following beneficial effects:
[0101] 1. Utilize causal discovery and multi-hop enhancement mechanisms to remove interference from spurious correlations between variables in the source dataset;
[0102] 2. In the feature propagation stage, static causal constraints are fused with dynamic data-driven correlations, and noise reduction propagation is performed under the constraints of real causal paths, thereby suppressing random fluctuations and noise interference caused by cross-users.
[0103] 3. In the prediction correction stage, the prediction results are corrected by multi-hop spatial correction based on the causal graph convolution correction unit, which avoids the divergence of cumulative prediction error in long sequence models. Attached Figure Description
[0104] Figure 1 This is a flowchart illustrating the causal-guided multi-user electricity consumption prediction method involved in the embodiments of this application;
[0105] Figure 2 This is a schematic diagram of the architecture of the causal-guided multi-user electricity consumption prediction method involved in the embodiments of this application;
[0106] Figure 3 This is an example diagram of two-hop causal enhancement involved in the embodiments of this application.
[0107] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0108] To better understand the above technical solutions, exemplary embodiments of this disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of this disclosure to those skilled in the art.
[0109] First Embodiment
[0110] Reference Figure 1 and Figure 2 This embodiment provides a causal-guided multi-user electricity consumption prediction method, which includes the following steps:
[0111] S10, Using a causal discovery framework, learn the causal relationships between variables in a multivariate time series dataset, generate an initial causal strength matrix, perform multi-hop enhancement processing on the initial causal strength matrix to obtain a causal matrix, and perform feature propagation based on the causal matrix;
[0112] In multivariate time series scenarios, variables often have complex interactions and are easily affected by shared exogenous factors such as weather conditions and holidays, leading the model to learn spurious "pseudo-correlation" relationships. This step uses causal discovery methods to mine the true causal connection patterns between variables from historical data, rather than relying solely on statistical correlation. The constructed causal matrix can accurately characterize the direct and indirect influences between variables, thus providing reliable physical constraints for subsequent feature processing and eliminating the interference of spurious correlation factors at the source.
[0113] Specifically, historical time-series electricity consumption data of each user in the area to be predicted is collected as input data, including hourly electricity consumption data for each user and external variables such as temperature, humidity, and date. The electricity consumption data is arranged and divided by timestamp to form a multivariate time-series dataset. ,in Indicates the first One sample, Indicates at time The sampled input variable vector, To input the history window length, For time steps, The number of variables. Due to the diverse sources and significant quality differences in the multi-user data, missing value imputation, outlier handling, and removal of non-numerical columns are necessary. The processed sample data serves as input for both causal discovery mapping and prediction.
[0114] In multi-user electricity consumption forecasting, the load scales of different users vary greatly. If trained directly, the model is easily dominated by high-load users and masks the causal changes of medium and low-load users. To provide a stable numerical basis for subsequent causal modeling while retaining the ability of the results to return to the true scale, the Reversible Instance Normalization (RevIN) method is used to process the backbone forecast input data in the forecast input part.
[0115]
[0116]
[0117] In the formula, For sequence length, For the first The raw data at each time step The mean, Standard deviation This is the normalized data. In the causal discovery section, the MinMax method is used for scaling, specifically for the [missing data]. One variable, , For variables The maximum value of in the training set. For variables The minimum value of in the training set.
[0118] To distinguish between variables with genuine causal relationships and those correlated only due to common period synchronization, and to mitigate the problem of spurious correlation features being amplified and accumulating in deep propagation, a causal gating enhancement method for input features is designed, based on a normal distribution. Initialize and update each variable end-to-end during the training phase using the total loss function to learn an embeddable vector. :
[0119]
[0120] In the formula, For embedding matrix, No. Learnable embedding vectors of 1 variable.
[0121] In regional multi-user electricity systems, electricity consumption is driven by exogenous factors such as weather and time, and is prone to common-cause synchronization. To avoid forming false connections based solely on correlation, the CausalFormer causal discovery framework is extended to learn the causal relationships between variables. Temporal convolution and attention mechanisms are used to learn the directional influence strength between variables, and then regression correlation propagation is used to quantify implicit dependencies into interpretable causal strength, corresponding to the variables. For variables The intensity of influence is defined as:
[0122]
[0123] In the formula, Representing variables to variable The influence strength, where the initial causal strength matrix is... , For the first Variables in a sample The predicted value, For the corresponding input value, This represents the number of samples.
[0124] In this step, the initial causal strength matrix is subjected to multi-hop enhancement processing to obtain the causal matrix, specifically including:
[0125] S15, normalize and cluster the initial causal intensity matrix to obtain the causal adjacency matrix;
[0126] S16, calculate the multi-hop propagation relationship of the causal adjacency matrix, and perform weighted summation and normalization alignment on the multi-hop propagation relationship to obtain the causal matrix.
[0127] Specifically, in multi-user power systems, sudden changes in exogenous factors such as weather and time may cause short-term synchronous fluctuations in power consumption among multiple users, thus forming weakly correlated noise edges in the correlation structure. To suppress such noise interference and enhance the interpretability of the causal structure, intensity normalization is first performed. Then, KMeans clustering is performed on the intensity vector of each target variable, and the cluster with the largest cluster center is selected. Each cluster is a high-confidence cluster; construct a binary structure matrix. and with the intensity matrix Topological fusion removes weak noise edges to obtain a causal adjacency matrix. To capture indirect causal relationships in multi-user power systems, a multi-hop enhancement mechanism for influence intensity is designed to characterize direct and indirect effects, defined as:
[0128]
[0129] In the formula, The maximum number of propagation hops, This is the inter-jump attenuation coefficient. express Skip the causal propagation relationship.
[0130] After multiple hops are superimposed, the magnitudes of different power consumption nodes may differ significantly. To ensure that different factors affecting power consumption participate in subsequent calculations on the same scale, normalization and alignment are performed:
[0131]
[0132] In graph theory, the adjacency matrix... Power of 1 The lengths of all paths in the corresponding graph are The calculation process for the edges involves traversing all intermediate nodes on the path, multiplying the causal strengths of each segment on the path, and then summing the results to quantify the causal strength. The total effect of inter-hop propagation, and then introducing the inter-hop attenuation coefficient. This allows for the reasonable reduction of the marginal effects of long-distance propagation, avoiding distortion of the impact intensity caused by multi-hop superposition. For example, a two-hop causal enhancement is used as an illustration, referring to... Figure 3 The example shown illustrates a two-hop causal reinforcement where the original network containing nodes A, B, and C only has direct effects from A→B and B→C (with strengths of [missing information]). =0.563、 =0.862), A and C are not directly connected, but through two-hop enhancement, the indirect influence of A on C is expressed by the formula Calculation, where =0.5 is the inter-jump attenuation coefficient, substituting it into the equation yields... =0.243. Therefore, the original network adds an indirect causal edge from A to C, forming an enhanced causal relationship that integrates direct and two-hop indirect influences.
[0133] In this step, the causal matrix is obtained. Then, based on the causal matrix Feature propagation is performed. It's important to note that in traditional propagation processes based on graph neural networks or attention mechanisms, information often flows along the path of highest correlation, easily leading to the false propagation of spurious connections and noise amplification. Therefore, this embodiment extends and integrates the causal matrix into the propagation structure, forcing information flow to follow true causal paths—only variables with causal support are allowed effective information interaction, while connections lacking causal support are blocked or suppressed. Through this constraint, the model can accurately capture the true cooperative patterns between variables in complex transient environments, effectively suppressing random fluctuations and noise interference across variables, and preventing the spread of erroneous edges.
[0134] Specifically, causal feature enhancement is designed at the input end. The direct and indirect effects of each factor influencing electricity consumption in the causal graph are encoded as propagable weights. Through causal weighted aggregation, a variable-level causal context is formed. This ensures that factors with strong causal relationships to user electricity consumption contribute more, while factors with weak or no causal relationships contribute less or nothing. This improves the sensitivity and interpretability of the input features to key factors affecting electricity consumption. Based on this idea, a normalized multi-hop causal matrix is used to aggregate the context.
[0135]
[0136] In the formula, This is the causal context matrix.
[0137] Considering the differences in response intensity to exogenous influencing factors such as weather and time among different types of users within the region, and their different roles in the causal network, to avoid weakening the original influence intensity and amplifying noise of key electricity consumption influencing factors due to applying the same feature processing method to all users, an adaptive enhancement intensity allocation mechanism is designed in the gating stage. The gating network learns the modulation coefficients and automatically determines the enhancement amplitude according to the causal role context.
[0138]
[0139] In the formula, For learnable weight matrix, For bias vectors, For variables The causal context vector, The Sigmoid activation function has an output range of... , is the activation function for the Gaussian error linear unit.
[0140] On the other hand, electricity consumption time-series data exhibits periodicity across multiple time scales. To effectively capture local fluctuation patterns at different scales, this embodiment divides the long-term series into short segments. For the input sequence... ,in For batch size, based on fragment length and step length Cut into Each segment Projecting the linear layer into the latent space and adding positional encoding. This allows the model to focus on local temporal patterns:
[0141]
[0142]
[0143] In the formula, Let be the projection matrix. For bias vectors, For hidden layer dimensions, For position encoding.
[0144] To achieve adaptive enhancement without altering the original feature orientation, and to amplify electricity consumption influencing factors with strong causal support while suppressing those with weak causal support, the final electricity consumption feature enhancement formula is designed as follows:
[0145]
[0146] In the formula, For element-wise multiplication, It is a vector of all 1s. This is a learnable modulation intensity parameter.
[0147] S20, the causal matrix is expanded into a time-segment level dynamic causal matrix, and the dynamic causal matrix is fused with a dynamic adjacency matrix obtained by dynamic learning based on input data to construct a causal enhanced adjacency matrix;
[0148] In this step, the variable-level relationships described by the static causal matrix need to be mapped to the segment level to constrain the information flow between segments. For example, if variable A has a causal influence on variable B, the expanded dynamic causal matrix will assume that any time segment of variable A has a potential causal connection to any time segment of variable B. This expansion method can preserve the topological integrity of the static causal structure while preventing the model from deviating from the causal path during fine-grained propagation.
[0149] Since static causal matrices cannot adapt to sudden dynamic changes such as a user’s sudden change in electricity consumption behavior, this step further introduces a data-driven dynamic adjacency matrix for fusion in order to balance stability and flexibility.
[0150] The dynamic adjacency matrix is dynamically calculated by a graph learner based on the features of the current input sample, reflecting the real-time correlation between segments at the current moment.
[0151] Further and optionally, the fusion process employs element-wise multiplication (Hadamard product), superimposing the dynamic causal matrix as a prior amplification term onto the dynamic adjacency matrix. Specifically, for each connection score in the dynamic adjacency matrix, if the connection has causal support in the dynamic causal matrix (i.e., there is a causal edge between the corresponding static variables), its score is amplified; conversely, if there is a lack of causal support, the original score is maintained or suppressed, specifically including:
[0152] S221, [This appears to be a partial sentence fragment, possibly related to a causal matrix.] Modulated features Reorder by variable and fragment index, then concatenate to form the main input. :
[0153]
[0154]
[0155]
[0156] In the formula, Indicates the first In the nth sample The modulated feature vector of each node, Indicates the first The backbone input feature matrix of each sample This represents the main input feature tensor of the entire batch. For batch size, For the number of variables, The number of time segments corresponding to each variable. This represents the total number of dynamic nodes after rearrangement. For feature dimension, For variable index, For time segment indexing, For the reason The one-dimensional node index obtained by mapping, For sequential stacking operations;
[0157] S222, Characteristics of power consumption of main input lines A linear mapping is performed to map the original fragment representation to a query space and a key space of the same dimension, enabling the fragment nodes to dynamically calculate the relevance based on the features of the current input sample, resulting in the query matrix and the key matrix:
[0158]
[0159]
[0160] In the formula, and These are the learnable parameter matrices for the query projection layer and the key projection layer, respectively, which are obtained through joint learning via backpropagation during the training process.
[0161] S223, query matrix AND key matrix transpose Perform matrix multiplication to obtain the pairwise matching scores between segments, and then... Activation functions enhance nonlinear discrimination capabilities, and adjacency score matrices are constructed accordingly. :
[0162]
[0163] In the formula, This represents the segment-level correlation matrix obtained through dynamic learning based on the current input samples. This is the Gaussian error linear unit activation function, used to enhance nonlinear expressive power.
[0164] Furthermore, and optionally, while the causal relationships between factors influencing actual electricity consumption provide stable and reliable structural constraints in actual electricity consumption forecasting, they may not be adaptable to dynamically changing electricity consumption patterns and are susceptible to spurious correlations. To map static variable relationships to dynamic propagation relationships, an ordered pair consisting of two node segments is defined as a segment pair. The Kronecker product is used to synchronously extend the causal edges between each variable to the corresponding segment pairs, thus defining a dynamic causal matrix. :
[0165]
[0166] In the formula, It is a dynamic causal matrix. This is a static causal matrix between variables. It is a matrix whose elements are all 1s.
[0167] In multi-user power systems, users in the same area share exogenous influencing factors such as weather and time, often resulting in periodic synchronization fluctuations and the formation of spurious correlations. To suppress the propagation of spurious connections in the network, this application amplifies correlations along causally supported paths while suppressing connections without causal support, using data to drive the correlation matrix. With prior amplification term Perform element-wise multiplication to construct a causal-enhancing adjacency matrix. :
[0168]
[0169] In the formula, To enhance the causal adjacency matrix, This represents Hadamard element-wise multiplication. A matrix consisting entirely of 1s of the same dimension. This is a learnable causal scaling factor.
[0170] The results were:
[0171] S21, using the Kronecker product to transform the causal matrix The causal edges between each variable are synchronously extended to the corresponding fragment pairs to obtain a dynamic causal matrix. :
[0172]
[0173] In the formula, It is a matrix whose elements are all 1s;
[0174] S22, dynamic causal matrix Constructed as a priori amplification term The dynamic adjacency matrix obtained by dynamic learning based on input data. Perform element-wise multiplication to construct a causal-enhancing adjacency matrix. :
[0175]
[0176] In the formula, To enhance the causal adjacency matrix, This represents Hadamard element-wise multiplication. A matrix consisting entirely of 1s of the same dimension. This is a learnable causal scaling factor.
[0177] S30, after the causal enhancement adjacency matrix is subjected to noise reduction propagation processing and normalization, the current layer input and output features of the obtained matrix are sequentially subjected to residual fusion and residual update, and all processed fragment features are rearranged and aggregated according to variable index to obtain aggregated feature tensor;
[0178] In this step, in order to effectively filter out redundant, weakly correlated, non-conductive noise sidestreams and invalid pseudo-connection spatial paths in the factors affecting the power distribution sensor data collection, we further perform noise reduction propagation processing and normalization on the causal enhancement adjacency matrix.
[0179] Specifically, for the enhanced adjacency matrix Each row is sorted from highest to lowest score. Only high-confidence structural neighbors that meet the set criteria are selected as connected objects and the network connection is marked as valid state 1, completely blocking the propagation of other low-energy interference. Based on this, a K-nearest neighbor mask matrix is constructed. :
[0180]
[0181] In the formula, Denotes the K-nearest neighbor mask matrix. This represents the number of high-scoring neighbors retained by each node. This indicates selecting the row with the highest score. The operation of setting each element to 1.
[0182] Multi-user electricity consumption feature propagation also exhibits structural differences. There is autocorrelation between electricity consumption segments of the same user at different times, cross-user influence between electricity consumption segments of different users at the same time, and long-range global dependencies between other cross-user and cross-time segments. Therefore, a hybrid MoE routing strategy is adopted, classifying propagation modes into three types of experts: self-attention experts for different segments of the same variable, cross-variable attention experts for different variables at the same time, and global attention experts at other locations. The routing network adaptively generates weights for the three types of experts based on the current segment features and performs weighted fusion of the masks of the three types of experts to obtain the final propagation mask, thereby automatically selecting the attention mode more suitable for the current segment relationship.
[0183] Meanwhile, to accurately distinguish the continuous correlation of the same electricity consumption influencing factor across different time periods, the instantaneous interactive correlation between different features within the same time period, and the fluctuation correlation of other general electricity consumption influencing factors, a differentiated retention strategy is adopted for the connections between different electricity consumption feature segments. Based on routing rules, it is determined whether propagation is allowed; if allowed, the value is set to 1, and if not, it is set to 0. The system outputs only the location indication results containing allowed propagation paths, and a routing mask matrix is designed. Control the area where propagation is permitted:
[0184]
[0185] After completing the route selection, the causal-enhanced adjacency matrix will be... K-nearest neighbor mask matrix and routing mask matrix Perform element-wise multiplication, retaining only the connections between electricity consumption influencing factors that simultaneously satisfy high impact scores, conform to electricity consumption characteristic routing, and have causal support. Truncate the connections between other electricity consumption influencing factors without substantial physical connection, resulting in the denoised adjacency matrix. :
[0186]
[0187] In the causal graph of various influencing factors in the power consumption system, the number of connection edges varies among different power consumption influencing factors / segments. To avoid propagation instability caused by differences in the number of neighbors among different nodes, the adjacency matrix for noise reduction is modified. Row-normalization is performed by dividing each row element by the sum of its elements to ensure stable propagation weights across different nodes, resulting in a row-normalized adjacency matrix. :
[0188]
[0189] In this embodiment, after obtaining the resulting matrix Then, the resulting matrix The current layer input and output features are sequentially subjected to residual fusion and residual update. All processed fragment features are rearranged and aggregated according to variable index to obtain the aggregated feature tensor.
[0190] Specifically, message passing is performed using a normalized adjacency matrix, and a linear mapping layer is used to map the input user electricity consumption segments with environmental features such as weather conditions. Projecting the model onto the new high-dimensional electricity consumption pattern feature space yields the preliminary transformed feature matrix. Next, the normalized adjacency matrix will be... By performing a multiplication operation with this feature matrix, each electricity consumption feature node can fully aggregate the information of its effective causal neighbor influencing factors according to the association weight, thereby completing the dynamic update of the electricity consumption feature status:
[0191]
[0192] In the formula, For output features, This is the learnable parameter matrix of the linear mapping layer, which is automatically learned during the training of the backbone network.
[0193] After noise reduction and propagation, each segment is mixed with information on factors affecting neighboring electricity consumption. To better distinguish the load differences of different users at different times, avoid overly smooth segments, and retain effective causal information after noise reduction, the model retains an original information path at each layer. The input of the current layer is then residually fused with the output after noise reduction.
[0194]
[0195] After completing the first residual update, it is necessary to enhance the nonlinear expressive power of the features to better fit the complex changes in multi-user load during peak-valley switching. A second residual update is designed, and a feedforward network is introduced to ensure that the features maintain training stability while enhancing their expressive power.
[0196]
[0197] In the formula, This represents a feedforward network.
[0198] After noise reduction propagation and residual update, the features remain at the fragment level. However, the actual prediction target is the electricity consumption of each user in the future. Therefore, it is necessary to restore the fragment information to the variable level, rearrange and concatenate all fragment features under the same variable according to the variable index, and aggregate the information scattered in the fragments into a user-level representation to obtain the aggregated feature tensor. :
[0199]
[0200] In the formula, This indicates a tensor dimension rearrangement operation that changes only the data organization structure without changing the values of the elements.
[0201] S40, based on the aggregated feature tensor, output the basic prediction result, use a graph convolutional network and a self-loop-free causal matrix constructed based on the causal matrix to perform cross-variable influence aggregation on the basic prediction result to obtain a correction amount, fuse the correction amount with the basic prediction result to obtain the corrected multi-user electricity consumption prediction result and output it.
[0202] In this embodiment, the high-dimensional denoising obtained in the previous step is focused on the multi-household aggregated feature representation. Then, it is directly guided to the linear decision mapping layer of the prediction and planning module in the final business scenario.
[0203] During the training phase, the actual electricity consumption data from electricity distribution and billing points are used as real supervisory signals to drive model parameter updates and matching. Error correction is performed by inferring the error through joint global loss and simultaneously adjusting the key weights of the backbone network and decision head. Adaptation is then performed. During the inference phase, the basic usage forecast values adapted to the future business environment can be directly output using the modeling coefficients as the basic forecast results:
[0204] 1
[0205] In the formula, Based on the prediction results, To predict the learnable weight matrix of the head linear layer, The corresponding bias vectors are all learned through backpropagation of the loss during the training phase.
[0206] After feature propagation and obtaining the basic prediction results, this step further utilizes the causal matrix to spatially correct the prediction results. Long-window prediction often faces the problem of error accumulation; as the prediction step size increases, small structural biases are amplified. This step constructs correction units based on the causal matrix, and through cross-variable influence aggregation, incorporates the causal influence of other variables into the correction consideration, supplementing or adjusting the basic prediction results. This correction mechanism is equivalent to adding a "physical check" at the end of the prediction process, using the causal transmission relationship between variables to correct prediction biases, thereby preventing the accumulation of errors in long-term time-series inference.
[0207] Specifically, in multi-user scenarios, to avoid the model over-relying on single-user history and weakening the causal constraints of other electricity consumption influencing factors, the normalized causal matrix is multiplied element-wise with the self-loop masking matrix to remove self-feedback terms. By eliminating local self-reinforcing effects, the model is forced to focus on cross-external connections, thus constructing a diagonalized, self-loop-free causal matrix that reflects the multi-subject association structure. :
[0208]
[0209] In the formula, It is a causal matrix without self-loops. For the normalized causal matrix, A matrix consisting entirely of 1s of the same dimension. for 3D identity matrix.
[0210] To mitigate biases in basic prediction results caused by insufficient cross-variable constraints, and considering that multi-user electricity conduction has both direct and indirect effects, a causal graph convolution correction unit is designed to improve the basic prediction output. The correction is then performed. The correction unit employs a two-layer graph convolution. The first layer aggregates direct upstream influences and incorporates cross-variable influences into the correction.
[0211]
[0212] In the formula, This is the output of the first causal convolution layer. Based on the prediction results, and These are the weight matrix and bias vector of the first linear mapping layer, respectively. The time dimension is hidden in the middle.
[0213] To further enhance the influence of indirect electricity consumption causality and map intermediate features back to the output time dimension, a second-layer causal graph convolution is designed to apply multi-hop causal propagation to the output, thereby reducing structural bias in long-window prediction.
[0214]
[0215] In the formula, This is the output of the second causal convolution layer. and These are the weight matrix and bias vector of the second linear mapping layer, respectively, which are automatically updated through backpropagation during the training phase.
[0216] Considering that direct replacement would amplify structural deviations when slight errors exist in the electricity consumption causality graph, a residual fusion strategy is designed to use the causal correction as a supplement to the basic prediction, resulting in a corrected multi-user electricity consumption prediction.
[0217]
[0218] In the formula, This is the feature matrix of the final multi-user electricity consumption prediction result after correction by the causal graph convolution correction unit. This is a learnable correction intensity parameter.
[0219] In the technical solution provided in this embodiment, causal discovery and multi-hop enhancement mechanisms are used to remove the interference of spurious correlation factors between variables in the source dataset; in the feature propagation stage, static causal constraints are fused with dynamic data-driven correlations, and noise reduction propagation is performed under the constraints of real causal paths, thereby suppressing random fluctuations and noise interference caused by cross-users; in the prediction correction stage, multi-hop spatial correction is performed on the prediction results based on the causal graph convolution correction unit, avoiding the divergence of cumulative prediction errors in long sequence models.
[0220] Second Embodiment
[0221] Based on the first embodiment, this embodiment provides a method for training the prediction model involved in the first embodiment, specifically including:
[0222] S100, Construct the total loss function:
[0223]
[0224] In the formula, To weighted predict losses, For MoE load balancing losses, For sparse regularization loss of causal graphs, This indicates calculating the mean of the matrix elements. and These are the MoE loss weights and the sparse regularization weights, respectively.
[0225] S200, a cosine annealing strategy is used to adjust the learning rate, and the prediction model is trained based on the total loss function.
[0226] The training process is described in detail below:
[0227] To measure the significant differences in the importance of different influencing factors in the causal network, a degree-centrality causal weighted loss is designed. The prediction error is weighted according to the structural importance of each user in the causal graph, allowing the model to assign higher error penalties to key electricity-driven variables during training. This is applied to the normalized causal matrix. Calculate the first one respectively The out-degree and in-degree strengths of each variable are used to determine the overall degree centrality. The out-degree represents the total strength of its outward propagation influence, while the in-degree represents the total strength of its received external influence. Adding the two together yields the overall degree centrality.
[0228]
[0229]
[0230] In the formula, Indicates the first One electricity consumption variable points to the out-degree of other variables. This indicates that other variables point to the first... The in-degree of each variable. This indicates overall degree centrality; nodes in critical positions within the system typically exhibit high degree centrality. The value, while for edge nodes with a smaller impact range, its Typically lower.
[0231] To give highly central variables a higher but still controlled loss weight, first... Centrality of individual electricity consumption variables Maximum centrality among all variables Normalize the ratio, then use the contrast coefficient. The importance differences between variables are amplified, and finally the weights are renormalized using the average scale of all variables to construct the variable loss weights. :
[0232]
[0233] In the formula, Indicates the first Loss weights for each variable, A contrast hyperparameter greater than 0 is used to adjust the weight difference between high-centrality and low-centrality variables. It represents the maximum centrality among all variables.
[0234] To guide the model to prioritize learning key variables while also considering prediction errors across the entire time window, a weighted mean squared error loss is further designed to automatically shift the training focus towards key variables. The weighted mean squared error loss is defined as follows: :
[0235]
[0236] In the formula, To predict tensors, For the real label tensor, For variable weight vectors, This represents element-wise multiplication in a broadcast sense, where the weight vector is broadcast along the batch dimension and the prediction time dimension.
[0237] On the other hand, considering the significant differences among different types of users within a region under the influence of exogenous factors such as weather and time, to prevent the model from overfitting a single mainstream electricity consumption trend when capturing cross-time period electricity consumption characteristics, thus leading to distorted electricity consumption predictions for a few users, the MoE load balancing loss is used. First, the expert selection probability is calculated based on route scoring, and then route collapse is suppressed jointly by load dispersion and entropy constraints, defined as:
[0238]
[0239]
[0240] In the formula, For sample index, For fragment index, Expert Index Total number of MoE experts No. In the nth sample The routing input feature vector of each segment, Gated linear mapping parameters, Original route scoring vector, Noise scale mapping parameters, The random noise vector injected during training. The route scoring vector after adding noise.
[0241] The scores were then normalized to convert them into comparable expert assignment probabilities.
[0242]
[0243]
[0244] In the formula, No. In the nth sample The fragment is assigned to the first The probability of an expert, No. The cumulative workload of an expert across the entire batch and the entire segment. Expert load vector, Gating function, The noise scale is constrained to a positive value. The load dispersion term measures whether the load is balanced. The routing probability entropy term is used to suppress route collapse. The entropy regularization weight.
[0245] Based on this, a sparse regularization for the causal graph of electricity is designed to suppress the propagation of low-value connections, defined as:
[0246]
[0247] Then, the prediction error, route balancing, and sparsity constraints are combined into a unified training objective to ensure that the three are optimized collaboratively in the same parameter update, thus constructing the total loss:
[0248]
[0249] In the formula, To weighted predict losses, For MoE load balancing losses, For sparse regularization loss of causal graphs, This indicates calculating the mean of the matrix elements. and These are the MoE loss weights and the sparse regularization weights, respectively.
[0250] To maintain a fast convergence speed in the early stages of training and achieve more stable refinement optimization in the later stages, this embodiment employs a cosine annealing scheduling strategy. The learning rate is updated after each training epoch, and the scaling ratio of the causal module's learning rate relative to the backbone network is restored after the update, ensuring that the learning rate of the causal module is optimized accordingly. The learning rate for each training epoch decays smoothly with each epoch, specifically as follows:
[0251]
[0252] In the formula, The initial learning rate, For the total number of training rounds, This refers to the current round.
[0253] During the inference phase, the multi-user electricity consumption prediction results output by the model need to be restored to actual physical dimensions. Since RevIN normalization was used during training, the predicted values are on a standardized scale, requiring the feature matrix of the prediction results to be adjusted. The predictive characteristics of each variable were inversely normalized to restore them to the original electricity consumption units. For the first... The variables at time... Normalized predicted values Compare it with the standard deviation preserved during the training phase. Multiply and add the corresponding mean ,get Predicted values after inverse normalization at time:
[0254]
[0255] In the formula, For variable index, and For RevIN on variables The normalized parameters stored on the corresponding samples, for a fixed time... , Prediction vectors for each variable.
[0256] Final output coverage prediction length Prediction range Result matrix :
[0257]
[0258] In the formula, The Row corresponding variable exist The predicted sequence.
[0259] Finally, from the prediction result matrix Extract the predicted user electricity consumption results .
[0260] Verification of Examples
[0261] Based on any of the above embodiments, this embodiment uses specific parameters to illustrate the content of the above embodiments. Taking the electricity consumption of each user in a certain area of city A over the next 720 hours (30 days) as an example, a prediction is made:
[0262] According to step S10, historical hourly electricity consumption data for the past four years from 347 users in the area to be predicted in city A are collected from the power grid and meteorological station of city A. This includes 15 meteorological exogenous variables (temperature, humidity, dew point temperature, perceived temperature, precipitation, rainfall, snowfall, air pressure, cloud cover, shortwave radiation, direct radiation, diffuse radiation, wind speed, wind direction, gusts) and 8 temporal exogenous variables (hour, weekday, date, month, quarter, number of days in a year, whether it is the beginning of the month, whether it is the end of the month). This data is used to construct a comprehensive system containing... Multivariate time series dataset with 370 variables Table 1 shows the dataset. A segment of data.
[0263] Table 1. Input data fragments for the target region
[0264]
[0265] For dataset Missing value imputation and outlier removal were performed. Reversible instance normalization was used at the prediction backbone input to standardize the electricity consumption sequences of each user, eliminating the interference of load magnitude differences between different users on model training. Table 2 shows a portion of the standardized input data for a certain period after preprocessing. The input history window length was set. This is historical data for 96 hours (4 days).
[0266] Table 2. Standardized input data fragments for partial variables in the target region
[0267]
[0268] Meanwhile, in the causal discovery mapping phase, the MinMax method is used to scale each variable to the [0.5,1] interval, and a normal distribution is applied to each variable. Each variable is initialized with a 256-dimensional learnable embedding vector. , forming an embedding matrix Table 3 shows some of the initialized embedding matrix data.
[0269] Table 3. Fragments of the initialized embedding matrix
[0270]
[0271] The processed data was then input into the extended CausalFormer causal discovery framework. The directional influence strength between variables was learned through temporal convolution and attention mechanisms, the regression correlation propagation was calculated, and an initial causal strength matrix R of 370×370 was generated. A total of 1852 effective causal edges were identified, including 1222 cross-user causal edges, 332 exogenous variable-to-user causal edges, and 298 autoregressive edges. Table 4 shows the initial causal influence strength extracted between some variables in the initial causal strength matrix R.
[0272] Table 4. Extracted fragments of the initial causal influence strength matrix of some variables
[0273]
[0274] Next, first analyze the intensity matrix. Normalization yields Table 5 shows the normalized intensity matrix fragments.
[0275] Table 5. Normalized intensity matrix fragments
[0276]
[0277] Next, KMeans clustering is performed on the intensity vector of each target variable, and the two clusters with the largest cluster centers are set as high-confidence clusters to construct a binary structure matrix. Table 6 shows some of the binary structure matrix data.
[0278] Table 6. Binary structure matrix after KMeans clustering filtering Excerpt
[0279]
[0280] binary structure matrix With the normalized intensity matrix Topological fusion removes weak noise edges to obtain the causal adjacency matrix. Table 7 shows some of the causal adjacency matrix data.
[0281] Table 7. Fragments of the Causal Adjacency Matrix
[0282]
[0283] After obtaining the causal adjacency matrix, set the maximum propagation hop count. =2, inter-jump attenuation coefficient Set to 0.5 for two-hop boosting. Table 8 shows the two-jump causal reinforcement data for some variables.
[0284] Table 8. Two-jump causal reinforcement results
[0285]
[0286] Next, normalization is performed so that indirect causal relationships after two hops propagation are also included in the matrix, ultimately resulting in a 370×370 static causal matrix. It contains 370 self-loops and 1554 cross-variable causal edges after multi-hop enhancement, with a total of 1924 non-zero elements. Table 9 shows the normalized partial causal weights.
[0287] Table 9. Fragments of the static causal matrix after multi-hop enhancement and normalization
[0288]
[0289] Obtain the causal matrix Then, aggregate causal context. Table 10 shows the aggregated partial causal context data.
[0290] Table 10. Values of the Aggregated Causal Context Matrix
[0291]
[0292] Subsequently, feature propagation is performed based on the causal matrix, and the model learns the modulation coefficients through a gating network. The enhancement magnitude is adaptively assigned to different variables based on the causal role context information of each variable.
[0293] The input sequence of length 96 is divided into segments according to length. =16 and step size =16 segments, calculated to obtain = (96-16) / 16 +1 = 6 segments. Each segment Through projection matrix Projected to =256-dimensional hidden space and add position encoding Finally, causal augmentation was applied to each segment feature to obtain the enhanced electricity consumption features. After enhancement, the feature dimensions corresponding to meteorological variables that have a strong causal relationship with user electricity consumption are enhanced, while the spurious correlation feature dimensions without causal support are suppressed.
[0294] After obtaining the statically enhanced electricity consumption characteristics through step S10, the six segments of the enhanced 370 variables are rearranged and concatenated to obtain the total number of dynamic nodes. This forms the backbone input feature tensor. ( =16 represents the batch size.
[0295] By querying the projection matrix Bond projection matrix To each Perform a linear mapping to obtain the query matrix. AND key matrix ,pass Activation constructs adjacency fraction matrix Table 11 shows the connection scores of user 1 between different segments.
[0296] Table 11. Connection scores of User 1 between different segments
[0297]
[0298] Subsequently, the Kronecker product is used to transform the static causality matrix. and Extending to the fragment level yields a dynamic causal matrix. Prior amplification is performed to generate a causal enhanced adjacency matrix. Table 12 shows the enhanced connectivity scores of user 1 between different segments.
[0299] Table 12. Enhanced connectivity scores for User 1 across different segments
[0300]
[0301] Next, the causal enhancement adjacency matrix is analyzed. Implement a K-nearest neighbor mask to set the number of high-scoring neighbors to retain for each node. =10, construct the K-nearest neighbor mask matrix. Simultaneously, a hybrid MoE routing strategy is adopted, classifying propagation modes into three categories: self-attention experts (different segments of the same variable), cross-variable attention experts (different variables at the same time), and global attention experts. The routing network adaptively generates the weights of the three expert categories based on the features of the current segment and outputs a routing mask. .
[0302] Will , , Element-wise multiplication yields the denoised adjacency matrix. Table 13 shows the adjacency matrix of User 1 after noise reduction.
[0303] Table 13. Adjacency matrix of User 1 after noise reduction
[0304]
[0305] Normalization of the operation results in ,use Execute message passing The aggregation is complete. Next, the first residual join is performed. After feedforward network Complete the second residual connection Finally, the 256-dimensional features of all six segments under the same variable are rearranged and concatenated according to variable index, and then aggregated to obtain the aggregated feature tensor. Table 14 shows high-dimensional feature value fragments of some variables after noise reduction, propagation, and aggregation. For the first Dimensional features.
[0306] Table 14. Partial power consumption characteristic segments after noise reduction and propagation aggregation
[0307]
[0308] After obtaining high-dimensional denoising and focusing on multi-household aggregation feature representation. Then, aggregate features Mapping to the future through the predictive head linear layer =720 steps in the time dimension to generate basic prediction results Table 15 shows the basic prediction tensors for six time steps.
[0309] Table 15. Tensor Fragments of Basic Prediction Results
[0310]
[0311] Next, the diagonal self-loops of the normalized causal matrix are removed to obtain a causal matrix without self-loops. A total of 1554 cross-variable causal edges were retained. Using... A two-layer graph convolution correction is performed: the first layer aggregates direct upstream causal effects, and the second layer further absorbs indirect electricity consumption causal effects and maps them back. =720-dimensional features. Finally, a residual fusion strategy is used to incorporate the correction amount as a supplementary term, resulting in the corrected final multi-user electricity consumption prediction tensor. Table 16 shows the final prediction tensors for six time steps after correction.
[0312] Table 16. Corrected Final Predicted Tensor Fragments
[0313]
[0314] During the training phase, each variable is computed in the causal graph. Centrality of out-degree, in-degree, and total degree Table 17 shows the partial degree centrality calculation data.
[0315] Table 17. Data for calculating the degree centrality of some variables
[0316]
[0317] After obtaining the total degree centrality strength, construct the variable loss weights. And calculate the weighted mean square error loss. Simultaneously calculate the MoE load balancing loss. Calculate the sparse regularized loss of the causal graph, with the sparse regularization weights set to . =0.1, and finally construct the total loss and train the model. Table 18 shows the main training parameter configurations in this embodiment.
[0318] Table 18. Main training parameter configurations for this embodiment.
[0319]
[0320] The model was trained for 14 epochs using the Adam optimizer with the parameters configured above. The learning rate was smoothly adjusted using a cosine annealing strategy. After each epoch, the learning rate scaling ratio of the causal module relative to the backbone network was restored to 0.6.
[0321] During the inference phase, the model parameters are fixed, and the pre-trained model weights are used. The latest known data from the 96 hours prior to the period to be predicted is used as the model input, and the model is executed according to the prediction window. =720 outputs standardized prediction results, ultimately for each variable At any moment The normalized predicted values were denormalized to restore them to the original kWh electricity consumption unit. The electricity consumption prediction sequences of 347 users were extracted from the prediction result matrix to obtain the electricity consumption prediction values of each user in the next 720 hours (30 days). Table 19 shows the electricity consumption prediction segments of some users over 7 hours.
[0322] Table 19. A segment of 7-hour electricity consumption forecast results for some users (unit: kWh)
[0323]
[0324] Table 20 below shows the comparison results between the method of this application and other published methods, and Table 21 shows the prediction results of the method of this application at different prediction lengths:
[0325] Table 20. Comparison Results
[0326]
[0327] Table 21. Comparison of Prediction Results for Different Prediction Lengths
[0328]
[0329] Furthermore, this embodiment also proposes a causal-guided multi-user electricity consumption prediction model, which includes:
[0330] The causal matrix construction module is used to learn the causal relationships between variables in a multivariate time series dataset using a causal discovery framework, generate an initial causal strength matrix, perform multi-hop enhancement processing on the initial causal strength matrix to obtain a causal matrix, expand the causal matrix into a time segment-level dynamic causal matrix, and fuse the dynamic causal matrix with a dynamic adjacency matrix obtained by dynamic learning based on input data to construct a causal enhancement adjacency matrix.
[0331] The feature modulation and propagation module is used to perform noise reduction and propagation processing on the causal enhancement adjacency matrix and normalize it, then perform residual fusion and residual update on the current layer input and output features of the obtained matrix in sequence, rearrange and aggregate all processed fragment features according to variable index to obtain aggregated feature tensor;
[0332] The prediction correction module is used to output a basic prediction result based on the aggregated feature tensor, and to perform cross-variable influence aggregation on the basic prediction result using a graph convolutional network and a self-loop-free causal matrix constructed based on the causal matrix to obtain a correction amount. The correction amount is then fused with the basic prediction result to obtain and output the corrected multi-user electricity consumption prediction result.
[0333] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.
[0334] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A multi-user electricity consumption prediction method based on causal guidance, characterized in that, The method includes the following steps: S10, Using a causal discovery framework, learn the causal relationships between variables in a multivariate time series dataset, generate an initial causal strength matrix, perform multi-hop enhancement processing on the initial causal strength matrix to obtain a causal matrix, and perform feature propagation based on the causal matrix; S20, the causal matrix is expanded into a time-segment level dynamic causal matrix, and the dynamic causal matrix is fused with a dynamic adjacency matrix obtained by dynamic learning based on input data to construct a causal enhanced adjacency matrix; S30, after the causal enhancement adjacency matrix is subjected to noise reduction propagation processing and normalization, the current layer input and output features of the obtained matrix are sequentially subjected to residual fusion and residual update, and all processed fragment features are rearranged and aggregated according to variable index to obtain aggregated feature tensor; S40, based on the aggregated feature tensor, output the basic prediction result, use a graph convolutional network and a self-loop-free causal matrix constructed based on the causal matrix to perform cross-variable influence aggregation on the basic prediction result to obtain a correction amount, fuse the correction amount with the basic prediction result to obtain the corrected multi-user electricity consumption prediction result and output it.
2. The multi-user electricity consumption prediction method based on causal guidance as described in claim 1, characterized in that, In step S10, the initial causal intensity matrix generation step includes: S11, Obtain the multivariate time series dataset : ; In the formula: Indicates the first One sample; Indicates at time The sampled input variable vector; Enter the length of the history window; For time steps; Number of variables; S12, Calculate the multivariate time series dataset The mean and standard deviation of the dataset are calculated, and each data point in the dataset is normalized based on the mean and standard deviation. (1-1); ; In the formula, The mean; The data is after normalization; For sequence length, For the first The raw data at each time step , where is the standard deviation; for the , One variable, , For variables In the dataset The maximum value in, For variables In the dataset The minimum value in; S13, let the normalized data For each variable, learn an embeddable vector. : ; In the formula, For embedding matrix, No. Learnable embedding vectors of variables; S14 learns the strength of directional influence between variables through temporal convolution and attention mechanisms, and quantifies implicit dependencies into interpretable causal strength through regression correlation propagation. This forms the initial causal strength matrix R: ; In the formula, Representing variables For variables The intensity of the impact; For the first Variables in a sample The predicted value, For the corresponding input value, This represents the number of samples.
3. The causal-guided multi-user electricity consumption prediction method as described in claim 1 or 2, characterized in that, In step S10, the initial causal strength matrix is subjected to multi-hop enhancement processing to obtain a causal matrix, specifically including: S15, normalize and cluster the initial causal intensity matrix to obtain the causal adjacency matrix; S16, calculate the multi-hop propagation relationship of the causal adjacency matrix, and perform weighted summation and normalization alignment on the multi-hop propagation relationship to obtain the causal matrix, wherein, The causality matrix The expression is: ; in: ; ; ; In the formula, The maximum number of propagation hops, This is the inter-jump attenuation coefficient. express Skipping causal propagation; R represents the normalized initial causality strength matrix; This represents the binary structure matrix constructed by cluster filtering in the initial causal strength matrix R.
4. The multi-user electricity consumption prediction method based on causal guidance as described in claim 1, characterized in that, S20 specifically includes: S21, using the Kronecker product to transform the causal matrix The causal edges between each variable are synchronously extended to the corresponding fragment pairs to obtain a dynamic causal matrix. : ; In the formula, It is a matrix whose elements are all 1s; S22, dynamic causal matrix Constructed as a priori amplification term The dynamic adjacency matrix obtained by dynamic learning based on input data. Perform element-wise multiplication to construct a causal-enhancing adjacency matrix. : ; In the formula, To enhance the causal adjacency matrix, This represents Hadamard element-wise multiplication. A matrix consisting entirely of 1s of the same dimension. This is a learnable causal scaling factor.
5. The multi-user electricity consumption prediction method based on causal guidance as described in claim 4, characterized in that, The dynamic adjacency matrix The structure specifically includes: S221, all processes and causal matrices Modulated features Reorder by variable and fragment index, then concatenate to form the main input. : ; ; ; In the formula, Indicates the first In the nth sample The modulated feature vector of each node Indicates the first The backbone input feature matrix of each sample This represents the main input feature tensor of the entire batch. For batch size, For the number of variables, The number of time segments corresponding to each variable. This represents the total number of dynamic nodes after rearrangement. For feature dimension, For variable index, For time segment indexing, For the reason The one-dimensional node index obtained by mapping, For sequential stacking operations; S222, Characteristics of power consumption of main input. A linear mapping is performed to map the original fragment representation to a query space and a key space of the same dimension, enabling the fragment nodes to dynamically calculate the relevance based on the features of the current input sample, resulting in the query matrix and the key matrix: ; ; In the formula, and These are the learnable parameter matrices for the query projection layer and the key projection layer, respectively, which are obtained through joint learning via backpropagation during the training process. S223, query matrix AND key matrix transpose Perform matrix multiplication to obtain the pairwise matching scores between segments, and then... Activation functions enhance nonlinear discrimination capabilities, and adjacency score matrices are constructed accordingly. : ; In the formula, This represents the segment-level correlation matrix obtained through dynamic learning based on the current input samples. This is the Gaussian error linear unit activation function, used to enhance nonlinear expressive power.
6. The multi-user electricity consumption prediction method based on causal guidance as described in claim 1, characterized in that, In step S30, the causal enhancement adjacency matrix is subjected to noise reduction propagation processing and normalization, specifically including: S31, for the enhanced adjacency matrix Each row is sorted from highest to lowest score. Only high-confidence structural neighbors that meet the set criteria are selected as connected objects and the network connection is marked as valid state 1. A K-nearest neighbor mask matrix is constructed. : ; In the formula, Denotes the K-nearest neighbor mask matrix. This represents the number of high-scoring neighbors retained by each node. This indicates selecting the row with the highest score. The operation of setting each element to 1; S32 determines whether propagation is allowed based on routing rules; if allowed, it sets to 1, otherwise it sets to 0, and outputs only the location indication results containing allowed propagation paths, constructing a routing mask matrix. To control the areas where transmission is permitted: ; S33, enhance the causal adjacency matrix K-nearest neighbor mask matrix and routing mask matrix Perform element-wise multiplication to obtain the denoised adjacency matrix. To preserve connections between electricity consumption influencing factors that simultaneously satisfy the following criteria: high impact score, conformity to electricity consumption characteristic routing, and causal support: ; S34, adjacency matrix for noise reduction Row normalization is performed by dividing each row element by the sum of the row elements to ensure stable propagation weights across different nodes, resulting in a row-normalized adjacency matrix. This completes the noise reduction propagation process and normalization. 。 7. The multi-user electricity consumption prediction method based on causal guidance as described in claim 1, characterized in that, In S30, the current layer input and output features of the obtained matrix are sequentially subjected to residual fusion and residual update. All processed fragment features are rearranged and aggregated according to variable indices to obtain the aggregated feature tensor, which specifically includes: S35 uses a linear mapping layer to combine the user's electricity consumption segment input to the current layer with environmental features. Projecting the model onto the new high-dimensional electricity consumption pattern feature space yields the preliminary transformed feature matrix. Normalize the adjacency matrix With characteristic matrix Perform multiplication operations for noise reduction propagation: ; In the formula, For output features, The learnable parameter matrix of the linear mapping layer is automatically learned during the training of the backbone network. S36, after noise reduction propagation, the current layer input Output after noise reduction Perform residual fusion: ; S37 introduces a feedforward network to update features using residuals, in order to fit the complex changes in multi-user load during peak-valley switching: ; In the formula, Indicates a feedforward network; S38, the variable indices are rearranged and all fragment features under the same variable are concatenated, aggregating the information scattered in the fragments into a user-level representation, resulting in the aggregated feature tensor. : ; In the formula, This indicates a tensor dimension rearrangement operation that changes only the data organization structure without changing the values of the elements.
8. The multi-user electricity consumption prediction method based on causal guidance as described in claim 1, characterized in that, In S40, a graph convolutional network is used, and a loop-free causal matrix is constructed based on the causal matrix to aggregate the cross-variable influence of the basic prediction results, obtaining a correction amount. This correction amount is then fused with the basic prediction results to obtain and output the corrected multi-user electricity consumption prediction results, specifically including: S41, the normalized causal matrix and the self-loop shielding matrix are multiplied element-wise to remove self-feedback terms. By eliminating local self-reinforcing effects, the model is forced to focus on cross-external external connections, thus constructing a diagonalized, self-loop-free causal matrix that reflects the multi-agent association structure. : ; In the formula, It is a causal matrix without self-loops. It is a causal matrix. A matrix consisting entirely of 1s of the same dimension. for 3D identity matrix; S42, the graph convolutional network includes two graph convolutional layers, wherein the first graph convolutional layer aggregates direct upstream influences and incorporates cross-variable influences into the correction: ; In the formula, This is the output of the first causal convolution layer. Based on the prediction results, and These are the weight matrix and bias vector of the first linear mapping layer, respectively. The time dimension is hidden in the middle; The second-layer causal graph convolution enhances the influence of indirect electricity consumption causality and maps intermediate features back to the output time dimension, thereby applying multi-hop causal transmission to the output and reducing structural bias in long window prediction. ; In the formula, This is the output of the second causal convolution layer. and These are the weight matrix and bias vector of the second linear mapping layer, which are automatically updated during the training phase through backpropagation. S43, causal correction amount As a basis for the prediction results The supplementary items yield the corrected multi-user electricity consumption prediction results: ; In the formula, This is the feature matrix of the final multi-user electricity consumption prediction result after correction by the causal graph convolution correction unit. This is a learnable correction intensity parameter.
9. The multi-user electricity consumption prediction method based on causal guidance as described in claim 1, characterized in that, The method further includes: Construct the total loss function: ; In the formula, To weighted predict losses, For MoE load balancing losses, For sparse regularization loss of causal graphs, This indicates calculating the mean of the matrix elements. and These are the MoE loss weights and the sparse regularization weights, respectively. The learning rate is adjusted using a cosine annealing strategy, and the prediction model is trained based on the total loss function.
10. A causal-guided multi-user electricity consumption prediction model, characterized in that, The causality-guided multi-user electricity consumption prediction model includes: The causal guidance module is used to learn the causal relationships between variables in a multivariate time series dataset using a causal discovery framework, generate an initial causal strength matrix, perform multi-hop enhancement processing on the initial causal strength matrix to obtain a causal matrix, and expand the causal matrix into a time segment-level dynamic causal matrix. The dynamic causal matrix is then fused with a dynamic adjacency matrix obtained by dynamic learning based on input data to construct a causal enhancement adjacency matrix. The feature modulation and propagation module is used to perform feature propagation based on the causal matrix, and to perform noise reduction propagation processing and normalization on the causal enhanced adjacency matrix, and then perform residual fusion and residual update on the current layer input and output features of the obtained matrix in sequence, and rearrange and aggregate all processed fragment features according to variable index to obtain an aggregated feature tensor. The prediction correction module is used to output a basic prediction result based on the aggregated feature tensor, and to perform cross-variable influence aggregation on the basic prediction result using a graph convolutional network and a self-loop-free causal matrix constructed based on the causal matrix to obtain a correction amount. The correction amount is then fused with the basic prediction result to obtain and output the corrected multi-user electricity consumption prediction result.