Bayesian-based electric power service risk level prediction method, device and equipment

By employing a Bayesian-based method for predicting the risk level of power services, and utilizing a temporal Bayesian network and a denoised diffusion probability model, the causal contribution of risk factors is quantified, thus solving the problem of insufficient accuracy in predicting power service work orders and achieving accurate identification and stable prediction of power service risks.

CN121599469APending Publication Date: 2026-03-03NANCHONG POWER SUPPLY COMPANY STATE GRID SICHUANELECTRIC POWER
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511773170.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-28
Publication Date
2026-03-03

Smart Images

  • Figure CN121599469A_ABST
    Figure CN121599469A_ABST
Patent Text Reader

Abstract

The invention discloses a Bayesian-based electric power service risk level prediction method, device and equipment, and relates to the technical field of risk assessment, and the method comprises the steps: carrying out the coding and splicing of a plurality of heterogeneous features of a target electric power service work order, and obtaining the fusion features of the target electric power service work order; inputting the fusion features of the target power service work order into the trained risk prediction model; quantifying the causal contribution degree of each risk factor to the risk level through a parameterized time sequence Bayesian network, taking the causal contribution degree as a feature weight, weighting the fusion feature of the target power service work order, and obtaining a causal perception feature vector of the target power service work order; and inputting the causal perception feature vector of the target power service work order into a risk level prediction network, and outputting the risk level of the target power service work order. According to the method, the causal contribution degree of the risk factor is quantified through the time sequence Bayesian network, and the causal association between the feature and the risk level is distinguished, so that the prediction accuracy is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of risk assessment technology, specifically to a Bayesian-based method, apparatus, and equipment for predicting the risk level of power services. Background Technology

[0002] With the rapid development of the social economy and the deepening of power system reform, power users have increasingly higher requirements for power supply reliability and service response efficiency. Power service work orders, as the core carrier for receiving user requests and recording the entire service process, are experiencing exponential growth in data volume. They encompass complex characteristics across multiple dimensions, including work order number, acceptance time, business subtype, processing department, and power supply line. This data contains rich risk-related information, providing crucial data support for power service risk classification. By accurately identifying risk levels, resources can be allocated in advance, service processes optimized, and the probability of escalating user complaints and power supply service losses effectively reduced. Therefore, risk assessment technology based on power service work order data has become a research hotspot in the field of power marketing services.

[0003] Power supply service risks are strongly influenced by seasonal factors, such as overload risks caused by peak summer electricity consumption and line fault risks caused by freezing disasters in winter. Time-series drift causes changes in data distribution, making it difficult for traditional risk assessment models to adaptively capture the dynamic evolution of risk patterns, resulting in a significant decline in their predictive performance over time. Moreover, most existing risk assessment methods are based on the statistical correlation between features and risk labels. This correlation modeling is easily affected by confounding factors and spurious associations in the data, leading to insufficient accuracy in the prediction results. Summary of the Invention

[0004] The technical problem to be solved by the present invention is the insufficient accuracy of existing risk assessment methods in predicting power service work orders. The purpose is to provide a Bayesian-based method, device and equipment for predicting power service risk levels, thereby solving the above-mentioned problem.

[0005] This invention is achieved through the following technical solution:

[0006] In a first aspect, the present invention provides a Bayesian-based method for predicting the risk level of electricity services, comprising:

[0007] The various heterogeneous features of the target power service work order are encoded and concatenated to obtain the fused features of the target power service work order;

[0008] The fusion features of the target power service work order are input into the trained risk prediction model; the risk prediction model includes a parameterized temporal Bayesian network and a risk level prediction network; wherein, the parameterized temporal Bayesian network is obtained by learning the conditional probability distribution of each node in the risk causal graph based on the training sample set; the risk causal graph is used to indicate the causal dependency between different risk factors and risk levels;

[0009] The parameterized temporal Bayesian network is used to quantify the causal contribution of each risk factor to the risk level. The causal contribution is used as a feature weight to weight the fusion features of the target power service work order, thereby obtaining the causal perception feature vector of the target power service work order.

[0010] The causal perception feature vector of the target power service work order is input into the risk level prediction network, and the risk level of the target power service work order is output.

[0011] Optionally, the training steps for a parameterized temporal Bayesian network are as follows:

[0012] Construct a risk cause-effect graph for power services; the nodes of the risk cause-effect graph include root nodes representing environmental and business attributes, intermediate nodes representing processing flow, and result nodes representing risk levels.

[0013] For the time-series factor nodes in the risk causal graph, their conditional probability distribution is modeled as a Gaussian distribution dependent on seasonal factors; the mean and variance of the Gaussian distribution are learned through the training sample set.

[0014] For discrete nodes in the risk causal graph, Bayesian estimation is used to learn their conditional probability distribution, and prior information of network parameters under the risk causal graph structure is obtained through Dirichlet prior distribution.

[0015] By combining the prior information and the sample size of different risk levels in the training sample set, the posterior distribution of the network parameters in the training sample set is calculated;

[0016] A variational distribution is introduced to approximate the posterior distribution, and the optimal network parameters are solved by maximizing the lower bound of evidence.

[0017] Optionally, the training process of the risk level prediction network is as follows:

[0018] Based on the parameterized temporal Bayesian network, the causal contribution of each risk factor to the risk level is quantified by calculating the average causal effect.

[0019] The causal contribution is used as the feature weight to weight the fusion features of each work order in the training sample set, so as to obtain the causal perception feature vector of each work order.

[0020] Based on the causal perception feature vectors and corresponding risk level labels of all work orders in the training sample set, the risk prediction network is optimized and trained.

[0021] Optionally, the formula for calculating the average causal effect is as follows:

[0022] ;

