A Method and System for Optimizing and Generating Electricity Consumption Inspection Plans Based on Tree-structured Parzen Estimator
By constructing a global probabilistic proxy model based on the tree-structured Parzen estimator, the problems of single data features and inaccurate risk assessment in existing electricity inspection plan generation methods are solved. This enables intelligent, refined, and efficient generation of electricity inspection plans, improving inspection accuracy and the balance of resource allocation.
Patent Information
- Application Number
- CN202611319795.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-28
- Publication Date
- 2026-11-17
AI Technical Summary
Existing methods for generating electricity inspection plans rely on manual experience and lack dynamic feature mining and hierarchical parameter optimization. This leads to repetitive inspections of high-frequency, low-risk users and missed inspections of high-risk users. These methods cannot adapt to the dynamic changes in users' electricity consumption behavior, result in uneven allocation of inspection resources, and make it difficult to accurately match electricity risk patterns.
A tree-structured Parzen estimator-based approach is adopted. By collecting and cleaning electricity bill data, user basic information, load fluctuation characteristics, metering anomaly characteristics, and default history characteristics are extracted. A multidimensional hyperparameter space is constructed and a tree-structured hierarchical partition is performed. A global probabilistic proxy model is established, and combined with optimization algorithms and incremental sample updates, a high-precision electricity inspection plan is generated.
It enables the intelligent, refined, and efficient generation of electricity inspection plans, improving inspection accuracy and efficiency, avoiding low-risk duplicate inspections and high-risk user omissions, taking into account user priority and regional balance, and enhancing the targeting and fault tolerance of inspection resources.
Smart Images

