A method and system for electricity fee anomaly diagnosis based on a Bayesian network model
By using a Bayesian network model to process electricity bill data, the problems of low flexibility and high maintenance cost of electricity bill anomaly detection algorithms have been solved, enabling accurate traceability and rapid analysis of electricity bill settlement, and improving the management efficiency of the power system.
Patent Information
- Application Number
- CN202311539021.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-17
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-11-17
AI Technical Summary
Existing electricity bill anomaly detection algorithms suffer from low flexibility, high construction and maintenance costs, and limited data quality, making it difficult to meet the needs of complex and ever-changing business application scenarios.
A Bayesian network model is used to acquire detailed data from the volume and cost plan, audit anomalies, and factor library. Missing values are processed and discretized to construct the Bayesian network structure and parameters. The network is then optimized by combining the weights of influencing factors to identify anomaly types and influencing factors.
It enables accurate tracing of abnormal electricity charges, reduces the burden of manual analysis, improves the efficiency of electricity bill settlement, and enhances the management level of the power system.
Smart Images

Figure CN117633652B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the fields of information processing and electricity marketing, and specifically relates to a method and system for diagnosing abnormal electricity charges based on a Bayesian network model. Background Technology
[0002] Electricity bill settlement is a crucial component of power supply companies' revenue, significantly impacting their economic efficiency and sustainable development. Anomalies in electricity bill settlement primarily arise from issues such as record discrepancies, quantity-based billing discrepancies, and meter reading discrepancies. Record discrepancies are categorized into basic information anomalies, pricing strategy anomalies, metering parameter anomalies, and equipment parameter anomalies; quantity-based billing discrepancies are categorized into electricity consumption and billing discrepancies, quantity-based billing plan anomalies, and business process anomalies; and meter reading discrepancies are categorized into reading acquisition anomalies and meter installation / removal anomalies. Business personnel have constructed an anomaly factor database based on historical electricity bill settlement anomaly data and assigned weights to these factors.
[0003] With the development of machine learning technology, intelligent detection technology for electricity billing data anomalies based on machine learning is widely used in the field of electricity marketing. Various machine learning classification algorithms are used to process electricity billing data, select features, build and optimize models, thereby obtaining the optimal intelligent detection model for electricity billing data anomalies. Machine learning can learn from the complex nonlinear logic hidden in the data, automatically analyze and obtain patterns in the data, and use these patterns to predict unknown data. Traditional electricity billing data anomaly detection methods are mostly based on unsupervised learning and rule-based judgment methods, mainly including anomaly detection methods based on simple rules and data-driven anomaly detection algorithms.
[0004] Among them, the anomaly detection method based on simple rules relies on business experts to summarize common problems in the business, form a formal language description, and implement the rules through logical operations in programming languages. It is mainly used for problem discovery in the accounting process. It does not rely on complex model design and realizes the discovery of anomalies through simple logical judgment. For example, it can use the design of threshold strategy to filter out users with sudden increases or decreases in electricity consumption. It has the characteristics of efficient judgment and simple implementation. However, this method has low flexibility and scalability. For example, when the user's billing data is affected by seasonal or regional factors, the rules cannot adaptively adjust according to the monthly data, resulting in a large number of false alarms or missed alarms. Moreover, the algorithm is usually directly embedded in the billing code, which has high update and maintenance costs and high risk and cost of iterative optimization.
[0005] Data-driven anomaly detection algorithms typically do not rely on business knowledge. They construct parametric or nonparametric algorithm models by introducing various inductive biases and rely on application data for model training and tuning to achieve anomaly detection. Examples include KNN and OCSVM based on sample distance metrics, ensemble methods such as Random Forest and XGBoost, and neural network models. While these algorithms can adaptively adjust the model based on data, the high computational complexity of various models fails to meet the requirements of computational efficiency, and they are more often used for post-event problem verification and attribution. Furthermore, these algorithms are susceptible to the impact of data quality issues; when the quality of the data used for training is low, the model's detection performance often fails to meet the requirements of practical applications.
[0006] Furthermore, both accounting rules based on process problem discovery and algorithm models based on post-event verification rely heavily on human resources for their construction and maintenance. For example, iterative optimization of accounting rules requires business personnel to analyze and attribute the causes of monthly abnormal data and summarize and refine the content of rule optimization. For data-driven algorithm models, data acquisition and processing also consume a great deal of human resources. These conditions limit the performance of existing detection models and make it difficult to meet the increasingly complex and ever-changing business application scenarios. Summary of the Invention
[0007] To address the shortcomings of existing technologies, this invention provides a method and system for diagnosing electricity bill anomalies based on a Bayesian network model, which solves problems such as low flexibility, high construction and maintenance costs, and limited data quality in electricity bill anomaly detection algorithms.
[0008] To solve the above-mentioned technical problems, the present invention adopts the following technical solution.
[0009] This invention first discloses a method for diagnosing electricity bill anomalies based on a Bayesian network model, which includes the following steps:
[0010] Step 1: Obtain detailed data of billing plans, audit exceptions, and factor library from the marketing system database. Divide the data according to the user's electricity usage type to obtain detailed datasets of billing plans, audit exceptions, and factor library.
[0011] Step 2: Perform missing value processing and discretization on the data set of the billing plan details to determine the initial candidate set of business anomalies. Combine the data set of audit anomalies and the data set of factor library details to construct a sample dataset for the Bayesian network model, and divide it into training set and test set.
[0012] Step 3: Determine the initial Bayesian network structure and parameters based on the training set, and optimize the Bayesian network structure and parameters according to business experience and the influence factor weights in the factor library detailed data to obtain the optimized Bayesian network model.
[0013] Step 4: Based on the test set, use the optimized Bayesian network model to identify the anomaly type and associated influencing factors of each sample data, and determine the final business anomaly point based on the identification results and the candidate set of business anomaly points.
[0014] The present invention further includes the following preferred embodiments:
[0015] In step 1, the step of dividing the data according to the user's electricity consumption type to obtain the data set of detailed billing plans, the data set of audit anomalies, and the data set of factor library details further includes:
[0016] The detailed data of the quantity and cost plan, the detailed data of the audit exception, and the detailed data of the factor library are divided into dataset D. ab Where a = 1, 2, 3, representing the detailed data table to which each dataset belongs, namely the detailed data of the billing plan, the detailed data of the audit exception, and the detailed data of the factor library; b = 1, 2, 3, 4, 5, representing the user's electricity consumption type as low-voltage residential, low-voltage non-residential, high-voltage, photovoltaic, and others.
[0017] Step 2, determining the candidate set of business anomalies, further includes:
[0018] In the data set of the billing plan details, the influence factor attributes to be used are matched and retained in the factor library details dataset of the corresponding user electricity type. Data missing checks and completion are performed on the data set of the billing plan details dataset. For records with missing data, if the reading is missing, the record is marked as a reading omission and the missing influence factor is recorded as a candidate set of business anomalies.
[0019] Step 3, determining the initial Bayesian network structure based on the training set, further includes:
[0020] The BDeu scoring method is used as the scoring function to determine the network structure, and the hill climbing algorithm is used to search for the optimal network structure. The optimization model is defined as: M = (G, Ω, F).
[0021] In the formula: G is the set of possible network structures for all connections between variables in the sample dataset D; Ω is the set of constraints that need to be satisfied during the combinatorial optimization process, the most basic constraint being that the connections between all nodes form a directed acyclic graph; F is the scoring function; when M is at its maximum value, the obtained network structure is the optimal network structure; the BDeu scoring method transforms the optimization process into a maximum a posteriori probability estimation (MAP) problem. Among them, G * For the optimal structure, P(G|D) is the posterior probability.
[0022] Step 4, before identifying the anomaly type and associated influencing factors for each sample data using the optimized Bayesian network model, further includes:
[0023] Based on the Bayesian network model, the i-th sample X is calculated. i Distinguish into each anomaly type c k The posterior probability P(C=c k |X i Each sample is classified into 0, 1, or multiple anomaly types, and compared with the actual anomaly types to calculate the accuracy index. When the model accuracy reaches or exceeds the preset accuracy threshold, the sample data is identified using the Bayesian network model; otherwise, the Bayesian network structure and parameter learning results are further corrected.
[0024] This invention also discloses a Bayesian network model-based electricity bill anomaly diagnosis system that utilizes the aforementioned Bayesian network model-based electricity bill anomaly diagnosis method, including a detailed data acquisition and partitioning module, a sample data construction module, a Bayesian network model construction module, and an electricity bill anomaly diagnosis module.
[0025] The detailed data acquisition and division module is used to acquire detailed data of the billing plan, detailed data of audit anomalies, and detailed data of the factor library from the marketing system database, and divide them according to the user's electricity consumption type to obtain detailed datasets of the billing plan, detailed datasets of audit anomalies, and detailed datasets of the factor library respectively.
[0026] The sample data construction module is used to process missing values and discretize the data set of the billing plan details, determine the initial candidate set of business anomalies, and construct a sample dataset for the Bayesian network model by combining the audit anomaly details dataset and the factor library details dataset, and divide the dataset into training set and test set.
[0027] The Bayesian network model building module is used to determine the initial Bayesian network structure and parameters based on the training set, and to optimize the Bayesian network structure and parameters according to business experience and the influence factor weights in the factor library detailed data to obtain the optimized Bayesian network model.
[0028] The electricity bill anomaly diagnosis module is used to identify the anomaly type and associated influencing factors of each sample data based on the test set using an optimized Bayesian network model, and to determine the final business anomaly point based on the identification results and the business anomaly point candidate set.
[0029] Accordingly, this application also discloses a terminal, including a processor and a storage medium;
[0030] The storage medium is used to store instructions;
[0031] The processor is configured to operate according to the instructions to perform the steps of the aforementioned method for diagnosing electricity bill anomalies based on a Bayesian network model.
[0032] Accordingly, this application also discloses a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the aforementioned method for diagnosing electricity bill anomalies based on a Bayesian network model.
[0033] The beneficial effects of this invention are as follows: Compared with existing technologies, this invention provides a method and system for diagnosing electricity bill anomalies based on a Bayesian network model. This method can accurately trace the source of anomalies, helping business management to identify potential problems and weaknesses in the electricity billing process, continuously optimize the electricity billing business rule system, and improve the overall management level of the power system. In model training, the dataset is divided according to user electricity consumption type, and Bayesian network models are built for each type, significantly reducing the number of parameters used to build the Bayesian network model and lowering the complexity of the network structure. During the structure learning process of building the Bayesian network model, the BDeu scoring method and hill climbing method are used to search for the preliminary network structure. Then, based on business experience, nodes that do not conform to experience, directed connections, and isolated nodes are removed, improving the accuracy, interpretability, and practicality of the network. In the parameter learning process of building the Bayesian network model, Bayesian estimation is used to fully utilize prior information to regularize the parameters, thereby avoiding overfitting. By appropriately setting the hyperparameters of the prior distribution, the bias and variance of parameter estimation can be controlled, balancing model complexity and prediction accuracy, thus improving the model's robustness, reliability, and generalization ability. Introducing influence factor weights that incorporate business experience to adjust the node probability distribution enhances the model's adaptability. If user sample data is marked as an audit anomaly, further analysis of the influencing factors causing the electricity bill settlement anomaly is conducted, comprehensively considering indicators such as the contribution of influencing factors, popularity ranking, and influence factor weights to ultimately trace the source of the influencing factors. A statistical relationship between the factor library and audit anomalies is established using a Bayesian network model to determine the type of electricity bill settlement anomaly, reducing identification time compared to the current exhaustive method used for anomaly identification. Attached Figure Description
[0034] Figure 1 This is a flowchart of the electricity bill anomaly diagnosis method based on Bayesian network model in this invention.
[0035] Figure 2 This is an example diagram of the Bayesian network model in this invention. Detailed Implementation
[0036] To make the objectives, technical solutions, and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
[0037] The embodiments described in this application are merely some, not all, embodiments of the present invention. Based on the spirit of the present invention, other embodiments obtained by those skilled in the art without inventive effort are all within the protection scope of the present invention.
[0038] To address the shortcomings of existing technologies, this invention proposes a method and system for diagnosing electricity bill anomalies based on a Bayesian network model. By leveraging the Bayesian network model, data processing, feature selection, model construction, and optimization are performed on electricity bill data. This establishes a correlation between an electricity bill settlement factor library and settlement anomaly types. Then, by combining the weights of influencing factors, the identified anomaly types are mapped onto the influencing factors, outputting the anomalies in the business operations. This intelligently detects abnormal electricity bill settlement data and influencing factors, enabling intelligent, accurate, and rapid analysis and tracing of electricity bill settlement anomalies. This reduces the workload of manual analysis for business personnel and improves the efficiency of electricity bill settlement.
[0039] The electricity bill anomaly diagnosis method based on a Bayesian network model disclosed in this invention includes the following steps:
[0040] Step 1: Obtain detailed data on electricity usage and billing plans, audit exceptions, and factor library from the marketing system database. Divide these data according to the user's electricity usage type to obtain detailed datasets for electricity usage and billing plans, audit exceptions, and factor library.
[0041] See Figure 1 First, detailed data on electricity consumption and billing plans, audit exception details, and factor library details are retrieved from the marketing system database. The fields in the detailed data on electricity consumption and billing plans include basic user information, business change information, and electricity consumption and pricing information. The fields in the audit exception details include basic user information, exception type, and exception description. The fields in the factor library details include basic information about the influencing factors, the applicable objects of the influencing factors (user electricity consumption type), the exception type used to determine the applicability of the influencing factors, and the weight of their impact on electricity billing.
[0042] The detailed data of the billing plan, the detailed data of audit anomalies, and the detailed data of the factor library are divided into 5 datasets according to the user's electricity consumption type, denoted as D. ab Where a = 1, 2, 3 represent the detailed data tables to which each dataset belongs, namely, the detailed data of the billing plan, the detailed data of audit exceptions, and the detailed data of the factor library; b = 1, 2, 3, 4, 5 represent the electricity consumption type of each user, including low-voltage residential, low-voltage non-residential, high-voltage, photovoltaic, and others, forming the detailed data set D of the billing plan. 1b , Audit Anomaly Details Dataset D 2b and Factor Library Detailed Dataset D 3b .
[0043] Step 2: Perform missing value processing and discretization on the data volume and fee plan details dataset to determine the initial candidate set of business anomalies. Combine the audit anomaly details dataset and the factor library details dataset to construct a sample dataset for the Bayesian network model, and divide it into training set and test set.
[0044] In the data set D of the billing plan details 1b In the detailed dataset D of the factor library corresponding to the user's electricity consumption type, respectively 3b The matching process retains the influencing factor attributes to be used for subsequent analysis and processing. This applies to the quantity-based pricing plan details dataset D. 1b Perform data missing checks and completion. For records with missing data, if the missing value is a reading, mark the record as "reading missing" and record the specific impact factors of the missing value as a candidate set of business anomalies.
[0045] Then, for each data set D of the billing plan details... 1b Further data preprocessing is performed. Because Bayesian networks have superior processing performance for discrete data, the detailed data set D of the quantity and cost plan is preprocessed. 1b The continuous numerical influencing factors are discretized using the equal-frequency binning method, such as large industrial electricity consumption, residential electricity consumption, and agricultural electricity consumption.
[0046] In a specific preferred embodiment, the continuous data is discretized using the equal-frequency binning method, further including:
[0047] 1. Sort the detailed data of the quantity and cost plan in ascending or descending order.
[0048] 2. Divide the sorted data into k equal parts, each containing... There are n data points, where n is the total number of data points.
[0049] 3. Determine the boundaries of each subset, that is, determine each data score, so that the data values in each subset are within the range above and below that score.
[0050] 4. Distribute the data into appropriate subsets so that each subset contains a similar number of data points.
[0051] Based on historical data usage and billing audit information, for each data usage and billing plan detail dataset D 1b Each record X i (i = 1, 2, ..., m) marks a field c. i ∈{0,1,……,k}, used to identify the audit exception type. Where 0 indicates that the billing record has no exceptions, and 1 to k represent the matched exception types in the corresponding audit exception details dataset D. 2b The sequence number in the data. In particular, since the data used in subsequent modeling no longer contains empty data, it is impossible to correctly identify the corresponding anomaly type. Therefore, the anomaly type corresponding to "missed reading" is not marked.
[0052] Data set D of the quantity and cost plan details 1b The sample data is randomly arranged and divided into training and test sets in a 3:1 ratio for subsequent Bayesian network model calculations.
[0053] Step 3: Determine the initial Bayesian network structure and parameters based on the training set, and optimize the Bayesian network structure and parameters using the influence factor weights in the detailed data of the factor library to obtain the optimized Bayesian network model.
[0054] Structure learning in the Bayesian network model is performed using the training set. The BDeu scoring method is employed for scoring, and a hill-climbing algorithm is used to search for the optimal network structure. The initial network structure may contain parts that contradict common sense and professional knowledge, as well as irrelevant nodes. Therefore, data fusion processing is performed incorporating business expert knowledge to reconstruct and sort the relationships between nodes of various influencing factors. Nodes and directed connections that do not conform to modeling experience are removed, and isolated irrelevant nodes are eliminated, resulting in the final Bayesian network structure, which is a directed acyclic graph.
[0055] In a specific preferred embodiment, the search-based scoring method treats the structure learning of Bayesian networks as a combinatorial optimization problem. By determining the scoring function of the network structure, the optimal network structure is found using an algorithmic search, which can be defined as the optimization model: M = (G, Ω, F). Where: G is the set of possible network structures representing the connections between all variables in the sample dataset D; Ω is the set of constraints that need to be satisfied during the combinatorial optimization process, the most basic constraint being that the connections between all nodes form a directed acyclic graph; F is the scoring function. When M reaches its maximum value, the obtained network structure is the optimal network structure. The BDeu scoring method is a Bayesian-based scoring function that transforms the optimization process into a maximum a posteriori (MAP) probability estimation problem. Among them, G *For the optimal structure, P(G|D) is the posterior probability.
[0056] After determining the Bayesian network structure, parameter learning of the Bayesian network model is performed. First, the initial conditional probability distribution of each node in the Bayesian network structure is determined using Bayesian estimation. Then, based on the degree of influence of each node on anomaly type discrimination, i.e., the corresponding influence factor weight, the conditional probability of each node is amplified or reduced to obtain the final Bayesian network model B. Figure 2 This is an example diagram of the Bayesian network model in this invention.
[0057] In a preferred embodiment, the parameter learning process employs Bayesian estimation to calculate the posterior probability. This Bayesian estimation method, based on Bayes' principle, calculates the posterior distribution (i.e., the parameter learning result) using sample data and Bayes' formula. For a dataset with n variables {x1, x2, ..., x...}... n A Bayesian network consisting of nodes x and x', where x is a node. i There are a total of r i Each value can be 1, 2, ..., r i Its parent node π(x) i There are a total of q i The possible combinations of values 1, 2, ..., q i If x i If there is no parent node, then q i =1. Therefore, the parameters of the Bayesian equation are: θ ijk =P(x i =k|π(x) i ) = j). Where i takes values from 1, 2, ..., n, x i Let j represent the i-th variable among n variables. The range of j is 1, 2, ..., q. i , indicating its parent node π(x) i The j-th possible combination of values for k; the range of k is 1, 2, ..., r. i , representing x i The k-th possible value, denoted by θ, represents all parameters θ. ijk The vector formed by these vectors, P(θ) is the prior distribution of θ.
[0058] Since each influencing factor node approximately follows a multinomial distribution, the prior distribution of P(θ) can be considered to follow a Dirichlet distribution. For a given sample dataset D, if the posterior probability of parameter θ is expressed as P(θ|D), which also follows a Dirichlet distribution and satisfies the conditional independence of node parameters, then the parameter learning result... It can be calculated using the following formula:
[0059]
[0060] Where, mijk x represents i The value is k, and x i The parent node π(x) i The number of samples corresponding to the j-th value combination, a ijk For θ ijk The corresponding hyperparameters in the Dirichlet distribution.
[0061] The above estimates are obtained Further adjustments are made using the influence factor weights obtained from the detailed data in the factor library. Let its node be x. i The weight is w i ,make Then normalize, making
[0062] Validate the effectiveness of the Bayesian network model on the test set. Calculate the value of the i-th sample X based on the Bayesian network model. i Distinguish into each anomaly type c k The posterior probability P(C=c k |X i Select an appropriate threshold to classify each sample into 0, 1, or multiple anomaly types, and compare the classification with the actual anomaly types, calculating metrics such as accuracy and misclassification rate. When the model accuracy reaches or exceeds a preset accuracy threshold (e.g., 80%), the model is considered to have good prediction and discrimination performance and can be used in real-world scenarios. Otherwise, further refine the Bayesian network structure and parameter learning results based on business experience until the model's prediction and discrimination performance is satisfactory.
[0063] Step 4: Based on the test set, use the optimized Bayesian network model to identify the anomaly type and associated influencing factors of each sample data, and determine the final business anomaly point based on the identification results and the candidate set of business anomaly points.
[0064] If the number of anomaly types identified for sample i is not zero, further analysis is needed to determine the influencing factors causing the anomalies. Using the backward inference technique of Bayesian networks, the influencing factors causing the electricity bill settlement anomalies are identified. The conditional probability P(X=x) of each node when it is identified as an anomaly is calculated. t |C=c s ), where x t This indicates that the influence factor node takes the t-th value, c s This indicates that the anomaly is classified as type s. The conditional probability is used as the contribution of this influencing factor node to the anomaly classification.
[0065] Extract all relevant influence factors f from the anomaly types identified in the user samples. j Statistical analysis of the frequency of occurrence of each influencing factor v jThe factors are then sorted to obtain a list of influence factors ranked by popularity, where j = 1, 2, ..., η, and η is the total number of influence factors involved.
[0066] Based on the impact factor popularity ranking list, and combining the contribution of each impact factor with the existing impact weight w of impact factor j, j And from the data missing analysis process, a candidate set of business anomalies is obtained to determine the final business anomalies.
[0067] The beneficial effects of this invention are as follows: Compared with existing technologies, this invention provides a method and system for diagnosing electricity bill anomalies based on a Bayesian network model. This method can accurately trace the source of anomalies, helping business management to identify potential problems and weaknesses in the electricity billing process, continuously optimize the electricity billing business rule system, and improve the overall management level of the power system. In model training, the dataset is divided according to user electricity consumption type, and Bayesian network models are built for each type, significantly reducing the number of parameters used to build the Bayesian network model and lowering the complexity of the network structure. During the structure learning process of building the Bayesian network model, the BDeu scoring method and hill climbing method are used to search for the preliminary network structure. Then, based on business experience, nodes that do not conform to experience, directed connections, and isolated nodes are removed, improving the accuracy, interpretability, and practicality of the network. In the parameter learning process of building the Bayesian network model, Bayesian estimation is used to fully utilize prior information to regularize the parameters, thereby avoiding overfitting. By appropriately setting the hyperparameters of the prior distribution, the bias and variance of parameter estimation can be controlled, balancing model complexity and prediction accuracy, thus improving the model's robustness, reliability, and generalization ability. Introducing influence factor weights that incorporate business experience to adjust the node probability distribution enhances the model's adaptability. If user sample data is marked as an audit anomaly, further analysis of the influencing factors causing the electricity bill settlement anomaly is conducted, comprehensively considering indicators such as the contribution of influencing factors, popularity ranking, and influence factor weights to ultimately trace the source of the influencing factors. A statistical relationship between the factor library and audit anomalies is established using a Bayesian network model to determine the type of electricity bill settlement anomaly, reducing identification time compared to the current exhaustive method used for anomaly identification.
[0068] This invention can be a system, method, and / or computer program product. This invention also discloses a Bayesian network model-based electricity bill anomaly diagnosis system based on the aforementioned Bayesian network model-based electricity bill anomaly diagnosis method, comprising a detailed data acquisition and partitioning module, a sample data construction module, a Bayesian network model construction module, and an electricity bill anomaly diagnosis module.
[0069] The detailed data acquisition and division module is used to acquire detailed data of the billing plan, detailed data of audit anomalies, and detailed data of the factor library from the marketing system database, and divide them according to the user's electricity consumption type to obtain detailed datasets of the billing plan, detailed datasets of audit anomalies, and detailed datasets of the factor library respectively.
[0070] The sample data construction module is used to process missing values and discretize the data set of the billing plan details, determine the initial candidate set of business anomalies, and construct a sample dataset for the Bayesian network model by combining the audit anomaly details dataset and the factor library details dataset, and divide the dataset into training set and test set.
[0071] The Bayesian network model construction module is used to determine the initial Bayesian network structure and parameters based on the training set, and to optimize the Bayesian network structure and parameters using the influence factor weights in the detailed data of the factor library, so as to obtain the optimized Bayesian network model.
[0072] The electricity bill anomaly diagnosis module is used to identify the anomaly type and associated influencing factors of each sample data based on the test set using an optimized Bayesian network model, and to determine the final business anomaly point based on the identification results and the business anomaly point candidate set.
[0073] Based on the spirit of this invention, those skilled in the art will readily conceive of a computer program product derived from the aforementioned Bayesian network model-based electricity bill anomaly diagnosis method. The computer program product may include a computer-readable storage medium on which computer-readable program instructions are loaded to enable a processor to implement various aspects of this disclosure. That is, this application also includes a terminal comprising a processor and a storage medium; the storage medium is used to store instructions; the processor is used to operate according to the instructions to execute the steps of the aforementioned Bayesian network model-based electricity bill anomaly diagnosis method.
[0074] Computer-readable storage media can be tangible devices capable of holding and storing instructions for use by an instruction execution device. Computer-readable storage media can be, for example, but not limited to, electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination of the foregoing. The computer-readable storage media used herein are not to be construed as transient signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or electrical signals transmitted through wires.
[0075] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.
[0076] Computer program instructions used to perform the operations of this disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing the status information of the computer-readable program instructions to implement various aspects of this disclosure.
[0077] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the specific implementation of the present invention. Any modifications or equivalent substitutions that do not depart from the spirit and scope of the present invention should be covered within the protection scope of the claims of the present invention.
Claims
1. A method for diagnosing electricity bill anomalies based on a Bayesian network model, characterized in that, Includes the following steps: Step 1: Obtain detailed data of billing plans, audit exceptions, and factor library from the marketing system database. Divide the data according to the user's electricity usage type to obtain detailed datasets of billing plans, audit exceptions, and factor library. Step 2: Perform missing value processing and discretization on the data volume and fee plan details dataset to determine the candidate set of business anomalies. Combine the audit anomaly details dataset and the factor library details dataset to construct a sample dataset for the Bayesian network model, and divide it into training set and test set. Step 3: Determine the initial Bayesian network structure and parameters based on the training set, and optimize the Bayesian network structure and parameters according to business experience and the influence factor weights in the factor library detailed data to obtain the optimized Bayesian network model. For a given sample dataset , parameters The posterior probability is expressed as If the parameter learning result also follows a Dirichlet distribution and satisfies the conditional independence of node parameters, then the parameter learning result... It can be calculated using the following formula: in, express Values ,and parent node The combination of values is the first The number of samples corresponding to the seeding time. for The corresponding hyperparameters in the Dirichlet distribution; The above estimates are obtained Further adjustments are made using the influence factor weights obtained from the detailed data in the factor library, and the nodes to which they belong are set. The weight is ,make Then normalize, so that =1; Step 4: Based on the test set, use the optimized Bayesian network model to identify the anomaly type and associated influencing factors of each sample data, and determine the final business anomaly point based on the identification results and the candidate set of business anomaly points. Calculate the conditional probability of each node when it is identified as an anomaly. ,in, Indicates that the impact factor node is the first one. t One value, Indicates that the discrimination is the first s The anomaly type is identified; the conditional probability is used as the contribution of the influencing factor node to the anomaly detection. Extract all relevant influencing factors from the anomaly types identified in the user samples. Statistical analysis of the frequency of occurrence of each influencing factor And sort them to obtain a list of influence factors ranked by popularity, where , This refers to the total number of impact factors involved. Based on the impact factor popularity ranking list, and combining the contribution of each impact factor with the existing impact weight of impact factor j, And from the data missing analysis process, a candidate set of business anomalies is obtained to determine the final business anomalies.
2. The electricity bill anomaly diagnosis method based on Bayesian network model according to claim 1, characterized in that, In step 1, the step of dividing the data according to the user's electricity consumption type to obtain the data set of detailed billing plans, the data set of audit anomalies, and the data set of factor library details further includes: The detailed data of the volume and cost plan, the detailed data of audit exceptions, and the detailed data of the factor library are divided into datasets. ,in, Each represents a detailed data table to which each dataset belongs, namely, detailed data of quantity and cost plan, detailed data of audit exceptions, and detailed data of factor library; These represent the user's electricity consumption type as low-voltage residential, low-voltage non-residential, high-voltage, photovoltaic, and others.
3. The electricity bill anomaly diagnosis method based on Bayesian network model according to claim 2, characterized in that, Step 2, determining the candidate set of business anomalies, further includes: In the data set of the billing plan details, the influence factor attributes to be used are matched and retained in the factor library details dataset of the corresponding user electricity type. Data missing checks and completion are performed on the data set of the billing plan details dataset. For records with missing data, if the reading is missing, the record is marked as a reading omission and the missing influence factor is recorded as a candidate set of business anomalies.
4. The electricity bill anomaly diagnosis method based on Bayesian network model according to claim 3, characterized in that, Step 3, determining the initial Bayesian network structure based on the training set, further includes: The BDeu scoring method is used as the scoring function for the network structure, and a hill-climbing algorithm is used to search for the optimal network structure. An optimization model is defined as follows: ; In the formula: For sample dataset A set of network structures representing all possible connections between variables; The set of constraints that need to be satisfied during combinatorial optimization is the most basic constraint that the connections between all nodes form a directed acyclic graph. For the scoring function; when When the maximum value is reached, the resulting network structure is the optimal network structure; the BDeu scoring method transforms the optimization process into a maximum a posteriori probability estimation (MAP) problem. ,in, For optimal structure, Let be the posterior probability.
5. The electricity bill anomaly diagnosis method based on Bayesian network model according to claim 4, characterized in that, In step 4, before identifying the anomaly type and associated influencing factors for each sample data using the optimized Bayesian network model, the following further steps are included: Based on the Bayesian network model, the i-th sample is calculated. Identify each type of anomaly posterior probability Each sample is classified into 0, 1, or multiple anomaly types, and compared with the actual anomaly types to calculate the accuracy index. When the model accuracy reaches or exceeds the preset accuracy threshold, the Bayesian network model is used to identify the sample data; otherwise, the Bayesian network structure and parameter learning results are further corrected.
6. A Bayesian network model-based electricity bill anomaly diagnosis system utilizing the Bayesian network model-based electricity bill anomaly diagnosis method according to any one of claims 1-5, comprising a detailed data acquisition and partitioning module, a sample data construction module, a Bayesian network model construction module, and an electricity bill anomaly diagnosis module, characterized in that: The detailed data acquisition and division module is used to acquire detailed data of the billing plan, detailed data of audit anomalies, and detailed data of the factor library from the marketing system database, and divide them according to the user's electricity consumption type to obtain detailed datasets of the billing plan, detailed datasets of audit anomalies, and detailed datasets of the factor library respectively. The sample data construction module is used to process missing values and discretize the data set of the quantity and cost plan details, determine the candidate set of business anomalies, and construct a sample dataset for the Bayesian network model by combining the audit anomaly details dataset and the factor library details dataset, and divide the dataset into training set and test set. The Bayesian network model building module is used to determine the initial Bayesian network structure and parameters based on the training set, and to optimize the Bayesian network structure and parameters according to business experience and the influence factor weights in the factor library detailed data to obtain the optimized Bayesian network model. For a given sample dataset , parameters The posterior probability is expressed as If the parameter learning result also follows a Dirichlet distribution and satisfies the conditional independence of node parameters, then the parameter learning result... It can be calculated using the following formula: in, express Values ,and parent node The combination of values is the first The number of samples corresponding to the seeding time. for The corresponding hyperparameters in the Dirichlet distribution; The above estimates are obtained Further adjustments are made using the influence factor weights obtained from the detailed data in the factor library, and the nodes to which they belong are set. The weight is ,make Then normalize, so that =1; The electricity bill anomaly diagnosis module is used to identify the anomaly type and associated influencing factors of each sample data based on the test set using an optimized Bayesian network model, and to determine the final business anomaly point based on the identification results and the business anomaly point candidate set. Calculate the conditional probability of each node when it is identified as an anomaly. ,in, Indicates that the impact factor node is the first one. t One value, Indicates that the discrimination is the first s The anomaly type is identified; the conditional probability is used as the contribution of the influencing factor node to the anomaly detection. Extract all relevant influencing factors from the anomaly types identified in the user samples. Statistical analysis of the frequency of occurrence of each influencing factor And sort them to obtain a list of influence factors ranked by popularity, where , This refers to the total number of impact factors involved. Based on the impact factor popularity ranking list, and combining the contribution of each impact factor with the existing impact weight of impact factor j, And from the data missing analysis process, a candidate set of business anomalies is obtained to determine the final business anomalies.
7. The electricity bill anomaly diagnosis system based on a Bayesian network model according to claim 6, characterized in that, The detailed data acquisition and partitioning module is further used for: The detailed data of the volume and cost plan, the detailed data of audit exceptions, and the detailed data of the factor library are divided into datasets. ,in, Each represents a detailed data table to which each dataset belongs, namely, detailed data of quantity and cost plan, detailed data of audit exceptions, and detailed data of factor library; These represent the user's electricity consumption type as low-voltage residential, low-voltage non-residential, high-voltage, photovoltaic, and others.
8. The electricity bill anomaly diagnosis system based on a Bayesian network model according to claim 7, characterized in that, The sample data construction module is further used for: In the detailed data set of the billing plan, the influence factor attributes to be used are matched and retained in the detailed data set of the factor library for the corresponding user electricity consumption type. Data missing checks and completion are performed on the data volume and cost plan details dataset. For records with missing data, if the missing reading is due to a missing reading, the record is marked as a missing reading and the impact factor of the missing data is recorded as a candidate set of business anomalies.
9. The electricity bill anomaly diagnosis system based on a Bayesian network model according to claim 8, characterized in that, The Bayesian network model construction module is further used for: The BDeu scoring method is used as the scoring function to determine the network structure, and a hill-climbing algorithm is used to search for the optimal network structure. An optimization model is defined as follows: ; In the formula: For sample dataset A set of network structures representing all possible connections between variables; The set of constraints that need to be satisfied during combinatorial optimization is the most basic constraint that the connections between all nodes form a directed acyclic graph. For the scoring function; when When the maximum value is reached, the resulting network structure is the optimal network structure; the BDeu scoring method transforms the optimization process into a maximum a posteriori probability estimation (MAP) problem. ,in, For optimal structure, Let be the posterior probability.
10. The electricity bill anomaly diagnosis system based on a Bayesian network model according to claim 9, characterized in that, The electricity bill anomaly diagnosis module is further used for: Based on the Bayesian network model, the i-th sample is calculated. Identify each type of anomaly posterior probability Each sample is classified into 0, 1, or multiple anomaly types, and compared with the actual anomaly types to calculate the accuracy index. When the model accuracy reaches or exceeds the preset accuracy threshold, the Bayesian network model is used to identify the sample data; otherwise, the Bayesian network structure and parameter learning results are further corrected.
11. A terminal, comprising a processor and a storage medium; characterized in that: The storage medium is used to store instructions; The processor is configured to operate according to the instructions to perform the steps of the electricity bill anomaly diagnosis method based on a Bayesian network model according to any one of claims 1-5.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the steps of the electricity bill anomaly diagnosis method based on a Bayesian network model as described in any one of claims 1-5.
Citation Information
Patent Citations
Deep Bayesian network modeling training method
CN114492741A
Bayesian network structure optimization method and device based on frequent item mining
CN114925834A