[0023] in, Indicates the risk factors to which intervention has been applied; and Represents the variable The two different intervention values ​​applied; This indicates the risk factors Forced to be set to Intervention procedures; Indicates the variable Forced to be set to Intervention procedures; Indicating the implementation of intervention The expected value of the subsequent risk level y; Indicating the implementation of intervention The expected value of the subsequent risk level y; Indicates that intervention will be carried out from Change to The average causal effect of risk level y is defined as the causal contribution.

[0024] Optionally, the training sample set is obtained in the following manner:

[0025] Based on the fusion features of labeled work orders and their corresponding real risk level labels, a denoising diffusion probability model is trained.

[0026] Input the fusion features of unlabeled work orders into the trained denoising diffusion probability model to generate auxiliary risk level labels and corresponding confidence levels;

[0027] The auxiliary risk level labels are filtered based on a preset confidence threshold. The filtered work orders and their corresponding auxiliary risk level labels are then merged with the labeled work orders to construct the training sample set.

[0028] Optionally, the denoising diffusion probability model includes a U-Net denoising network; the training of the denoising diffusion probability model based on the fusion features of labeled work orders and their corresponding true risk level labels includes:

[0029] Through a forward diffusion process, Gaussian noise is gradually added to the fused features at multiple preset time steps to generate noisy samples at multiple time steps.

[0030] By using the reverse generation process, the noisy samples at each time step and the corresponding time step codes are input into the U-Net denoising network to predict the generation probability distribution of the noisy samples at the previous time step.

[0031] The denoising iterations are performed in reverse order of time steps. By optimizing the first joint loss function, the fused features are gradually reconstructed until the denoising diffusion probability model converges.

[0032] Optionally, the first joint loss function is composed of a weighted sum of a noise prediction loss term and a conditional classification loss term; the noise prediction loss term is the mean square error between the noise predicted by the U-Net denoising network and the actual noise added during the forward diffusion process; the conditional classification loss term is the cross-entropy loss between the risk level probability distribution predicted by the denoising diffusion probability model and the actual risk level label.

[0033] Optionally, the second joint loss function used for risk level prediction consists of a classification loss term, a contrastive learning loss term, and a weighted sum of the first joint loss function; the classification loss term is the cross-entropy loss between the predicted risk level probability distribution output by the risk level prediction network and the true risk level label; the contrastive learning loss term is a loss function calculated based on the similarity between the fused features of work orders, used to shorten the feature distance between samples of the same risk level and widen the feature distance between samples of different risk levels.

[0034] Secondly, the present invention provides a Bayesian-based power service risk level prediction device, comprising:

[0035] The feature processing module is used to encode and concatenate multiple heterogeneous features of the target power service work order to obtain the fused features of the target power service work order.

[0036] An input module is used to input the fusion features of the target power service work order into a trained risk prediction model; the risk prediction model includes a parameterized temporal Bayesian network and a risk level prediction network; wherein, the parameterized temporal Bayesian network is obtained by learning the conditional probability distribution of each node in the risk causal graph based on the training sample set; the risk causal graph is used to indicate the causal dependency between different risk factors and risk levels;

[0037] The weighting module is used to quantify the causal contribution of each risk factor to the risk level through the parameterized temporal Bayesian network, and use the causal contribution as the feature weight to weight the fusion features of the target power service work order to obtain the causal perception feature vector of the target power service work order.

[0038] The prediction module is used to input the causal perception feature vector of the target power service work order into the risk level prediction network and output the risk level of the target power service work order.

[0039] Thirdly, the present invention provides a computer device, the computer device including a memory and a processor, the memory storing a computer program, the processor executing the computer program to implement a Bayesian-based method for predicting the risk level of power services as described in any one of the first aspects.

[0040] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0041] This application provides a Bayesian-based method for predicting the risk level of power services. By quantifying the causal contribution of risk factors through a temporal Bayesian network, it effectively distinguishes between causal relationships and spurious correlations between features and risk levels. This allows the model to focus on key risk factors that truly influence risk levels, significantly improving prediction accuracy. Through a feature engineering method weighted by causal contribution, domain causal knowledge is integrated into feature representations. Risk prediction based on causal-aware feature vectors can more accurately identify truly high-risk work orders, thus significantly improving the accuracy of risk level prediction results. Furthermore, due to the stronger stability and invariance of causal relationships, the model exhibits better robustness to seasonal changes in data distribution and noise interference, effectively avoiding the performance degradation problem caused by temporal drift in traditional models. Attached Figure Description

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

[0043] Figure 1 A flowchart illustrating a Bayesian-based method for predicting the risk level of electricity services provided in this application embodiment;

[0044] Figure 2 A schematic diagram of the structure of the Bayesian-based power service risk level prediction device provided in the embodiments of this application. Detailed Implementation

[0045] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the embodiments and accompanying drawings. The illustrative embodiments and descriptions of the present invention are only used to explain the present invention and are not intended to limit the present invention.

[0046] The existing risk classification method for power service work orders has the following problems:

[0047] (a) The significant limitation of low efficiency in manually labeling risk levels

[0048] With the exponential growth in the number of power service work orders, the structured time-series data, classified data, and unstructured text data they cover form a complex feature system. Manual annotation not only requires a large number of business experts with professional judgment, but also consumes high time and manpower costs. Furthermore, due to differences in the subjective experience of experts, the risk level judgment standards are not uniform, resulting in low annotation accuracy and poor consistency of results. This seriously restricts the ability to meet the real-time early warning needs of large-scale work orders and fails to provide efficient and reliable basic data support for subsequent risk analysis.

[0049] (ii) Traditional methods cannot effectively capture the temporal causal relationship of work order risks.