Figure CN123117652A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of power system technology, and in particular to a method and system for optimizing and generating electricity consumption inspection plans based on a tree-structured Parzen estimator. Background Technology
[0002] Currently, most existing methods for generating electricity inspection plans rely on manual experience and fixed inspection frequencies. They simply schedule plans based on basic user information or static anomaly data, failing to deeply explore dynamic characteristics such as load fluctuation evolution, metering anomaly patterns, and temporal changes in default behavior. The feature dimensions are limited, and the data analysis is superficial. Furthermore, these methods lack hierarchical parameter optimization and probability fitting mechanisms, making it impossible to quantify the actual effectiveness probability of different inspection plans. This hinders the accurate matching of different users' electricity risk patterns, easily leading to issues like repeated inspections of high-frequency, low-risk users and missed inspections of high-risk users. In addition, existing methods lack incremental iterative update capabilities, failing to adapt to dynamic changes in user electricity behavior in real time. Plan optimization is lagging, convergence is poor, and they rarely consider user risk priorities and regional inspection load balance. Overall, inspection resource allocation is crude, lacks specificity, and has low fault tolerance, making it difficult to adapt to complex and ever-changing electricity user scenarios. Inspection efficiency and accuracy suffer from significant bottlenecks.
[0003] Therefore, there is an urgent need for a new method for generating electricity inspection plans that can adaptively correct the model, accurately improve the effectiveness of electricity inspections and the accuracy of anomaly detection, and take into account user priority and regional balance. This will enable the intelligent, refined and efficient generation of electricity inspection plans, thereby solving the problems of single data features, repeated low-risk inspections and missed detection of high-risk users, as well as poor user risk priority and regional balance in existing electricity inspection plan generation methods. Summary of the Invention
[0004] The technical problem to be solved by the embodiments of the present invention is to provide a method and system for optimizing and generating electricity inspection plans based on a tree-structured Parzen estimator. This method can adaptively correct the model, accurately improve the effectiveness of electricity inspections and the accuracy of anomaly detection, and take into account user priority and regional balance. This enables intelligent, refined and efficient generation of electricity inspection plans, thereby solving the problems of single data features, repeated low-risk inspections and missed detection of high-risk users, and poor user risk priority and regional balance in existing electricity inspection plan generation methods.
[0005] To address the aforementioned technical problems, this invention provides a method for optimizing and generating electricity usage inspection plans based on a tree-structured Parzen estimator. The method includes the following steps: S1. Collect electricity consumption records from users, and after cleaning and normalizing the relevant electricity consumption data in the electricity consumption records, divide them into multiple samples according to a predetermined time window. Furthermore, each sample is labeled with key parameters and performance indicators of the inspection plan actually implemented during the corresponding period. The electricity consumption records include basic user information, historical electricity load curves, metering device operation records, and past violations of electricity consumption regulations. The historical electricity load curves and the metering device operation records both carry relevant electricity consumption data. S2. Extract the electricity consumption characteristics of each sample, and use a time sliding window to statistically analyze the evolution trend of the same electricity consumption characteristic in a continuous period. Quantify the evolution trend into a feature increment sequence, and further align it with the execution cycle preset by the inspection plan to form a dynamic feature matrix. The electricity consumption characteristics of each sample include user basic information characteristics, load fluctuation characteristics, metering anomaly characteristics, and default history characteristics. S3. Using the key parameters of the inspection plan as the hyperparameters to be optimized, a multidimensional hyperparameter space is constructed. Based on the dynamic feature matrix, the multidimensional hyperparameter space is divided into a tree structure hierarchy, so that each node of the tree structure corresponds to an electricity consumption feature. An independent kernel density estimation function is established on each node to fit the kernel density distribution of the plan under the condition of that node. Furthermore, based on the dependency relationship of the transmission of probability density information between the upper and lower level nodes of the tree structure, a global probability proxy model is constructed. S4. An optimization algorithm is used to iteratively calculate the multidimensional hyperparameter space until the convergence condition is met. In each iteration, multiple candidate plans are generated by sampling from the multidimensional hyperparameter space. Based on the global probabilistic proxy model, the expected improvement value of each candidate plan in each iteration is calculated. The candidate plan with the largest expected improvement value in each iteration is taken as the optimal candidate plan. After the optimal candidate plan selected in each iteration is deployed and executed on site, the corresponding actual performance data is collected. The actual performance data collected in each iteration is incrementally updated to the global probabilistic proxy model to correct the kernel density of each level of node. S5. After the iterative calculation of the multidimensional hyperparameter space is determined to be terminated, the hyperparameters in the final optimal candidate plan scheme are parsed into executable plan entries, and the initial scheme set is output by summarizing them according to the user's basic information.
[0006] Specifically, step S1 includes: Collect electricity user electricity consumption records; wherein, the electricity consumption records include basic user information, historical electricity load curves, metering device operation records, and past violations of electricity consumption regulations; the basic user information includes industry category, electricity capacity, and power supply area; the industry category is the user's business classification; the electricity capacity is the transformer capacity or maximum demand stipulated in the contract; the power supply area is the area code; the historical load curve is an active load time series sampled hourly / daily; the metering operation records include voltage phase loss duration, current imbalance, power factor, and meter clock deviation; the past violations of electricity consumption regulations include the number of violations, the type of violation, and the time of violation; The relevant electricity consumption data in the electricity consumption account file is cleaned, including removing abnormal records with negative load or voltage deviation exceeding ±20%; and missing values are filled by linear interpolation between adjacent time points. If more than 3 consecutive sampling points are missing, the average value of the same time point of the two adjacent days is used to replace them. The electricity consumption data in the electricity consumption account file is normalized, including applying minimum-maximum normalization to all continuous features so that they fall into the [0,1] interval; and converting categorical features into one-hot encoding. Using the natural week as the basic unit, the average active load, voltage phase loss duration, current imbalance, power factor, meter clock deviation, number of defaults, default type, and default time are statistically analyzed for each week. These data are then aligned with the user's basic information to form weekly records. Furthermore, a first time sliding window with a width of L weeks is used to combine L consecutive weekly records into a single sample to obtain multiple samples; where L is a positive integer greater than 1. For each sample, the key parameters of the inspection plan actually implemented in the week following the end of the first time window and the post-implementation performance indicators are labeled as tags, resulting in multiple labeled samples.
[0007] Specifically, step S2 includes: Extract the electricity consumption characteristics of each sample; wherein, the electricity consumption characteristics of each sample include user basic information characteristics, load fluctuation characteristics, metering anomaly characteristics, and default history characteristics; Based on the load fluctuation characteristics of each sample, a second time window with a width of W weeks is used to statistically analyze the mean and change of the load fluctuation characteristics of each sample within the continuous period. After taking the feature difference between the last period and the first period within each second time window as the feature increment, the feature increment value of the load fluctuation characteristics of each sample is aligned with the center time of the second time window to form the load fluctuation feature increment sequence of each sample; where W is 1 / n times L; and W and n are both positive integers greater than 1. Based on the measurement anomaly characteristics of each sample, the second time sliding window is used to statistically calculate the mean and change of the measurement anomaly characteristics in a continuous period. After taking the feature difference between the end period and the beginning period in each second time sliding window as the feature increment, the feature increment values of the measurement anomaly characteristics of each sample are aligned with the center time of the second time sliding window to form the measurement anomaly characteristic increment sequence of each sample. Based on the default history characteristics of each sample, the second time window is used to calculate the mean and change of the default history characteristics of each sample in the continuous period. After taking the feature difference between the end period and the beginning period in each second time window as the feature increment, the increment value of the default history characteristics of each sample is aligned with the center time of the second time window to form the default history characteristic increment sequence of each sample. Using the width of the second time sliding window, static feature expansion is performed on the user basic information features of each sample to form an incremental sequence of user basic information features for each sample; Determine the preset execution cycle of the inspection plan, and resample all feature increment sequences according to the preset execution cycle of the inspection plan, so that the increment values of each electricity consumption feature fall on a unified time axis, so as to merge them into a dynamic feature matrix.
[0008] The specific steps for extracting load fluctuation features include: Using hours as the sampling unit, calculate the time for each user at the sampling time. t Load change rate ;in, For a moment t The rate of change of load; For a moment t The active power, Δt is the sampling interval; Get each user at the same time t Historical baseline load value The load change rate Compared with historical baseline load values By subtracting the values, we obtain the bias sequence. ;in, For a moment t deviation sequence; For the deviation sequence The daily volatility index is obtained by calculating the moving standard deviation with daily and weekly periods respectively. and weekly volatility indicators And further calculate the morphological discrimination coefficient. ;in, λ is the pattern discrimination coefficient, used to reflect the strength of short-term fluctuations relative to long-term fluctuations. The larger λ is, the more dominant the intraday fluctuations are, and the smaller λ is, the more dominant the weekly trend is. The morphological discrimination coefficient λ is compared with the preset three-level threshold range. The comparisons were made separately, corresponding to three morphological categories: stationary, fluctuating, and abrupt change; where α=0.6 and β=1.4. Assemble a sequence of morphological labels from m consecutive time windows, and count the values starting from the first time window. i Class to the j Class transfer frequency After normalization, the transition probability matrix is obtained. The sum of the off-diagonal elements of each row in the matrix is taken as the load fluctuation characteristic; m is a positive integer greater than 1.
[0009] The steps for extracting measurement anomaly features specifically include: Four metrics are extracted for each user daily, including voltage phase loss duration, current imbalance, power factor deviation, and meter clock deviation. The four metrics for each user are cumulatively calculated daily to form four daily time series for each user. Where N is the total number of days in the statistics; For each sequence, the daily difference between the same period and the previous year is calculated. Difference between time periods and the same period The sign of the year-on-year daily difference and the sign of the month-on-month time difference for each sequence are converted into binary bits; if a difference Δ>0, the sign bit is set to 1; if a difference Δ<=0, the sign bit is set to 0. The abnormal pattern code is obtained by concatenating the year-on-year and month-on-month sign bits of the four indicators in sequence into an 8-bit binary code. ; Encode the exception pattern The system performs Hamming distance matching with a preset standard anomaly pattern library, and selects the one with the smallest distance as the current anomaly type; wherein, the standard anomaly pattern library includes a first anomaly type corresponding to the voltage phase loss duration. The second type of abnormality corresponding to current imbalance The third type of anomaly corresponding to a low power factor The fourth type of anomaly corresponding to clock misalignment ; Finally, the percentage of the cumulative number of days users fell into various abnormal categories within each time window was calculated. and the cumulative number of days as a percentage Arranged in window order as an anomaly type percentage sequence, and further output as a quantitative anomaly feature; among which, The window is determined to be the first j The number of days with abnormal behavior.
[0010] Specifically, step S3 includes: The key parameters of the inspection plan are identified as hyperparameters to be optimized, including the inspection frequency for each user, the combination of inspection item types, and the inspection time window. Based on the hyperparameters to be optimized, a multidimensional hyperparameter space Θ is constructed, and each candidate plan corresponds to a point in the multidimensional hyperparameter space Θ. Based on the dynamic feature matrix, the multidimensional hyperparameter space Θ is hierarchically divided into a tree structure, so that each node of the tree structure corresponds to an electricity consumption feature. First, using the user basic information features as the root node splitting criterion, all users are divided into first-level groups according to industry category and capacity range to ensure that users in the same group have similar electricity consumption patterns. Second, within each first-level group, the time mean of the load fluctuation pattern discrimination coefficient and the entropy value of the metering anomaly type proportion sequence are used as second-level splitting features. All candidate splitting thresholds are traversed, and the variance weighted sum of the performance indicators within the left and right subgroups after splitting is calculated as an impurity measure. The threshold that maximizes the reduction in impurity is selected for recursive bisection to form second-level subgroups. Then, within the second-level subgroups, using the default history features as the tertiary splitting criterion, the same recursive bisection strategy is used to further split the second-level subgroups into tertiary leaf nodes, so that each leaf node corresponds to a set of users with highly consistent electricity consumption feature patterns. Independent kernel density estimation functions are bound to each node at each level, so that each kernel density estimation function only uses sample data from the user set under the jurisdiction of that node for estimation; wherein, the kernel density estimation function is... θ represents the inspection plan parameters in the samples under the jurisdiction of a certain level node, and its corresponding actual performance indicator is y; n represents the total number of samples under the jurisdiction of a certain level node. For the first i The planned parameter vector for each sample; K() is the standard Gaussian kernel function; h is the kernel bandwidth of a certain level node, which is the average of the pairwise Euclidean distances between all samples within that node multiplied by a preset scaling factor c=0.9; When a given inspection plan falls into a third-level leaf node based on its corresponding user characteristics, the local probability density of that third-level leaf node is obtained. Starting from the third-level leaf node, the algorithm recursively ascends level by level to obtain the kernel density of the second-level parent node, the first-level parent node, and the root node of the third-level leaf node, denoted as follows: ; Based on the preset inter-layer weighting coefficients, the kernel densities of the second-level parent node, the first-level parent node, and the root node of the third-level leaf node are weighted and multiplied to obtain the prior probability density. Further, the prior probability density The local probability density of the third-level leaf node Perform Bayesian product fusion to obtain the final conditional probability density. And output as a global probabilistic proxy model; wherein, the inter-layer weight coefficients include the weight of the root node. =0.2, the weight of the first-level parent node =0.3, the weight of the second-level parent node =0.5, the weight of the third-level leaf node is 1.
[0011] The specific steps of step S4 include: At the start of each iteration, the parameters are generated from the multidimensional hyperparameter space Θ using uniform random sampling or Latin hypercube sampling. One candidate plan; Through formula The expected improvement value of the candidate plan θ is calculated. ;in, The expected improvement value of candidate program θ Correct the previous initial values, and ; To calculate the expected outcome probability density corresponding to the candidate plan scheme θ based on the global probability proxy model; y is the expected outcome value of the candidate plan scheme θ; The current set of effective samples The maximum value; η is the penalty coefficient, η=0.1; The preset distance threshold; It is a distance penalty term, and , is used to represent the minimum Euclidean distance between the candidate plan θ and the parameter vectors of all executed plans; Expected improvement from all candidate plans The candidate plan with the largest expected improvement is selected as the current optimal candidate plan. ; The current optimal candidate plan scheme is to be determined. After on-site deployment and implementation, the actual effectiveness vector is collected. ; where the actual effectiveness vector The comprehensive weighted score includes three indicators: the peak-to-valley difference correction of the load curve after inspection, the metering error correction, and the amount of electricity to be compensated for violations. The current optimal candidate plan Its corresponding actual effectiveness vector Association is an incremental sample pair Based on the user characteristics of the incremental sample pair, the third-level leaf node to which it belongs is determined, and the incremental sample pair is further added to the local sample set of the third-level leaf node to which it belongs. The kernel density bandwidth of the third-level leaf nodes with added incremental sample pairs is recalculated, and a sliding window strategy is adopted to determine when the total number of local samples exceeds the preset window capacity. At that time, the oldest samples are removed in the order of their inclusion time to ensure that the model adapts to recent changes in electricity consumption behavior; After updating the third-level leaf nodes with added incremental sample pairs, the kernel density of the corresponding second-level parent node, first-level parent node and root node is recalculated layer by layer from bottom to top along the tree structure. This is equivalent to propagating the incremental information of the third-level leaf nodes to the root node through the tree conditional dependency relationship. After each iteration, check the optimal candidate plans from the three consecutive iterations. Are the pairwise Euclidean distances between them all less than a preset distance threshold? And calculate the expected improvement value of the optimal candidate plan in these three rounds. relative rate of change ;in, This is the optimal candidate plan obtained from the previous iteration in the current iteration; This is the optimal candidate plan obtained from the previous iteration over the current iteration; If the relative rate of change for these three consecutive rounds is determined All are less than the rate of change threshold δ=0.01, and simultaneously satisfy the optimal candidate plan scheme for these three consecutive rounds. The pairwise Euclidean distances between them are all less than the preset distance threshold. If convergence is achieved, the iteration is terminated; otherwise, the next iteration continues. The method further includes: The initial set of schemes is sorted and allocated using a user priority scoring and regional grouping round-robin allocation strategy to generate an executable plan set which is then sent to the field operation terminal.
[0012] The specific steps for sorting and allocating the initial set of solutions using a user priority scoring and regional grouping round-robin allocation strategy include: Get priority scores for all users And score them according to priority. Sort all users in descending order to form a priority queue Q; where, For users i Capacity level value; For users i Number of historical defaults; For users i Importance of the load; These are the weight coefficients of the three preset factors, all of which are fixed values less than 1; Obtain the power supply area code for each user, take the first-level area code as the grouping basis, and assign all users to the corresponding area group. Furthermore, within each regional group, users are reordered according to their priority queue Q, ensuring that higher-ranked users within the same region are placed at the front, thus forming an ordered user sequence for each regional group. ; Calculate the total priority score for each region group. , and according to The entire region group is globally sorted from highest to lowest to obtain the group execution sequence; among which...
[0013] Suppose there are T time windows for the inspection dates, starting sequentially from the highest-ranked regional group, and then from the ordered sequence of that group. Users are retrieved one by one and assigned to the currently available time windows in a round-robin fashion, while satisfying the following constraints: If a user has already been assigned to a window, the remaining users in the same area should be assigned to other windows as much as possible. By maintaining the area code set for each window, when adding a new user, the window whose area code set does not yet contain the user's area code is selected first; if all windows contain the area code set, the window with the fewest users is selected. Iterate through all area groups until all users have been assigned, and finally generate a set of executable plans containing specific inspection dates, inspection personnel groups, and inspection item lists, and distribute them to the field operation terminals.
[0014] This invention also provides a power consumption inspection plan optimization and generation system based on a tree-structured Parzen estimator, comprising: The sample acquisition unit is used to collect electricity user electricity consumption records. After cleaning and normalizing the relevant electricity consumption data in the electricity consumption records, it divides the data into multiple samples according to a predetermined time window. Furthermore, each sample is labeled with key parameters and performance indicators of the inspection plan actually implemented during the corresponding period. The electricity consumption records include basic user information, historical electricity load curves, metering device operation records, and past violations of electricity consumption regulations. Both the historical electricity load curves and the metering device operation records carry relevant electricity consumption data. The electricity consumption feature extraction unit is used to extract the electricity consumption features of each sample, and uses a time sliding window to statistically analyze the evolution trend of the same electricity consumption feature in a continuous period, and quantifies the evolution trend into a feature increment sequence, which is further aligned with the execution cycle preset by the inspection plan to form a dynamic feature matrix; wherein, the electricity consumption features of each sample include user basic information features, load fluctuation features, metering anomaly features, and default history features. A global probability model unit is constructed to construct a multidimensional hyperparameter space by taking the key parameters of the inspection plan as the hyperparameters to be optimized. Based on the dynamic feature matrix, the multidimensional hyperparameter space is divided into a tree structure hierarchy, so that each node of the tree structure corresponds to an electricity consumption feature. An independent kernel density estimation function is established on each node to fit the kernel density distribution of the plan under the condition of that node. Furthermore, based on the dependency relationship of the transmission of probability density information between the upper and lower level nodes of the tree structure, a global probability proxy model is constructed. The global probability model unit is iteratively updated to perform iterative calculations on the multidimensional hyperparameter space using an optimization algorithm until the convergence condition is met. In each iteration, multiple candidate plans are sampled from the multidimensional hyperparameter space, and the expected improvement value of each candidate plan is calculated according to the global probability proxy model. The candidate plan with the largest expected improvement value in each iteration is taken as the optimal candidate plan. After the optimal candidate plan is deployed and executed in the field, the corresponding actual performance data is collected, and the actual performance data collected in each iteration is incrementally updated to the global probability proxy model to correct the kernel density of each level of nodes. The optimization scheme output unit is used to parse the hyperparameters in the final optimal candidate scheme into executable scheme entries after the iterative calculation of the multidimensional hyperparameter space to be determined has terminated, and to summarize them according to the user's basic information to form an initial scheme set for output.
[0015] Implementing the embodiments of the present invention has the following beneficial effects: 1. This invention breaks through the limitations of traditional static scheduling by extracting user basic information features, user load fluctuation features, metering anomaly features and default history features, thus significantly improving the accuracy of inspection target selection and solving the problem of single data features in existing electricity inspection plan generation methods. 2. This invention divides the multidimensional hyperparameter space into hierarchical tree structures and combines multi-node independent kernel density estimation and inter-layer probability density transfer to build a high-precision global probability proxy model. It accurately fits the distribution of inspection plan effectiveness, effectively avoids high-frequency low-risk repeated inspections and high-risk user omissions, thereby solving the problems of low-risk repeated inspections and high-risk user omissions in existing electricity inspection plan generation methods. 3. This invention introduces a method for calculating the expected improvement value with distance penalty during the iterative calculation process, which takes into account both the optimization of the scheme and the diversity of parameter exploration. It also relies on an incremental sample update mechanism to continuously correct the probability model, resulting in high iterative optimization accuracy and strong convergence stability. This allows for adaptive correction of the model and precise improvement of the effectiveness of electricity inspection and the accuracy of anomaly detection. 4. This invention uses a user priority scoring and regional grouping round-robin allocation strategy to ensure that high-risk users are inspected first, while balancing the inspection workload of each region. This avoids excessive concentration of inspection resources in the same time window, improves the practicality of the solution, and can take into account both user priority and regional balance. It achieves intelligent, refined, and efficient generation of electricity inspection plans, thereby solving the problem of poor user risk priority and regional balance in existing electricity inspection plan generation methods. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, obtaining other drawings based on these drawings without creative effort still falls within the scope of the present invention.
[0017] Figure 1 A flowchart illustrating a method for optimizing and generating electricity inspection plans based on a tree-structured Parzen estimator, provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of a power consumption inspection plan optimization generation system based on a tree-structured Parzen estimator, provided as an embodiment of the present invention. Detailed Implementation
[0018] 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 accompanying drawings.
[0019] like Figure 1 As shown in the figure, an embodiment of the present invention proposes a method for optimizing and generating electricity inspection plans based on a tree-structured Parzen estimator. The method includes the following steps: Step S1: Collect electricity consumption records from users. After cleaning and normalizing the relevant electricity consumption data in the electricity consumption records, divide the data into multiple samples according to a predetermined time window. Furthermore, each sample is labeled with key parameters and performance indicators of the inspection plan actually implemented during the corresponding period. The electricity consumption records include basic user information, historical electricity load curves, metering device operation records, and past violations of electricity consumption regulations. Both the historical electricity load curves and the metering device operation records carry relevant electricity consumption data. The specific process is as follows: First, collect electricity user electricity consumption records. These records include basic user information, historical electricity load curves, metering device operation records, and past violations of electricity consumption regulations. Basic user information includes, but is not limited to, industry category, electricity capacity, and power supply area. Industry category refers to the user's business classification. Electricity capacity refers to the transformer capacity or maximum demand stipulated in the contract. Power supply area refers to the area code. Historical load curves are active load time series sampled hourly / daily. Metering operation records include, but are not limited to, voltage phase loss duration, current imbalance, power factor, and meter clock deviation. Past violations of electricity consumption regulations include, but are not limited to, the number of violations, the type of violation, and the time of violation.
[0020] The second step involves cleaning the relevant electricity consumption data in the electricity bill archive. This includes removing abnormal records with negative loads or voltage deviations exceeding ±20%; and filling missing values using linear interpolation between adjacent time points. If more than three consecutive sampling points are missing, the average value at the same time on the two nearest days is used as the replacement. It should be noted that the data cleaning is implemented using conventional techniques in this field, which will not be elaborated upon here.
[0021] The third step is to normalize the relevant electricity consumption data in the electricity consumption account file. This includes applying min-max normalization to all continuous features to make them fall within the [0,1] interval; and converting categorical features into one-hot encoding. It should be noted that the data normalization process is implemented using conventional techniques in this field, and will not be elaborated upon here.
[0022] Step 4: Using the natural week as the basic unit, calculate the weekly average active load, voltage phase loss duration, current imbalance, power factor, meter clock deviation, number of defaults, default type, and default time. Align this with the user's basic information to form weekly records. Furthermore, use a first-time sliding window with a width of L weeks to overlay L consecutive weekly records into a single sample, resulting in multiple samples; where L is a positive integer greater than 1. It should be noted that relevant categorical features such as user basic information are processed by converting them into numerical vectors using one-hot encoding. In one example, let the record for week t be... Then the kth sample is denoted as
[0023] Step 5: For each sample, label the key parameters of the inspection plan actually implemented in the week following the end of the first time window, as well as the post-implementation performance indicators, to obtain multiple labeled samples, thus forming a structured sample set. .
[0024] Step S2: Extract the electricity consumption characteristics of each sample, and use a time sliding window to statistically analyze the evolution trend of the same electricity consumption characteristic in a continuous period. Quantify the evolution trend into a feature increment sequence, and further align it with the execution cycle preset in the inspection plan to form a dynamic feature matrix. The electricity consumption characteristics of each sample include user basic information characteristics, load fluctuation characteristics, metering anomaly characteristics, and default history characteristics. The specific process is as follows: First, extract the electricity consumption characteristics of each sample; among which, the electricity consumption characteristics of each sample include user basic information characteristics, load fluctuation characteristics, metering anomaly characteristics, and default history characteristics.
[0025] At this point, the specific steps for extracting load fluctuation characteristics based on historical electricity load curves include: Using hours as the sampling unit, calculate the time for each user at the sampling time. t Load change rate ;in, For a moment t The rate of change of load; For a moment t The active power, Δt is the sampling interval; Get each user at the same time t Historical baseline load value The load change rate Compared with historical baseline load values By subtracting the values, we obtain the bias sequence. ;in, For a moment t deviation sequence; For the deviation sequence The daily volatility index is obtained by calculating the moving standard deviation with daily and weekly periods respectively. and weekly volatility indicators And further calculate the morphological discrimination coefficient. ;in, λ is the pattern discrimination coefficient, used to reflect the strength of short-term fluctuations relative to long-term fluctuations. The larger λ is, the more dominant the intraday fluctuations are, and the smaller λ is, the more dominant the weekly trend is. The morphological discrimination coefficient λ is compared with the preset three-level threshold range. The comparisons were made separately, corresponding to three morphological categories: stationary, fluctuating, and abrupt change; where α=0.6 and β=1.4. Assemble a sequence of morphological labels from m consecutive time windows, and count the values starting from the first time window. i Class to the j Class transfer frequency After normalization, the transition probability matrix is obtained. The sum of the off-diagonal elements of each row in the matrix is taken as the load fluctuation feature, which is used to characterize the degree of instability of the user's fluctuation pattern; m is a positive integer greater than 1.
[0026] At this point, the steps for extracting measurement anomaly features based on the metering device's operation records specifically include: Four metrics are extracted for each user daily, including voltage phase loss duration, current imbalance, power factor deviation, and meter clock deviation. The four metrics for each user are cumulatively calculated daily to form four daily time series for each user. Where N is the total number of days in the statistics; For each sequence, the daily difference between the same period and the previous year is calculated. Difference between time periods and the same period The sign of the year-on-year daily difference and the sign of the month-on-month time difference for each sequence are converted into binary bits; if a difference Δ>0, the sign bit is set to 1; if a difference Δ<=0, the sign bit is set to 0. The abnormal pattern code is obtained by concatenating the year-on-year and month-on-month sign bits of the four indicators in sequence into an 8-bit binary code. ; Encode the exception pattern The system performs Hamming distance matching with a preset standard anomaly pattern library, and selects the one with the smallest distance as the current anomaly type; the standard anomaly pattern library includes the first anomaly type corresponding to the voltage phase loss duration. The second type of abnormality corresponding to current imbalance The third type of anomaly corresponding to a low power factor The fourth type of anomaly corresponding to clock misalignment ; Finally, the percentage of the cumulative number of days users fell into various abnormal categories within each time window was calculated. and the cumulative number of days as a percentage Arranged in window order as an anomaly type percentage sequence, and further output as a quantitative anomaly feature; among which, The window is determined to be the first j The number of days with abnormal behavior.
[0027] The second step involves using a second time window with a width of W weeks to calculate the mean and change of the load fluctuation characteristics (measurement anomaly characteristics and default history characteristics) of each sample within a continuous period, based on the load fluctuation characteristics (measurement anomaly characteristics and default history characteristics) of each sample. After taking the feature difference between the last period and the first period within each second time window as the feature increment, the feature increment value of the load fluctuation characteristics (measurement anomaly characteristics and default history characteristics) of each sample is aligned with the center time of the second time window to form the increment sequence of the load fluctuation characteristics (measurement anomaly characteristics and default history characteristics) of each sample. Here, W is 1 / n times L; W and n are both positive integers greater than 1.
[0028] It is understandable that the same method is used to obtain the corresponding incremental sequences for the three electricity consumption characteristics: load fluctuation characteristics, metering anomaly characteristics, and default history characteristics.
[0029] The third step involves using the width of the second time sliding window to perform static feature expansion on the user basic information features of each sample, in order to form an incremental sequence of user basic information features for each sample. The fourth step is to determine the execution cycle preset in the inspection plan and resample all feature increment sequences according to the execution cycle preset in the inspection plan, so that the increment values of each electricity consumption feature fall on a unified time axis, so as to merge them into a dynamic feature matrix for use as input to the subsequent tree model.
[0030] Step S3: Using the key parameters of the inspection plan as the hyperparameters to be optimized, a multidimensional hyperparameter space is constructed. Based on the dynamic feature matrix, the multidimensional hyperparameter space is divided into a tree structure hierarchy, so that each node of the tree structure corresponds to an electricity consumption feature. An independent kernel density estimation function is established on each node to fit the kernel density distribution of the plan under the condition of that node. Furthermore, based on the dependency relationship of the transmission of probability density information between the upper and lower level nodes of the tree structure, a global probability proxy model is constructed. The specific process is as follows: First, determine the key parameters of the inspection plan as hyperparameters to be optimized, including the inspection frequency for each user, the combination of inspection item types, and the inspection time window.
[0031] The second step is to construct a multidimensional hyperparameter space Θ based on the hyperparameters to be optimized, and make each candidate plan scheme correspond to a point in the multidimensional hyperparameter space Θ.
[0032] The third step involves dividing the multidimensional hyperparameter space Θ into a tree structure based on the dynamic feature matrix, ensuring that each node in the tree structure corresponds to a specific electricity consumption feature. First, using user basic information features as the root node for splitting, all users are grouped into first-level groups based on industry category and capacity range to ensure similarity in electricity consumption patterns within the same group. Second, within each first-level group, the time mean of the load fluctuation pattern discrimination coefficient and the entropy value of the metering anomaly type proportion sequence are used as second-level splitting features. All candidate splitting thresholds are iterated, and the variance weighted sum of the performance indicators within the left and right subgroups after splitting is calculated as an impurity measure. The threshold that maximizes the reduction in impurity is selected for recursive bisection to form second-level subgroups. Then, within each second-level subgroup, the default history features are used as the tertiary splitting basis, employing the same recursive bisection strategy to further split the second-level subgroups into tertiary leaf nodes, ensuring that each leaf node corresponds to a set of users with highly consistent electricity consumption feature patterns.
[0033] Step 4: Bind independent kernel density estimation functions to each node, so that each kernel density estimation function only uses sample data from the user set under the jurisdiction of that node for estimation; wherein, the kernel density estimation function is... θ represents the inspection plan parameters in the samples under the jurisdiction of a certain level node, and its corresponding actual performance indicator is y; n represents the total number of samples under the jurisdiction of a certain level node. For the first i The planned parameter vector for each sample; K() is the standard Gaussian kernel function; h is the kernel bandwidth of a certain level node, which is the average of the pairwise Euclidean distances between all samples within that node multiplied by a preset scaling factor c=0.9.
[0034] Step 5: When a test plan to be evaluated falls into a third-level leaf node based on its corresponding user characteristics, obtain the local probability density of that third-level leaf node. Starting from the third-level leaf node, the algorithm recursively ascends level by level to obtain the kernel density of the second-level parent node, the first-level parent node, and the root node of the third-level leaf node, denoted as follows: At this point, the weighted multiplication of the kernel density indices in the formula is equivalent to the joint consideration of prior information of each layer under a tree-like conditional dependency structure.
[0035] Step 6: According to the preset inter-layer weighting coefficients, perform a weighted product of the kernel densities of the second-level parent node, the first-level parent node, and the root node of the third-level leaf node to obtain the prior probability density. Further, the prior probability density The local probability density of the third-level leaf node Perform Bayesian product fusion to obtain the final conditional probability density. This is output as a global probabilistic surrogate model; where the inter-layer weight coefficients include the weight of the root node. =0.2, the weight of the first-level parent node =0.3, the weight of the second-level parent node =0.5, the weight of the third-level leaf node is 1.
[0036] It should be noted that the final conditional probability density function reflects both the global hierarchical structure and the local sample distribution information, and is used in the subsequent calculation of the desired improved acquisition function. Step S4: Iteratively calculate the multidimensional hyperparameter space using an optimization algorithm until the convergence condition is met. In each iteration, multiple candidate plans are generated by sampling from the multidimensional hyperparameter space. Based on the global probabilistic proxy model, the expected improvement value of each candidate plan in each iteration is calculated. The candidate plan with the largest expected improvement value in each iteration is selected as the optimal candidate plan. After the optimal candidate plan selected in each iteration is deployed and executed on-site, the corresponding actual performance data is collected. The actual performance data collected in each iteration is incrementally updated to the global probabilistic proxy model to correct the kernel density of each level of node. The specific process involves iteratively calculating the multidimensional hyperparameter space using optimization algorithms such as particle swarm optimization and gray wolf optimization until the convergence condition is met.
[0037] At the beginning of each iteration, firstly, samples are generated from the multidimensional hyperparameter space Θ using uniform random sampling or Latin hypercube sampling. One candidate program.
[0038] Secondly, through the formula The expected improvement value of the candidate plan θ is calculated. ;in, The expected improvement value of candidate program θ Correct the previous initial values, and ; To calculate the expected outcome probability density of candidate plan θ based on the global probabilistic proxy model; y is the expected outcome value of candidate plan θ; The current set of effective samples The maximum value; η is the penalty coefficient, η=0.1; The preset distance threshold; It is a distance penalty term, and , is used to represent the minimum Euclidean distance between the candidate plan θ and the parameter vectors of all executed plans; it should be noted that the greater the distance between the candidate plan θ and the executed plans, the greater the penalty, thereby encouraging the model to explore the insufficiently covered areas in the parameter space.
[0039] Next, the expected improvement values from all candidate plans... The candidate plan with the largest expected improvement is selected as the current optimal candidate plan. .
[0040] Next, the current optimal candidate plan will be determined. After on-site deployment and implementation, the actual effectiveness vector is collected. Among them, the actual effectiveness vector The comprehensive weighted score includes three indicators: the peak-to-valley difference correction of the load curve after inspection, the metering error correction, and the amount of electricity to be compensated for violations.
[0041] Next, the current optimal candidate plan scheme will be... Its corresponding actual effectiveness vector Association is an incremental sample pair Based on the user characteristics of the incremental sample pair, the third-level leaf node to which it belongs is determined, and the incremental sample pair is further added to the local sample set of the third-level leaf node to which it belongs. Next, the kernel density bandwidth of the third-level leaf nodes with added incremental sample pairs is recalculated, and a sliding window strategy is adopted to determine when the total number of local samples exceeds the preset window capacity. At that time, the oldest samples are removed in the order of their inclusion time to ensure that the model adapts to recent changes in electricity consumption behavior.
[0042] Then, after updating the third-level leaf nodes with added incremental sample pairs, the kernel density of the corresponding second-level parent nodes, first-level parent nodes, and root nodes is recalculated layer by layer from bottom to top along the tree structure. This is equivalent to propagating the incremental information of the third-level leaf nodes to the root node level by level through the tree-like conditional dependencies.
[0043] Finally, after each iteration, the optimal candidate plans from the three consecutive iterations are checked. Are the pairwise Euclidean distances between them all less than a preset distance threshold? And calculate the expected improvement value of the optimal candidate plan in these three rounds. relative rate of change ;in, This is the optimal candidate plan obtained from the previous iteration in the current iteration; This is the optimal candidate plan obtained from the previous iteration over the current iteration; If the relative rate of change for these three consecutive rounds is determined All are less than the rate of change threshold δ=0.01, and simultaneously satisfy the optimal candidate plan scheme for these three consecutive rounds. The pairwise Euclidean distances between them are all less than the preset distance threshold. If convergence is achieved, the iteration is terminated; otherwise, the next iteration continues.
[0044] It should be noted that the relative rate of change It can be done through formula Calculations show that if the current iteration is the first iteration, the expected improvement value of the previous iteration is defaulted to 0; where, To prevent small quantities with a denominator of zero.
[0045] Step S5: After the iterative calculation of the multidimensional hyperparameter space is determined to be terminated, the hyperparameters in the final optimal candidate plan scheme are parsed into executable plan entries, and the initial scheme set is output by summarizing them according to the user's basic information.
[0046] The specific process is as follows: after the iteration terminates, the hyperparameters in the final optimal candidate plan are parsed into executable plan entries, and the initial plan set is formed by summarizing them according to user ID.
[0047] In this embodiment of the invention, to facilitate on-site scheduling of the scheme, it is necessary to further sort and allocate according to user priority and power supply area to ensure that high-priority users are arranged first and that areas are dispersed within the same time window to avoid concentrated work pressure. Therefore, the method further includes: sorting and allocating the initial scheme set through user priority scoring and area grouping round-robin allocation strategy to generate an executable plan scheme set and send it to the on-site operation terminal.
[0048] At this point, the specific steps include: First, obtaining the priority scores for all users. And score them according to priority. Sort all users in descending order to form a priority queue Q; where, For users i Capacity level value; For users i Number of historical defaults; The importance of user i's load; These are the weighting coefficients for three preset factors, all of which are fixed values less than 1. In one example, α=0.3, β=0.4, and γ=0.3. The weighting values are preset based on the actual business importance, reflecting that users with large capacity, frequent defaults, and heavy loads should be checked first.
[0049] Secondly, obtain the power supply area code for each user, take the first-level area code as the grouping basis, and assign all users to the corresponding area group. Furthermore, within each regional group, users are reordered according to their priority queue Q, ensuring that higher-ranked users within the same region are placed at the front, thus forming an ordered user sequence for each regional group. .
[0050] Next, calculate the total priority score for each region group. , and according to The entire region group is globally sorted from highest to lowest to obtain the group execution sequence; among which...
[0051] Then, assuming there are T time windows for the inspection dates, we will start sequentially from the highest-ranked region group, and proceed from the ordered sequence of that group. Users are retrieved one by one and assigned to the currently available time windows in a round-robin fashion, while satisfying the following constraints: If a user has already been assigned to a window, the remaining users in the same area should be assigned to other windows as much as possible. By maintaining the area code set for each window, when adding a new user, the window whose area code set does not yet contain the user's area code is selected first; if all windows contain the area code set, the window with the fewest users is selected. Finally, all area groups are iterated until all users are assigned, and an executable plan set containing specific inspection dates, inspection personnel groups, and inspection item lists is generated and distributed to the field operation terminals.
[0052] like Figure 2 As shown in the figure, an embodiment of the present invention provides a power consumption inspection plan optimization generation system based on a tree-structured Parzen estimator, comprising: The sample acquisition unit 110 is used to collect electricity user electricity consumption records. After cleaning and normalizing the relevant electricity consumption data in the electricity consumption records, it divides the data into multiple samples according to a predetermined time window. Furthermore, each sample is labeled with the key parameters and performance indicators of the inspection plan actually implemented in the corresponding period. The electricity consumption records include basic user information, historical electricity load curves, metering device operation records, and past violations of electricity consumption investigations. The historical electricity load curves and the metering device operation records both carry relevant electricity consumption data. The electricity consumption feature extraction unit 120 is used to extract the electricity consumption features of each sample, and uses a time sliding window to statistically analyze the evolution trend of the same electricity consumption feature in a continuous period, and quantifies the evolution trend into a feature increment sequence, which is further aligned with the execution cycle preset by the inspection plan to form a dynamic feature matrix; wherein, the electricity consumption features of each sample include user basic information features, load fluctuation features, metering anomaly features and default history features; A global probability model unit 130 is constructed to construct a multidimensional hyperparameter space by taking the key parameters of the inspection plan as the hyperparameters to be optimized. Based on the dynamic feature matrix, the multidimensional hyperparameter space is divided into a tree structure hierarchy, so that each node of the tree structure corresponds to an electricity consumption feature. An independent kernel density estimation function is established on each node to fit the kernel density distribution of the plan under the condition of that node. Furthermore, based on the dependency relationship of the transmission of probability density information between the upper and lower level nodes of the tree structure, a global probability proxy model is constructed. The global probability model unit 140 is iteratively updated to perform iterative calculations on the multidimensional hyperparameter space using an optimization algorithm until the convergence condition is met. In each iteration, multiple candidate plans are sampled from the multidimensional hyperparameter space, and the expected improvement value of each candidate plan is calculated according to the global probability proxy model. The candidate plan with the largest expected improvement value in each iteration is taken as the optimal candidate plan. After the optimal candidate plan is deployed and executed in the field, the corresponding actual performance data is collected, and the actual performance data collected in each iteration is incrementally updated to the global probability proxy model to correct the kernel density of each level of node. The optimization scheme output unit 150 is used to parse the hyperparameters in the final optimal candidate scheme into executable scheme entries after the iterative calculation of the multidimensional hyperparameter space to be determined has terminated, and to summarize them according to the user's basic information to form an initial scheme set for output.
[0053] Implementing the embodiments of the present invention has the following beneficial effects: 1. This invention breaks through the limitations of traditional static scheduling by extracting user basic information features, user load fluctuation features, metering anomaly features and default history features, thus significantly improving the accuracy of inspection target selection and solving the problem of single data features in existing electricity inspection plan generation methods. 2. This invention divides the multidimensional hyperparameter space into hierarchical tree structures and combines multi-node independent kernel density estimation and inter-layer probability density transfer to build a high-precision global probability proxy model. It accurately fits the distribution of inspection plan effectiveness, effectively avoids high-frequency low-risk repeated inspections and high-risk user omissions, thereby solving the problems of low-risk repeated inspections and high-risk user omissions in existing electricity inspection plan generation methods. 3. This invention introduces a method for calculating the expected improvement value with distance penalty during the iterative calculation process, which takes into account both the optimization of the scheme and the diversity of parameter exploration. It also relies on an incremental sample update mechanism to continuously correct the probability model, resulting in high iterative optimization accuracy and strong convergence stability. This allows for adaptive correction of the model and precise improvement of the effectiveness of electricity inspection and the accuracy of anomaly detection. 4. This invention uses a user priority scoring and regional grouping round-robin allocation strategy to ensure that high-risk users are inspected first, while balancing the inspection workload of each region. This avoids excessive concentration of inspection resources in the same time window, improves the practicality of the solution, and can take into account both user priority and regional balance. It achieves intelligent, refined, and efficient generation of electricity inspection plans, thereby solving the problem of poor user risk priority and regional balance in existing electricity inspection plan generation methods.
[0054] It is worth noting that the various system modules included in the above system embodiments are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional module are only for easy differentiation and are not used to limit the scope of protection of the present invention.
[0055] Those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as ROM / RAM, disk, optical disk, etc.
[0056] The above description discloses only preferred embodiments of the present invention and should not be construed as limiting the scope of the present invention. Therefore, equivalent variations made in accordance with the claims of the present invention are still within the scope of the present invention.
Claims
1. A method for optimizing and generating electricity consumption inspection plans based on a tree-structured Parzen estimator, characterized in that, The method includes the following steps: S1. Collect electricity consumption records from users, and after cleaning and normalizing the relevant electricity consumption data in the electricity consumption records, divide them into multiple samples according to a predetermined time window. Furthermore, each sample is labeled with key parameters and performance indicators of the inspection plan actually implemented during the corresponding period. The electricity consumption records include basic user information, historical electricity load curves, metering device operation records, and past violations of electricity consumption regulations. The historical electricity load curves and the metering device operation records both carry relevant electricity consumption data. S2. Extract the electricity consumption characteristics of each sample, and use a time sliding window to statistically analyze the evolution trend of the same electricity consumption characteristic in a continuous period. Quantify the evolution trend into a feature increment sequence, and further align it with the execution cycle preset by the inspection plan to form a dynamic feature matrix. The electricity consumption characteristics of each sample include user basic information characteristics, load fluctuation characteristics, metering anomaly characteristics, and default history characteristics. S3. Using the key parameters of the inspection plan as the hyperparameters to be optimized, a multidimensional hyperparameter space is constructed. Based on the dynamic feature matrix, the multidimensional hyperparameter space is divided into a tree structure hierarchy, so that each node of the tree structure corresponds to an electricity consumption feature. An independent kernel density estimation function is established on each node to fit the kernel density distribution of the plan under the condition of that node. Furthermore, based on the dependency relationship of the transmission of probability density information between the upper and lower level nodes of the tree structure, a global probability proxy model is constructed. S4. An optimization algorithm is used to iteratively calculate the multidimensional hyperparameter space until the convergence condition is met. In each iteration, multiple candidate plans are generated by sampling from the multidimensional hyperparameter space. Based on the global probabilistic proxy model, the expected improvement value of each candidate plan in each iteration is calculated. The candidate plan with the largest expected improvement value in each iteration is taken as the optimal candidate plan. After the optimal candidate plan selected in each iteration is deployed and executed on site, the corresponding actual performance data is collected. The actual performance data collected in each iteration is incrementally updated to the global probabilistic proxy model to correct the kernel density of each level of node. S5. After the iterative calculation of the multidimensional hyperparameter space is determined to be terminated, the hyperparameters in the final optimal candidate plan scheme are parsed into executable plan entries, and the initial scheme set is output by summarizing them according to the user's basic information.
2. The method for optimizing and generating electricity consumption inspection plans based on a tree-structured Parzen estimator as described in claim 1, characterized in that, Step S1 specifically includes: Collect electricity user electricity consumption records; wherein, the electricity consumption records include basic user information, historical electricity load curves, metering device operation records, and past violations of electricity consumption regulations; the basic user information includes industry category, electricity capacity, and power supply area; the industry category is the user's business classification; the electricity capacity is the transformer capacity or maximum demand stipulated in the contract; the power supply area is the area code; the historical load curve is an active load time series sampled hourly / daily; the metering operation records include voltage phase loss duration, current imbalance, power factor, and meter clock deviation; the past violations of electricity consumption regulations include the number of violations, the type of violation, and the time of violation; The relevant electricity consumption data in the electricity consumption account file is cleaned, including removing abnormal records with negative load or voltage deviation exceeding ±20%; and missing values are filled by linear interpolation between adjacent time points. If more than 3 consecutive sampling points are missing, the average value of the same time point of the two adjacent days is used to replace them. The electricity consumption data in the electricity consumption account file is normalized, including applying minimum-maximum normalization to all continuous features so that they fall into the [0,1] interval; and converting categorical features into one-hot encoding. Using the natural week as the basic unit, the average active load, voltage phase loss duration, current imbalance, power factor, meter clock deviation, number of defaults, default type, and default time are statistically analyzed for each week. These data are then aligned with the user's basic information to form weekly records. Furthermore, a first time sliding window with a width of L weeks is used to combine L consecutive weekly records into a single sample to obtain multiple samples; where L is a positive integer greater than 1. For each sample, the key parameters of the inspection plan actually implemented in the week following the end of the first time window and the post-implementation performance indicators are labeled as tags, resulting in multiple labeled samples.
3. The method for optimizing and generating electricity consumption inspection plans based on a tree-structured Parzen estimator as described in claim 2, characterized in that, Step S2 specifically includes: Extract the electricity consumption characteristics of each sample; wherein, the electricity consumption characteristics of each sample include user basic information characteristics, load fluctuation characteristics, metering anomaly characteristics, and default history characteristics; Based on the load fluctuation characteristics of each sample, a second time window with a width of W weeks is used to statistically analyze the mean and change of the load fluctuation characteristics of each sample within the continuous period. After taking the feature difference between the last period and the first period within each second time window as the feature increment, the feature increment value of the load fluctuation characteristics of each sample is aligned with the center time of the second time window to form the load fluctuation feature increment sequence of each sample; where W is 1 / n times L; and W and n are both positive integers greater than 1. Based on the measurement anomaly characteristics of each sample, the second time sliding window is used to statistically calculate the mean and change of the measurement anomaly characteristics in a continuous period. After taking the feature difference between the end period and the beginning period in each second time sliding window as the feature increment, the feature increment values of the measurement anomaly characteristics of each sample are aligned with the center time of the second time sliding window to form the measurement anomaly characteristic increment sequence of each sample. Based on the default history characteristics of each sample, the second time window is used to calculate the mean and change of the default history characteristics of each sample in the continuous period. After taking the feature difference between the end period and the beginning period in each second time window as the feature increment, the increment value of the default history characteristics of each sample is aligned with the center time of the second time window to form the default history characteristic increment sequence of each sample. Using the width of the second time sliding window, static feature expansion is performed on the user basic information features of each sample to form an incremental sequence of user basic information features for each sample; Determine the preset execution cycle of the inspection plan, and resample all feature increment sequences according to the preset execution cycle of the inspection plan, so that the increment values of each electricity consumption feature fall on a unified time axis, so as to merge them into a dynamic feature matrix.
4. The method for optimizing and generating electricity consumption inspection plans based on a tree-structured Parzen estimator as described in claim 3, characterized in that, The specific steps for extracting load fluctuation features include: Using hours as the sampling unit, calculate the time for each user at the sampling time. t Load change rate ;in, For a moment t The rate of change of load; For a moment t The active power, Δt is the sampling interval; Get each user at the same time t Historical baseline load value The load change rate Compared with historical baseline load values By subtracting, we obtain the bias sequence. ;in, For a moment t deviation sequence; For the deviation sequence The daily volatility index is obtained by calculating the moving standard deviation with daily and weekly periods respectively. and weekly volatility indicators And further calculate the morphological discrimination coefficient. ;in, λ is the pattern discrimination coefficient, used to reflect the strength of short-term fluctuations relative to long-term fluctuations. The larger λ is, the more dominant the intraday fluctuations are, and the smaller λ is, the more dominant the weekly trend is. The morphological discrimination coefficient λ is compared with the preset three-level threshold range. The comparisons were made separately, corresponding to three morphological categories: stationary, fluctuating, and abrupt change; where α=0.6 and β=1.
4. Assemble a sequence of morphological labels from m consecutive time windows, and count the values starting from the first time window. i Class to the j Class transfer frequency After normalization, the transition probability matrix is obtained. The sum of the off-diagonal elements of each row in the matrix is taken as the load fluctuation characteristic; m is a positive integer greater than 1.
5. The method for optimizing and generating electricity consumption inspection plans based on a tree-structured Parzen estimator as described in claim 4, characterized in that, The steps for extracting measurement anomaly features specifically include: Four metrics are extracted for each user daily, including voltage phase loss duration, current imbalance, power factor deviation, and meter clock deviation. The four metrics for each user are cumulatively calculated daily to form four daily time series for each user. Where N is the total number of days in the statistics; For each sequence, the daily difference between the same period and the previous year is calculated. Difference between time periods and the same period The sign of the year-on-year daily difference and the sign of the month-on-month time difference for each sequence are converted into binary bits; if a difference Δ>0, the sign bit is set to 1; if a difference Δ<=0, the sign bit is set to 0. The abnormal pattern code is obtained by concatenating the year-on-year and month-on-month sign bits of the four indicators in sequence into an 8-bit binary code. ; Encode the exception pattern The system performs Hamming distance matching with a preset standard anomaly pattern library, and selects the one with the smallest distance as the current anomaly type; wherein, the standard anomaly pattern library includes a first anomaly type corresponding to the voltage phase loss duration. The second type of abnormality corresponding to current imbalance The third type of anomaly corresponding to a low power factor The fourth type of anomaly corresponding to clock misalignment ; Finally, the percentage of the cumulative number of days users fell into various abnormal categories within each time window was calculated. and the cumulative number of days as a percentage Arranged in window order as an anomaly type percentage sequence, and further output as a quantitative anomaly feature; among which, The window is determined to be the first j The number of days with abnormal behavior.
6. The method for optimizing and generating electricity consumption inspection plans based on a tree-structured Parzen estimator as described in claim 5, characterized in that, Step S3 specifically includes: The key parameters of the inspection plan are identified as hyperparameters to be optimized, including the inspection frequency for each user, the combination of inspection item types, and the inspection time window. Based on the hyperparameters to be optimized, a multidimensional hyperparameter space Θ is constructed, and each candidate plan corresponds to a point in the multidimensional hyperparameter space Θ. Based on the dynamic feature matrix, the multidimensional hyperparameter space Θ is hierarchically divided into a tree structure, so that each node of the tree structure corresponds to an electricity consumption feature. First, using the user basic information features as the root node splitting criterion, all users are divided into first-level groups according to industry category and capacity range to ensure that users in the same group have similar electricity consumption patterns. Second, within each first-level group, the time mean of the load fluctuation pattern discrimination coefficient and the entropy value of the metering anomaly type proportion sequence are used as second-level splitting features. All candidate splitting thresholds are traversed, and the variance weighted sum of the performance indicators within the left and right subgroups after splitting is calculated as an impurity measure. The threshold that maximizes the reduction in impurity is selected for recursive bisection to form second-level subgroups. Then, within the second-level subgroups, using the default history features as the tertiary splitting criterion, the same recursive bisection strategy is used to further split the second-level subgroups into tertiary leaf nodes, so that each leaf node corresponds to a set of users with highly consistent electricity consumption feature patterns. Independent kernel density estimation functions are bound to each node at each level, so that each kernel density estimation function only uses sample data from the user set under the jurisdiction of that node for estimation; wherein, the kernel density estimation function is... θ represents the inspection plan parameters in the samples under the jurisdiction of a certain level node, and its corresponding actual performance indicator is y; n represents the total number of samples under the jurisdiction of a certain level node. For the first i The planned parameter vector for each sample; K() is the standard Gaussian kernel function; h is the kernel bandwidth of a certain level node, which is the average of the pairwise Euclidean distances between all samples within that node multiplied by a preset scaling factor c=0.9; When a given inspection plan falls into a third-level leaf node based on its corresponding user characteristics, the local probability density of that third-level leaf node is obtained. Starting from the third-level leaf node, the algorithm recursively ascends level by level to obtain the kernel density of the second-level parent node, the first-level parent node, and the root node of the third-level leaf node, denoted as follows: ; Based on the preset inter-layer weighting coefficients, the kernel densities of the second-level parent node, the first-level parent node, and the root node of the third-level leaf node are weighted and multiplied to obtain the prior probability density. Further, the prior probability density The local probability density of the third-level leaf node Perform Bayesian product fusion to obtain the final conditional probability density. And output as a global probabilistic proxy model; wherein, the inter-layer weight coefficients include the weight of the root node. =0.2, the weight of the first-level parent node =0.3, the weight of the second-level parent node =0.5, the weight of the third-level leaf node is 1.
7. The method for optimizing and generating electricity usage inspection plans based on a tree-structured Parzen estimator as described in claim 6, characterized in that, The specific steps of step S4 include: At the start of each iteration, the parameters are generated from the multidimensional hyperparameter space Θ using uniform random sampling or Latin hypercube sampling. One candidate program; Through formula The expected improvement value of the candidate plan θ is calculated. ;in, The expected improvement value of candidate program θ Correct the previous initial values, and ; To calculate the expected outcome probability density corresponding to the candidate plan scheme θ based on the global probabilistic proxy model; y is the expected outcome value of the candidate plan scheme θ; The current set of effective samples The maximum value; η is the penalty coefficient, η=0.1; The preset distance threshold; It is a distance penalty term, and , is used to represent the minimum Euclidean distance between the candidate plan θ and the parameter vectors of all executed plans; Expected improvement from all candidate plans The candidate plan with the largest expected improvement is selected as the current optimal candidate plan. ; The current optimal candidate plan scheme is to be determined. After on-site deployment and implementation, the actual effectiveness vector is collected. ; where the actual effectiveness vector The comprehensive weighted score includes three indicators: the peak-to-valley difference correction of the load curve after inspection, the metering error correction, and the amount of electricity to be compensated for violations. The current optimal candidate plan Its corresponding actual effectiveness vector Association is an incremental sample pair Based on the user characteristics of the incremental sample pair, the third-level leaf node to which it belongs is determined, and the incremental sample pair is further added to the local sample set of the third-level leaf node to which it belongs. The kernel density bandwidth of the third-level leaf nodes with added incremental sample pairs is recalculated, and a sliding window strategy is adopted to determine when the total number of local samples exceeds the preset window capacity. At that time, the oldest samples are removed in the order of their inclusion time to ensure that the model adapts to recent changes in electricity consumption behavior; After updating the third-level leaf nodes with added incremental sample pairs, the kernel density of the corresponding second-level parent node, first-level parent node and root node is recalculated layer by layer from bottom to top along the tree structure. This is equivalent to propagating the incremental information of the third-level leaf nodes to the root node through the tree conditional dependency relationship. After each iteration, check the optimal candidate plans from the three consecutive iterations. Are the pairwise Euclidean distances between them all less than a preset distance threshold? And calculate the expected improvement value of the optimal candidate plan in these three rounds. relative rate of change ;in, This is the optimal candidate plan obtained from the previous iteration in the current iteration; This is the optimal candidate plan obtained from the previous iteration over the current iteration; If the relative rate of change for these three consecutive rounds is determined All are less than the rate of change threshold δ=0.01, and simultaneously satisfy the optimal candidate plan scheme for these three consecutive rounds. The pairwise Euclidean distances between them are all less than the preset distance threshold. If convergence is achieved, the iteration is terminated; otherwise, the next iteration continues.
8. The method for optimizing and generating electricity usage inspection plans based on a tree-structured Parzen estimator as described in claim 7, characterized in that, The method further includes: The initial set of schemes is sorted and allocated using a user priority scoring and regional grouping round-robin allocation strategy to generate an executable plan set which is then sent to the field operation terminal.
9. The method for optimizing and generating electricity usage inspection plans based on a tree-structured Parzen estimator as described in claim 8, characterized in that, The specific steps for sorting and allocating the initial set of solutions using a user priority scoring and regional grouping round-robin allocation strategy include: Get priority scores for all users And score them according to priority. Sort all users in descending order to form a priority queue Q; where, For users i Capacity level value; For users i Number of historical defaults; For users i Importance of the load; These are the weight coefficients of the three preset factors, all of which are fixed values less than 1; Obtain the power supply area code for each user, take the first-level area code as the grouping basis, and assign all users to the corresponding area group. Furthermore, within each regional group, users are reordered according to their priority queue Q, ensuring that higher-ranked users within the same region are placed at the front, thus forming an ordered user sequence for each regional group. ; Calculate the total priority score for each region group. , and according to The entire region group is globally sorted from highest to lowest to obtain the group execution sequence; among which... Suppose there are T time windows for the inspection dates, starting sequentially from the highest-ranked regional group, and then from the ordered sequence of that group. Users are retrieved one by one and assigned to the currently available time windows in a round-robin fashion, while satisfying the following constraints: If a user has already been assigned to a window, the remaining users in the same area should be assigned to other windows as much as possible. By maintaining the area code set for each window, when adding a new user, the window whose area code set does not yet contain the user's area code is selected first; if all windows contain the area code set, the window with the fewest users is selected. Iterate through all area groups until all users have been assigned, and finally generate a set of executable plans containing specific inspection dates, inspection personnel groups, and inspection item lists, and distribute them to the field operation terminals.
10. A power consumption inspection plan optimization and generation system based on a tree-structured Parzen estimator, characterized in that, include: The sample acquisition unit is used to collect electricity user electricity consumption records. After cleaning and normalizing the relevant electricity consumption data in the electricity consumption records, it divides the data into multiple samples according to a predetermined time window. Furthermore, each sample is labeled with key parameters and performance indicators of the inspection plan actually implemented during the corresponding period. The electricity consumption records include basic user information, historical electricity load curves, metering device operation records, and past violations of electricity consumption regulations. Both the historical electricity load curves and the metering device operation records carry relevant electricity consumption data. The electricity consumption feature extraction unit is used to extract the electricity consumption features of each sample, and uses a time sliding window to statistically analyze the evolution trend of the same electricity consumption feature in a continuous period, and quantifies the evolution trend into a feature increment sequence, which is further aligned with the execution cycle preset by the inspection plan to form a dynamic feature matrix; wherein, the electricity consumption features of each sample include user basic information features, load fluctuation features, metering anomaly features, and default history features. A global probability model unit is constructed to construct a multidimensional hyperparameter space by taking the key parameters of the inspection plan as the hyperparameters to be optimized. Based on the dynamic feature matrix, the multidimensional hyperparameter space is divided into a tree structure hierarchy, so that each node of the tree structure corresponds to an electricity consumption feature. An independent kernel density estimation function is established on each node to fit the kernel density distribution of the plan under the condition of that node. Furthermore, based on the dependency relationship of the transmission of probability density information between the upper and lower level nodes of the tree structure, a global probability proxy model is constructed. The global probability model unit is iteratively updated to perform iterative calculations on the multidimensional hyperparameter space using an optimization algorithm until the convergence condition is met. In each iteration, multiple candidate plans are sampled from the multidimensional hyperparameter space, and the expected improvement value of each candidate plan is calculated according to the global probability proxy model. The candidate plan with the largest expected improvement value in each iteration is taken as the optimal candidate plan. After the optimal candidate plan is deployed and executed in the field, the corresponding actual performance data is collected, and the actual performance data collected in each iteration is incrementally updated to the global probability proxy model to correct the kernel density of each level of node. The optimization scheme output unit is used to parse the hyperparameters in the final optimal candidate scheme into executable scheme entries after the iterative calculation of the multidimensional hyperparameter space to be determined has terminated, and to summarize them according to the user's basic information to form an initial scheme set for output.