[0050] In current mainstream solutions, the risk features extracted by deep learning models are mostly in a "black box" state, lacking interpretability and making it difficult to trace and determine the basis for judgment. Traditional machine learning models such as XGBoost can only mine the correlation between features and risks, failing to identify the temporal causal relationships between core factors such as seasonal changes, power line load, and event types. This limitation is particularly pronounced in scenarios with data distribution shifts; for example, concentrated power outage complaints in summer and dispersed, diverse demands in autumn can directly lead to fluctuations in model prediction performance, insufficient stability, and an inability to accurately pinpoint the root cause of risks.

[0051] (iii) The current risk grading model has insufficient generalization ability.

[0052] Existing supervised learning methods are highly dependent on labeled samples, but high-quality labeled work orders are scarce in actual business operations. This is due to both the high cost of labeling leading to slow sample accumulation and the emergence of new business types and risk patterns limiting the scenarios covered by the samples. This makes it impossible for models to effectively utilize massive amounts of unlabeled work order data. The limitation of training data directly results in weak model generalization ability, making it difficult to fully realize the value of massive work orders and adapt to the dynamic changes in power service risks with seasons and user needs. Predictive performance drops significantly when facing unseen risk scenarios.

[0053] Therefore, this application provides a Bayesian-based method for predicting the risk level of electricity services. Please refer to... Figure 1 This is a flowchart illustrating a Bayesian-based power service risk level prediction method provided in an embodiment of this application. The following is a description of... Figure 1 The Bayesian-based method for predicting the risk level of electricity services is introduced below.

[0054] S1. Encode and concatenate the various heterogeneous features of the target power service work order to obtain the fused features of the target power service work order.

[0055] A target power service order refers to a power service order that is unpredictable and whose risk level is unknown. Power service orders contain the following heterogeneous characteristics:

[0056] (1) Numerical characteristics: such as work order number, user level, processing time, etc.;

[0057] (2) Time characteristics: such as acceptance time, order dispatch time, estimated completion time, etc.;

[0058] (3) Text features: such as fault description, line, transformer area, and handling status record;

[0059] (4) Category characteristics: such as business classification, processing department, etc.

[0060] Encode the various heterogeneous features of the target power service work order separately to obtain multiple feature encoding vectors:

[0061] For numerical features, preprocessing is performed using Min-Max normalization to obtain normalized numerical features.

[0062] For time features, business-meaning time-derived features are first calculated from the original time field. Then, a time encoder (Time2Vec) is used to transform the absolute time and time-derived features into a time-series feature encoding vector. The function form is as follows:

[0063]

[0064] Where t represents absolute time or time-derived features. This represents the low-frequency factor used to capture long-term seasonal changes; This indicates a high-frequency factor that captures short-term seasonal fluctuations; Represents the temporal feature dimension.

[0065] For text features, we first extract features using the pre-trained large text model BERT, and then combine TD-IDF encoding to perform feature weighting and dimensionality reduction to generate text feature encoding vectors that reflect the key information of the text.

[0066] For categorical features, one-hot encoding is used to obtain categorical feature encoding vectors.

[0067] Taking a company's work order data from January to November 2025 as an example, we extract time fields such as "incoming order time, acceptance time, and estimated processing completion time" from the company's work orders from January to November, and calculate time-derived features, such as: incoming order - acceptance delay. =Processing Time - Order Incoming Time, Completion Time - Time Limit Difference =City-level processing time - Business completion time limit. Then, Time2Vec is used to convert it into a time-series feature encoding vector. For text features such as "processing status records" (e.g., "user reports air conditioner cannot start, meter trips"), BERT is used to extract semantic vectors, combined with information such as "city of origin = City A" and "line = East Ring Road" to generate a classification vector X (dimension 512). One-hot encoding is used for category features such as "business subtype" (overload trip, voltage instability, etc.).

[0068] Finally, the various feature encoding vectors of the target power service work order are concatenated to obtain the fused features of the target power service work order.

[0069]

[0070] in, Features of fusion; These are the normalized numerical features; This is a temporal feature encoding vector; Encode text features into vectors; Encode feature vectors for categories.

[0071] In this embodiment, by differentially encoding and fusing four types of heterogeneous features—numerical, time, text, and category—into fused features, the problem of complex power work order data structure and sparse information is solved, providing comprehensive and high-quality information input for the DDPM model.

[0072] S2. Input the fusion features of the target power service work order into the training of the risk prediction model.

[0073] The risk prediction model includes a parameterized temporal Bayesian network and a risk level prediction network. The parameterized temporal Bayesian network is obtained by learning the conditional probability distribution of each node in the risk causal graph based on the training sample set. The training process of the temporal Bayesian network is introduced below.

[0074] In one possible embodiment, the training steps of the parameterized temporal Bayesian network include:

[0075] A risk causal graph for power services is constructed. For time-series factor nodes in the risk causal graph, their conditional probability distribution is modeled as a Gaussian distribution dependent on seasonal factors. The mean and variance of the Gaussian distribution are learned through the training sample set. For discrete nodes in the risk causal graph, Bayesian estimation is used to learn their conditional probability distribution, and the prior information of network parameters under the risk causal graph structure is obtained through the Dirichlet prior distribution. Combining the prior information and the sample size of different risk levels in the training sample set, the posterior distribution of network parameters under the training sample set is calculated. A variational distribution is introduced to approximate the posterior distribution, and the optimal network parameters are solved by maximizing the lower bound of evidence.

[0076] In the specific implementation process, firstly, combining business knowledge in the power sector with statistical patterns of historical work order data, a risk causal graph G=(V,E) for power services is constructed. This risk causal graph indicates the causal dependencies between different risk factors and risk levels. The nodes V in the risk causal graph include root nodes representing environmental and business attributes, intermediate nodes representing the processing flow, and result nodes representing risk levels. Specifically, these include the following nodes:

[0077] 1. Root Node (Causal Factor): The root node is the fundamental driving factor of risk, unaffected by other nodes in the risk causal diagram. Specifically, it includes:

[0078] (1) Seasonal factor (S): The value ranges from 1 to 4, representing the four seasons of spring, summer, autumn and winter respectively;

[0079] (2) Business type (B): The value is the "first-level classification" in the power service work order, such as overload tripping, billing dispute, etc.;

[0080] (3) Power supply line (L): The value is "marketing distribution line" information, which identifies the specific physical line associated with the work order;

[0081] (4) Time factor (T): The value is “incoming order - processing delay”, which quantifies the time efficiency of order response.

[0082] 2. Intermediate Nodes (Mediating Factors): Intermediate nodes play a mediating role in a causal path, influenced by both the root node and the outcome node. These include:

[0083] (1) Work order priority (P): Classified according to the urgency of the work order, such as high, medium and low;

[0084] (2) Processing Department (D): refers to the professional operation and maintenance department that takes over the work order.

[0085] 3. Result node:

[0086] Risk level (y): This is the prediction target of the model, and it takes three risk levels: Level 1, Level 2, and Level 3.

[0087] In a risk causal graph, the edges E represent directional causal relationships between nodes, for example:

[0088] S→B indicates that seasonal factors affect the type of business, such as a surge in repair work orders due to summer air conditioning load.

[0089] T→P→y indicates that delay affects priority, and priority affects risk level.

[0090] Secondly, the timing factor T (such as delay) The model is a Gaussian distribution that varies with seasonal factors, i.e. Where N represents a Gaussian distribution, The mean of the time series factor T under the seasonal factor S; Let S be the variance of the time series factor T under the seasonal factor S. and It is learned from the training sample set D through maximum likelihood estimation.

[0091] Then, for discrete nodes such as work order priority P, business type B, risk level y, and power supply line L, Bayesian estimation is used to learn their conditional probability distribution.

[0092] When the training sample set D has limited data, directly calculating the parameters may lead to "overfitting." Therefore, the risk causal graph structure is obtained through the Dirichlet prior distribution. Network parameters Prior information Then, combine with the training sample set The network parameters are calculated based on the sample size at different risk levels. In the training sample set The posterior distribution under the following conditions satisfies:

[0093]

[0094] in, Let be the parameters of the prior distribution; when When, it indicates uniform prior; The number of samples in the training sample set D corresponding to risk levels y, i.e., level 1, level 2, and level 3.

[0095] Because the posterior distribution of the parameters is directly calculated The method is quite challenging, so a variational inference optimization approach is adopted, introducing variational distributions. Approximate posterior distribution The optimal network parameters are obtained by maximizing the evidence lower bound (ELBO) using the Adam optimizer.

[0096] ;

[0097] in, θ represents the variational parameters; D represents the training sample set; G represents the risk causal graph structure; θ represents the network parameters to be solved. Indicates the lower bound of evidence; Represents the variational distribution; Represents variational distribution The mathematical expectation; The structure of the risk cause-effect diagram With current network parameters The structure of the risk causal graph, obtained through joint probability calculation, represents the training sample set. The degree of fit; Network parameters under the risk-cause graph structure G The logarithmic form of the prior distribution.

[0098] In this embodiment, by modeling the time-series factor nodes as a Gaussian distribution dependent on seasonal factors, the dynamic characteristics of power service risk changing with the seasons can be accurately captured, solving the problem of traditional methods struggling to handle time-series drift. A method combining Bayesian estimation with a Dirichlet uniform prior distribution is used to learn the conditional probability distribution of discrete nodes, enabling stable and reliable probability estimates even with limited data or scarce samples in certain categories. Through variational inference and maximizing the lower bound of evidence, an efficient approximation of complex posterior distributions is achieved, ensuring not only the convergence of parameter learning but also stable training on large-scale datasets, overcoming the difficulty of parameter learning in complex network structures using traditional methods.

[0099] The training process of a temporal Bayesian network involves a training sample set, which includes the fusion features of multiple power service work orders and their corresponding risk level labels. These risk level labels can be manually labeled by business experts with domain knowledge, or they can be composed of a portion of manually labeled real risk labels and a portion of auxiliary risk labels generated by model prediction.

[0100] In one possible embodiment, the training sample set is obtained through the following steps:

[0101] Based on the fusion features of labeled work orders and their corresponding true risk level labels, a denoising diffusion probability model is trained. The fusion features of unlabeled work orders are input into the trained denoising diffusion probability model to generate auxiliary risk level labels and their corresponding confidence levels. The auxiliary risk level labels are filtered based on a preset confidence level threshold. The filtered work orders and their corresponding auxiliary risk level labels are then merged with the labeled work orders to construct a training sample set.

[0102] In the specific implementation process, firstly, a small number of marked work orders and a large number of unmarked work orders are collected. Marked work orders refer to power service work orders that have been manually marked with risk levels (such as level 1, level 2, and level 3) by business experts, while unmarked work orders refer to original power service work orders that have not been marked with risk levels.

[0103] Then, based on the fusion features of the labeled work orders, a Denoising Diffusion Probability Model (DDPM) is trained. After the model training is completed, the fusion features of the unlabeled work orders are input into the trained DDPM model, which outputs the probability distribution corresponding to each risk level. From this probability distribution, auxiliary risk level labels (i.e., the risk level with the highest probability value) and the corresponding confidence level (i.e., the maximum probability value) are extracted. This confidence level quantifies the model's confidence in the prediction of this pseudo-label.

[0104] Finally, the auxiliary risk level labels were screened.

[0105]

[0106] in, This indicates the fusion feature of unlabeled work orders; Indicates different risk levels; This represents the sample features predicted by the DDPM model. The probability distribution of each risk level y; This represents the maximum probability value in the probability distribution, i.e., the confidence level of this prediction; This is the preset confidence threshold, which defaults to 0.5 and can be dynamically adjusted based on actual data quality and business needs.

[0107] Only when the prediction confidence of an unlabeled work order exceeds a preset confidence threshold is its auxiliary risk level label deemed qualified, and the work order and its pseudo-label are retained. Finally, all high-confidence pseudo-labeled work orders (including fused features and auxiliary risk level labels) are merged with a small number of labeled work orders (including fused features and true risk level labels) to ensure complete uniformity in feature dimensions and label formats between the two types of samples. This results in a scalable and quality-controlled training set D, providing sufficient data support for the subsequent risk factor perception module based on Bayesian time-series causal inference.

[0108] In this embodiment, the uncertainty generation capability of the Denoising Diffusion Probability Model (DDPM) is utilized to achieve high-quality pseudo-label generation and screening of unlabeled data, effectively solving the bottleneck problem of scarce labeled data in the power service work order scenario. The constructed training sample set provides sufficient and reliable data support for subsequent Bayesian causal inference and risk classification model training, fundamentally improving the generalization ability and robustness of the final risk classification model.

[0109] In one possible embodiment, the training steps of the denoising diffusion probability model include:

[0110] Through a forward diffusion process, Gaussian noise is gradually added to the fused features at multiple preset time steps to generate noisy samples at multiple time steps. Through a reverse generation process, the noisy samples at each time step and the corresponding time step codes are input into the U-Net denoising network to predict the generation probability distribution of the noisy samples at the previous time step. Denoising iterations are performed in reverse order of time steps, and the fused features are gradually reconstructed by optimizing the first joint loss function until the denoising diffusion probability model converges.

[0111] In its implementation, DDPM's training process includes a forward diffusion process and a backward generation process. The forward diffusion process uses the fused features of work orders as initial real work order feature samples. Gaussian noise is gradually added over multiple preset time steps until it is completely degenerated into pure Gaussian noise. .

[0112] The noise addition process from time step t-1 to t is defined by the following conditional Gaussian distribution:

[0113]

[0114] in, represents the conditional probability distribution; N() represents the Gaussian distribution, i.e., random Gaussian noise; The noise sample generated in step t; For the noise samples generated in step t-1; This represents the noise intensity parameter at step t; Let be the covariance matrix, representing the variance of the added noise.

[0115] To efficiently obtain noise samples at time t In practice, the simplified noise feature sampling formula can be directly used:

[0116]

[0117] in, The retained signal coefficients at step t, ϵ is a random noise tensor sampled from a standard Gaussian distribution N(0,I); These are real work order feature samples.

[0118] The core of the reverse generation process is a U-Net denoising network, which uses noisy samples... Using the current time step code t as input and the actual risk level label carried by the labeled work order as additional condition, the system learns to predict added noise, gradually improving upon the noise samples. Reconstruct real work order feature samples that match the actual risk level labels. .

[0119] The output of the U-Net denoising network is a conditional probability distribution, as shown in the following formula:

[0120]

[0121] in, Indicates in the parameter The reverse diffusion conditional probability distribution constructed below is used to determine the characteristics of noisy work orders at diffusion time step t. In this case, predict the latent features that are closer to the true distribution at the previous time step. The generation probability; This represents the mean noise predicted by the U-Net denoising network; This represents the covariance term predicted by the U-Net denoising network; This indicates a potential feature that is closer to the true distribution at the previous time step.

[0122] Reverse order by time step (from) 1) Perform denoising iterations, each step based on the current... and As input, the output is processed by the U-Net denoising network. The distribution parameters were obtained by sampling. Gradually reduce sample noise and continuously update network parameters according to the loss function. When the feature reconstruction error of the DDPM model on the validation set stabilizes and tends to 0, the DDPM model is considered to have converged.

[0123] In this embodiment, by injecting the real risk level label as a condition into the training process of the denoising diffusion probability model, the model is guided to accurately learn the distribution of work order features under different risk levels. This enables the model to learn a reliable mapping relationship between features and labels even when using only a small number of labeled work orders, greatly enhancing the ability to generate high-quality pseudo-labels for unlabeled data.

[0124] In one possible embodiment, the first joint loss function used by the denoising diffusion probability model is composed of a weighted sum of a noise prediction loss term and a conditional classification loss term; the noise prediction loss term is the mean square error between the noise predicted by the U-Net denoising network and the actual noise added during the forward diffusion process; the conditional classification loss term is the cross-entropy loss between the risk level probability distribution predicted by the denoising diffusion probability model and the actual risk level label.

[0125]

[0126] in, Denotes the first joint loss function; Indicates about fusion features Random noise And the mathematical expectation of the diffusion time step t; This indicates that the denoising network U-Net performs a certain operation on noisy samples at time step t. The predicted noise; Represents the square of the L2 norm; Indicates the true risk level label Conditional probability distribution predicted by the denoising diffusion probability model Cross-entropy loss between; The hyperparameter, which balances the two loss weights, has a value range of 0-1 and is used to adjust the label constraint strength to ensure the consistency of labels in the generated samples.

[0127] In this embodiment, the mean squared error loss of noise prediction is combined with the cross-entropy loss of conditional labels. The mean squared error loss of noise prediction ensures that the DDPM model has the ability to accurately reconstruct the original work order features from noise, thus guaranteeing the authenticity and feature fidelity of the generated data. The cross-entropy loss of conditional labels is used as a strong constraint, forcing the probability distribution of the output of the DDPM model to be highly consistent with the given true risk level label during the denoising process, thereby ensuring the label correctness and semantic consistency of the generated data.

[0128] The training process of the temporal Bayesian network has been introduced above. The training process of the risk level prediction network will be introduced below.

[0129] In one possible embodiment, the training steps of the risk level prediction network include:

[0130] Based on a parameterized temporal Bayesian network, the causal contribution of each risk factor to the risk level is quantified by calculating the average causal effect. The causal contribution is used as the feature weight to weight the fusion features of each work order in the training sample set to obtain the causal perception feature vector of each work order. The risk prediction network is trained based on the causal perception feature vectors of all work orders in the training sample set and the corresponding risk level labels.

[0131] In the specific implementation process, the training sample set D is partitioned to separate the manually labeled real sample set. and the auxiliary labeled sample set generated by DDPM During training, according to + A mixed training sample batch is constructed using a hybrid approach. Based on the risk level labels of the sample sets, a positive example set P(i) and a negative example set N(i) are defined, where the positive example set P(i) is the set of samples with the same risk level as sample i and matching core causal factors, and the negative example set N(i) is the set of samples with different risk levels or significantly different core causal factors than sample i.

[0132] Based on a parameterized temporal Bayesian network, after obtaining the causal contribution of each risk factor to the risk level, all causal contributions are then... The causal contributions are sorted, and a weight matrix is ​​constructed based on the sorted causal contributions. This weight matrix is ​​a diagonal matrix with dimensions [missing information]. × Its diagonal elements are , Let be the dimension of the fusion feature for each work order in the training sample set D.

[0133] The fusion features of each work order in the training sample set D are weighted to obtain the causal perception feature vector of each work order, thereby constructing a set of causal perception feature vectors.

[0134]

[0135] in, A causal perception feature vector representing a work order; This represents a weight matrix constructed based on causal contribution. This indicates the fusion characteristics of the work order.

[0136] by As input to the risk grading network, the hidden layer features are obtained after processing by the first fully connected layer and the ReLU activation function, and then the 3D risk level probability distribution is output through the second fully connected layer and the Softmax activation function.

[0137]

[0138] in, This is the causal perception feature vector of a certain work order; The risk level prediction probability distribution output by the risk grading network is represented by three components, which correspond to the predicted probabilities of a work order being classified as Level 1, Level 2, and Level 3 risk, respectively; Softmax() is the normalized exponential activation function. ( ) is the linear rectification activation function; This is the weight matrix of the first fully connected layer; This is the weight matrix for the second fully connected layer.

[0139] Based on the predicted risk level output by the risk grading network and the corresponding true risk level label, the value of the second joint loss function is calculated. The parameters of the risk grading model are then trained using the Adam optimizer, with a learning rate of 0.001 and a weight decay coefficient of 0.0001. The model is considered successful when the risk level prediction accuracy on the validation set remains stable above 90% for several consecutive periods, and the joint loss function value... Upon convergence, training is stopped, and the trained risk classification network is obtained.

[0140] In this embodiment, a causal-driven feature weighting mechanism is introduced. Through weighting, the causal perception feature vector amplifies feature signals with genuine causal driving force and weakens noise from irrelevant or spuriously related features. This allows the decision boundary of the risk prediction network to be based on more stable and fundamental causal relationships. Therefore, when applied to unknown future data or when the data distribution changes slightly, the risk prediction network exhibits stronger generalization ability and stability.

[0141] In one possible implementation, the average treatment effect (ATE) is calculated as follows:

[0142]

[0143] in, This refers to the risk factors to which intervention is applied, i.e., the variables whose impact is to be assessed, such as seasonal factors, business type, power supply lines, or time-series factors. and Indicates the risk factor The two different values ​​of the intervention applied, for example, when X is a seasonal factor, It can represent winter. It can represent summer. Indicates the variable Forced to be set to Intervention procedures; Indicates the variable Forced to be set to Intervention procedures. Indicating the implementation of intervention The expected value of the subsequent risk level y; Indicating the implementation of intervention The expected value of the post-risk level y; this expected value can be calculated on a parameterized Bayesian network using the backdoor adjustment formula. Indicates that intervention will be carried out from Change to The average causal effect of risk level y. This average causal effect is defined as the causal contribution of risk factor X to risk level y.

[0144] For example, taking the contribution of quantified seasonal factors to primary risk as an example, its average causal effect is calculated as follows:

[0145]

[0146] Where S=1 and S=3 represent two different interventions on the seasonal factor S, in this embodiment, S=1 represents winter and S=3 represents summer. y=1 indicates a risk level of Level 1 risk; B represents the business type; P(B) represents the probability distribution of business type B in the training sample set. P(y=1|S=3,B) represents the conditional probability of Level 1 risk occurring in summer under a specific business type B. P(y=1|S=1,B) represents the conditional probability of Level 1 risk occurring in winter under a specific business type B. ATE(S=3,S=1) represents the average causal effect on the risk level when the seasonal factor changes from winter (S=1) to summer (S=3).

[0147] In the embodiments of this application, by introducing the average causal effect (ATE), the net causal effect of each risk factor on the risk level can be accurately quantified and defined as the causal contribution, providing a unified, quantitative contribution index with clear causal semantics for all risk factors.

[0148] In one possible embodiment, the second joint loss function used for risk level prediction consists of a weighted sum of a classification loss term, a contrastive learning loss term, and a first joint loss function; the classification loss term is the cross-entropy loss between the predicted risk level probability distribution output by the risk level prediction network and the true risk level label; the contrastive learning loss term is a loss function calculated based on the similarity between the fused features of work orders, used to shorten the feature distance between samples of the same risk level and widen the feature distance between samples of different risk levels.

[0149]

[0150] in, Denotes the first joint loss function; Represents the classification loss term; This represents the first joint loss function for contrastive learning; Denotes the first joint loss function; and This is a hyperparameter used to balance the weights of various losses.

[0151] In this embodiment, a classification loss term is introduced to ensure the model possesses basic risk discrimination capabilities. A contrastive learning loss term is introduced to enhance the intra-class clustering and inter-class separation characteristics of the feature space. A first joint loss function is introduced to improve the model's generalization ability. Through the joint optimization of these three losses, a synergistic improvement in classification accuracy, feature discriminativeness, and generation robustness is achieved.

[0152] In one possible implementation, the contrastive learning loss term is defined as follows:

[0153]

[0154] Where N is the total number of samples in a training batch; P(i) represents the set of positive samples; N(i) represents the set of negative samples; Indicates sample With sample The cosine similarity between the feature vectors; τ represents the temperature coefficient, used to adjust the degree of attention to difficult samples; exp(·) represents the exponential function; log(·) represents the natural logarithm.

[0155] S3. Quantify the causal contribution of each risk factor to the risk level through a parameterized temporal Bayesian network, and use the causal contribution as the feature weight to weight the fusion features of the target power service work order to obtain the causal perception feature vector of the target power service work order.

[0156] Specifically, based on parameterized temporal Bayesian networks, the average causal effect of each risk factor on the risk level is calculated.

[0157] As the causal contribution, all causal contributions are sorted, and a weight matrix is ​​constructed based on the sorted causal contributions. The weight matrix is ​​then multiplied with the fusion features of the target power service work order to obtain the causal perception feature vector of the target power service work order.

[0158] S4. Input the causal perception feature vector of the target power service work order into the risk level prediction network, and output the risk level of the target power service work order.

[0159] In the specific implementation process, the fusion characteristics of the target power service work order are input into the risk level prediction network, which outputs the risk level probability distribution of the target power service work order, including each risk level (Level 1 risk, Level 2 risk, and Level 3 risk) and its corresponding probability. The risk level corresponding to the highest probability value is determined as the target risk level of the target power service work order.

[0160] In summary, this application proposes a power supply service risk early warning method based on Bayesian causal diffusion contrastive learning, which has the following advantages compared with existing technologies:

[0161] Firstly, addressing the significant limitation of low efficiency in manually labeling risk levels, this application utilizes the DDPM model to effectively learn the feature distribution of work orders under different risk levels and generate a large amount of high-quality new work order data with pseudo-labels, thereby expanding the training dataset, reducing the cost of manually labeling risk levels, and improving the accuracy of the risk classification model.

[0162] Secondly, addressing the challenge that traditional methods cannot effectively capture the temporal causal relationships of work order risks, this application uses the structural learning and causal inference of temporal Bayesian networks to identify key driving factors (such as specific routes, seasons, and combinations of business types) that have the strongest causal effect on risk levels. This provides the model with features that have strong prior knowledge, effectively improving the model's temporal causal perception ability and interpretability.

[0163] Third, in response to the insufficient generalization ability of current risk level prediction models, this application constructs a comparative learning paradigm by combining existing and generated data. This effectively utilizes the feature distribution of different risk label domains, effectively improves the model's feature expression ability, and can better adapt to seasonal and holiday changes, maintaining stable prediction performance under different time windows.

[0164] Based on the same inventive concept, please refer to Figure 2 This application also provides a Bayesian-based power service risk level prediction device, comprising:

[0165] The feature processing module is used to encode and concatenate various heterogeneous features of the target power service work order to obtain the fused features of the target power service work order.

[0166] The input module is used to input the fusion features of the target power service work order into the trained risk prediction model. The risk prediction model includes a parameterized temporal Bayesian network and a risk level prediction network. The parameterized temporal Bayesian network is obtained by learning the conditional probability distribution of each node in the risk causal graph based on the training sample set. The risk causal graph is used to indicate the causal dependency between different risk factors and risk levels.

[0167] The weighting module is used to quantify the causal contribution of each risk factor to the risk level through a parameterized temporal Bayesian network. The causal contribution is used as the feature weight to weight the fusion features of the target power service work order, thereby obtaining the causal perception feature vector of the target power service work order.

[0168] The prediction module is used to input the causal perception feature vector of the target power service work order into the risk level prediction network and output the risk level of the target power service work order.

[0169] It should be noted that each module in the Bayesian-based power service risk level prediction device in this embodiment corresponds one-to-one with each step in the Bayesian-based power service risk level prediction method in the aforementioned embodiment. Therefore, the specific implementation of this embodiment can refer to the implementation of the aforementioned Bayesian-based power service risk level prediction method, and will not be repeated here.

[0170] Based on the same inventive concept, this application also provides a computer device, which includes a processor, a memory, and a computer program stored in the memory. The computer program is executed by the processor to implement the aforementioned Bayesian-based method for predicting the risk level of electricity services.

[0171] Based on the same inventive concept, this application also provides a computer storage medium storing a computer program, which is executed by a processor to implement the aforementioned Bayesian-based method for predicting the risk level of electricity services.

[0172] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or it may be a device including one or any combination of the above-mentioned memories. The computer may be a variety of computing devices, including smart terminals and servers.

[0173] In some embodiments, executable instructions may take the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a standalone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.

[0174] As an example, executable instructions may, but do not necessarily, correspond to files in the file system. They may be stored as part of a file that holds other programs or data, for example, in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple collaborating files (e.g., a file that stores one or more modules, subroutines, or code sections).

[0175] As an example, executable instructions can be deployed to execute on a single computing device, or on multiple computing devices located in one location, or on multiple computing devices distributed across multiple locations and interconnected via a communication network.

[0176] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.

[0177] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0178] The above specific embodiments further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A Bayesian-based method for predicting the risk level of electricity services, characterized in that, include: The various heterogeneous features of the target power service work order are encoded and concatenated to obtain the fused features of the target power service work order; The fusion features of the target power service work order are input into the trained risk prediction model; the risk prediction model includes a parameterized temporal Bayesian network and a risk level prediction network; wherein, the parameterized temporal Bayesian network is obtained by learning the conditional probability distribution of each node in the risk causal graph based on the training sample set; the risk causal graph is used to indicate the causal dependency between different risk factors and risk levels; The parameterized temporal Bayesian network is used to quantify the causal contribution of each risk factor to the risk level. The causal contribution is used as a feature weight to weight the fusion features of the target power service work order, thereby obtaining the causal perception feature vector of the target power service work order. The causal perception feature vector of the target power service work order is input into the risk level prediction network, and the risk level of the target power service work order is output.

2. The Bayesian-based power service risk level prediction method according to claim 1, characterized in that, The training steps for the parameterized temporal Bayesian network are as follows: Construct a risk cause-effect graph for power services; the nodes of the risk cause-effect graph include root nodes representing environmental and business attributes, intermediate nodes representing processing flow, and result nodes representing risk levels. For the time-series factor nodes in the risk causal graph, their conditional probability distribution is modeled as a Gaussian distribution dependent on seasonal factors; the mean and variance of the Gaussian distribution are learned through the training sample set. For discrete nodes in the risk causal graph, Bayesian estimation is used to learn their conditional probability distribution, and prior information of network parameters under the risk causal graph structure is obtained through Dirichlet prior distribution. By combining the prior information and the sample size of different risk levels in the training sample set, the posterior distribution of the network parameters in the training sample set is calculated; A variational distribution is introduced to approximate the posterior distribution, and the optimal network parameters are solved by maximizing the lower bound of evidence.

3. The Bayesian-based power service risk level prediction method according to claim 1, characterized in that, The training process of the risk level prediction network is as follows: Based on the parameterized temporal Bayesian network, the causal contribution of each risk factor to the risk level is quantified by calculating the average causal effect. The causal contribution is used as the feature weight to weight the fusion features of each work order in the training sample set, so as to obtain the causal perception feature vector of each work order. Based on the causal perception feature vectors and corresponding risk level labels of all work orders in the training sample set, the risk prediction network is optimized and trained.

4. The Bayesian-based power service risk level prediction method according to claim 3, characterized in that, The formula for calculating the average causal effect is as follows: ; in, Indicates the risk factors to which intervention has been applied; and Represents the variable The two different intervention values ​​applied; This indicates the risk factors Forced to be set to Intervention procedures; Indicates the variable Forced to be set to Intervention procedures; Indicating the implementation of intervention The expected value of the subsequent risk level y; Indicating the implementation of intervention The expected value of the subsequent risk level y; Indicates that intervention will be carried out from Change to The average causal effect of risk level y is defined as the causal contribution.

5. The Bayesian-based method for predicting the risk level of electricity services according to claim 1, characterized in that, The training sample set was obtained in the following way: Based on the fusion features of labeled work orders and their corresponding real risk level labels, a denoising diffusion probability model is trained. Input the fusion features of unlabeled work orders into the trained denoising diffusion probability model to generate auxiliary risk level labels and corresponding confidence levels; The auxiliary risk level labels are filtered based on a preset confidence threshold. The filtered work orders and their corresponding auxiliary risk level labels are then merged with the labeled work orders to construct the training sample set.

6. The Bayesian-based power service risk level prediction method according to claim 5, characterized in that, The denoising diffusion probability model includes a U-Net denoising network; the training of the denoising diffusion probability model based on the fusion features of labeled work orders and their corresponding true risk level labels includes: Through a forward diffusion process, Gaussian noise is gradually added to the fused features at multiple preset time steps to generate noisy samples at multiple time steps. By using the reverse generation process, the noisy samples at each time step and the corresponding time step codes are input into the U-Net denoising network to predict the generation probability distribution of the noisy samples at the previous time step. The denoising iterations are performed in reverse order of time steps. By optimizing the first joint loss function, the fused features are gradually reconstructed until the denoising diffusion probability model converges.

7. The Bayesian-based power service risk level prediction method according to claim 6, characterized in that, The first joint loss function is composed of a weighted sum of a noise prediction loss term and a conditional classification loss term; the noise prediction loss term is the mean square error between the noise predicted by the U-Net denoising network and the actual noise added during the forward diffusion process; the conditional classification loss term is the cross-entropy loss between the risk level probability distribution predicted by the denoising diffusion probability model and the actual risk level label.

8. The Bayesian-based power service risk level prediction method according to claim 7, characterized in that, The second joint loss function used by the risk level prediction network consists of a classification loss term, a contrastive learning loss term, and a weighted sum of the first joint loss function. The classification loss term is the cross-entropy loss between the predicted risk level probability distribution output by the risk level prediction network and the actual risk level label. The contrastive learning loss term is a loss function calculated based on the similarity between the fused features of work orders, used to shorten the feature distance between samples of the same risk level and widen the feature distance between samples of different risk levels.

9. A Bayesian-based power service risk level prediction device, characterized in that, include: The feature processing module is used to encode and concatenate multiple heterogeneous features of the target power service work order to obtain the fused features of the target power service work order. An input module is used to input the fusion features of the target power service work order into a trained risk prediction model; the risk prediction model includes a parameterized temporal Bayesian network and a risk level prediction network; wherein, the parameterized temporal Bayesian network is obtained by learning the conditional probability distribution of each node in the risk causal graph based on the training sample set; the risk causal graph is used to indicate the causal dependency between different risk factors and risk levels; The weighting module is used to quantify the causal contribution of each risk factor to the risk level through the parameterized temporal Bayesian network, and use the causal contribution as the feature weight to weight the fusion features of the target power service work order to obtain the causal perception feature vector of the target power service work order. The prediction module is used to input the causal perception feature vector of the target power service work order into the risk level prediction network and output the risk level of the target power service work order.

10. A computer device, characterized in that, The computer device includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement a Bayesian-based method for predicting the risk level of power services as described in any one of claims 1-8.