A parameter automatic adjustment method and system of a power distribution network data quality improvement algorithm
By automatically adjusting the parameters of the power distribution network data quality improvement algorithm using large language models and abstract syntax tree technology, the problems of poor cross-scenario adaptability and data leakage risk are solved, achieving efficient and secure data quality improvement.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANDONG UNIV
- Filing Date
- 2025-10-30
- Publication Date
- 2026-04-14
AI Technical Summary
Existing algorithms for improving the quality of distribution network data lack the ability to generalize across different scenarios in different regions. They rely on expert knowledge and are time-consuming. Furthermore, cloud computing poses a risk of data leakage, making it difficult to adapt to the dynamic operation requirements of the distribution network.
By employing large language models and abstract syntax tree technology, the parameters of the power distribution network data quality improvement algorithm are automatically adjusted. By obtaining data quality scores and historical records, parameter suggestions are generated to achieve automatic optimization of algorithm parameters.
It significantly shortens the parameter optimization cycle, improves the generalization performance and data quality of the algorithm, meets the requirements of data security and operational rigor, and is adaptable to power distribution network scenarios in different regions.
Smart Images

Figure CN121031999B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of power distribution network data quality improvement technology, and in particular to an automatic parameter adjustment method and system for a power distribution network data quality improvement algorithm. Background Technology
[0002] The statements in this section are merely background information related to the present invention and do not necessarily constitute prior art.
[0003] With the energy structure shifting towards a higher proportion of renewable energy, the randomness and volatility of distribution network operation data have significantly increased, placing extremely high demands on data quality. To improve the data quality of distribution network data, artificial intelligence algorithms such as machine learning and deep learning (e.g., random forest, K-means clustering, and Long Short-Term Memory (LSTM) algorithms are used for anomaly detection. However, the performance of these existing distribution network data quality improvement algorithms is highly dependent on the selection of model hyperparameters. Traditional hyperparameter optimization methods have many key problems, such as:
[0004] Traditional parameter adjustment methods lack cross-scenario generalization ability. Due to significant differences in solar radiation, meteorological conditions, user electricity consumption patterns, and network topology in different regions, the optimal parameters of the same algorithm cannot be reused in different regions. This leads to the need for repeated parameter adjustments for different regions, increasing the cost of parameter adjustment and reducing efficiency.
[0005] In addition, traditional parameter adjustment methods rely excessively on expert knowledge and human experience. Different experts have a high degree of subjectivity in judging parameter weights, which can easily lead to differences in adjustment results. Moreover, the higher the parameter dimension, the longer the manual adjustment takes. For example, most deep learning algorithms have a parameter dimension of >10, and the manual parameter adjustment time can reach 36-48 hours, which is difficult to adapt to the dynamic operation requirements of the power distribution network.
[0006] Finally, current mainstream parameter adjustment methods mostly rely on centralized calculations on servers deployed in the cloud, which exposes the power distribution network operation data to the risk of leakage during transmission. With the increasing demand for localized or edge-side deployment solutions, more stringent requirements are being placed on the lightweight and efficient nature of parameter adjustment methods. Summary of the Invention
[0007] To address the aforementioned issues, this invention proposes an automatic parameter adjustment method and system for a data quality improvement algorithm in power distribution networks. The initial score of the data quality improvement algorithm is used as the benchmark for subsequent optimization. Iterative optimization of the algorithm parameters is performed based on a large language model. In each iteration, the current code, historical parameter adjustment records, and data quality score are combined into a prompt word. Parameter adjustment suggestions are obtained through the large language model, the corresponding parameter values in the algorithm are modified, the modified algorithm is run, and the data quality score is re-evaluated.
[0008] In some implementations, the following technical solutions are adopted:
[0009] An automatic parameter adjustment method for a power distribution network data quality improvement algorithm includes:
[0010] Acquire distribution network operation data, execute the initial target data quality improvement algorithm on the acquired distribution network operation data to obtain data with improved data quality, and calculate the initial data quality comprehensive score;
[0011] Obtain the code context, historical parameter adjustment records, and data quality score change trends of the target data quality improvement algorithm to construct prompt words;
[0012] Input the prompt words into the large language model, and use the reasoning ability of the large language model to generate parameter suggestions that are suitable for the current power distribution network scenario;
[0013] Based on the parameter recommendations, the corresponding parameters of the target data quality improvement algorithm are replaced using abstract syntax tree technology.
[0014] As a further option, it also includes:
[0015] Based on the replaced parameters, the target data quality improvement algorithm is executed on the acquired distribution network operation data to recalculate the comprehensive data quality score;
[0016] Based on the target data quality improvement algorithm after parameter replacement, and the recalculated comprehensive data quality score, the new comprehensive data quality score is continuously calculated iteratively according to the aforementioned automatic parameter adjustment method of the distribution network data quality improvement algorithm, until the score meets the set requirements or reaches the maximum number of iterations.
[0017] Output parameter adjustment report, adjusted algorithm code, and results of the adjusted algorithm.
[0018] As a further step, the initial overall data quality score is calculated, specifically as follows:
[0019] Based on the detection results of the initial target data quality improvement algorithm, the accuracy, consistency, completeness, timeliness, topological consistency and time-series dynamic stability indicators are calculated respectively. The weight of each indicator is calculated, and the weighted average of each indicator is used to obtain the overall score of the initial data quality.
[0020] As a further step, the accuracy, consistency, completeness, timeliness, topological consistency, and time-series dynamic stability indices are calculated separately, specifically as follows:
[0021] Based on the total amount of data, the amount of invalid data, and the amount of redundant data, determine the total amount of valid data D that can be used for quality assessment. 有效 ;
[0022] The accuracy metric is based on the amount of inaccurate data and D. 有效 The ratio is determined;
[0023] The consistency metric is based on the amount of data that does not meet the consistency test and D. 有效 The ratio is determined;
[0024] The integrity index is determined based on the ratio of the number of empty and invalid data to the total amount of data;
[0025] The timeliness index is based on the amount of data that cannot be transmitted in a timely manner and D. 有效 The ratio is determined;
[0026] The topology consistency metric is based on the number of data points that violate topology constraints and D. 有效 The ratio is determined;
[0027] The time-series dynamic stability index is calculated based on the standardized reconstruction error.
[0028] As a further step, the weight of each indicator is calculated, and the specific process is as follows:
[0029] use n Sampling data from individual measuring devices and m 1 indicator, construct a decision matrix X For the decision matrix X Standardize;
[0030] Calculate the standard deviation of each indicator σ j and the correlation coefficient matrix between indicators R ;
[0031] Based on the standard deviation of each indicator σ j and the correlation coefficient matrix between indicators R Calculate the information content of each indicator C j ;
[0032] Based on the correlation coefficient matrix between indicators R Calculate the conflict between each indicator and other indicators. C k ;
[0033] Based on the information content of each indicator C j And its conflict with other indicators C k The weight of each indicator is calculated.
[0034] As a further option, calculate the first... j Information content of each indicator C j Specifically:
[0035] ;
[0036] Calculate the first j Conflicts between individual indicators and other indicators C k Specifically:
[0037] ;
[0038] Calculation yields the first j Weight of each indicator Specifically:
[0039] ;
[0040] in, For the first j The standard deviation of each indicator Represents the standardized first j The first indicator and the first k The Pearson correlation coefficient of the indicators, where m represents the number of indicators.
[0041] As a further solution, abstract syntax tree (AST) technology is used to replace the corresponding parameters of the target data quality improvement algorithm, specifically:
[0042] The parser is used to map the source code of the initial data quality improvement algorithm to the original abstract syntax tree;
[0043] Identify nodes in the abstract syntax tree that contain parameter values;
[0044] Perform parameter substitution on each node to generate a new syntax tree;
[0045] Convert the new syntax tree back to a code string to obtain the algorithm code with adjusted parameters.
[0046] In other embodiments, the following technical solutions are adopted:
[0047] An automatic parameter adjustment system for a power distribution network data quality improvement algorithm includes:
[0048] The initial score calculation module is configured to acquire distribution network operation data, execute an initial target data quality improvement algorithm on the acquired distribution network operation data, obtain data with improved data quality, and calculate the initial data quality comprehensive score.
[0049] The prompt word construction module is configured to obtain the code context of the target data quality improvement algorithm, historical parameter adjustment records, and data quality score change trends to construct prompt words.
[0050] The modification suggestion generation module is configured to input prompt words into a large language model and use the reasoning capabilities of the large language model to generate parameter suggestions that are adapted to the current power distribution network scenario.
[0051] The parameter replacement module is configured to replace the corresponding parameters of the target data quality improvement algorithm based on the parameter suggestions, using abstract syntax tree technology.
[0052] In other embodiments, the following technical solutions are adopted:
[0053] A terminal device includes a processor and a memory, wherein the processor is used to implement instructions; and the memory is used to store multiple instructions, the instructions being adapted to be loaded by the processor and executed by the automatic parameter adjustment method of the above-described power distribution network data quality improvement algorithm.
[0054] In other embodiments, the following technical solutions are adopted:
[0055] A computer-readable storage medium storing a plurality of instructions adapted for loading and execution by a processor of a terminal device of the above-described automatic parameter adjustment method for the power distribution network data quality improvement algorithm.
[0056] Compared with the prior art, the beneficial effects of the present invention are:
[0057] (1) This invention automates the parameter adjustment process of data quality improvement algorithms by integrating large language models and abstract syntax tree technology. By automatically parsing code context, parameter adjustment history and performance trends, it generates accurate optimization suggestions, solving the high cost and low efficiency problems of traditional parameter adjustment methods that rely on manual trial and error by experts, and significantly shortening the parameter optimization cycle.
[0058] (2) This invention utilizes the powerful reasoning capabilities of large language models to dynamically generate optimal parameters for algorithms corresponding to different regions and operating characteristics of power distribution networks, thereby improving the generalization performance of the algorithms. At the same time, by using locally deployed large language models for parameter optimization, the risk of data leakage in cloud-based solutions is eliminated, meeting the stringent requirements of the power industry for data security and operational rigor.
[0059] (3) This invention significantly improves the overall quality of distribution network data. Experiments have shown that this method can be widely applied to various data quality improvement algorithms, effectively improving the accuracy, consistency, and timeliness of data through automated parameter adjustment. This not only provides a solid foundation for data-driven intelligent power grid analysis, but also ensures the safe, stable, and economical operation of the distribution network from the source, and has significant practical application value and promotion prospects.
[0060] This invention integrates large language model and abstract syntax tree technology to achieve automated adjustment of algorithm parameters for improving data quality in distribution networks. It can effectively overcome the shortcomings of traditional methods, such as low efficiency, high dependence on experts, poor cross-scenario adaptability, and data leakage risk. By dynamically generating accurate parameter suggestions, it significantly improves the performance and generalization ability of the algorithm, providing an efficient and safe general solution for the safe and stable operation of distribution networks.
[0061] Other features and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0062] Figure 1 This is a flowchart of the automatic parameter adjustment method for the power distribution network data quality improvement algorithm based on a large language model in an embodiment of the present invention;
[0063] Figure 2 This is a trend chart of data quality score changes in an embodiment of the present invention;
[0064] Figure 3 This is a diagram showing the effect of adjusting the parameters of various data quality improvement algorithms under different power distribution network conditions provided in the embodiments of the present invention;
[0065] Figure 4 The result of processing before adjusting the parameters of the LSTM algorithm;
[0066] Figure 5 This is the result of the LSTM algorithm after parameter adjustment;
[0067] Figure 6 This is the result of the random forest outlier handling method before parameter adjustment;
[0068] Figure 7This is the result of the random forest outlier handling method before parameter adjustment. Detailed Implementation
[0069] It should be noted that the following detailed description is illustrative and intended to provide further explanation of the invention. Unless otherwise specified, all technical and scientific terms used in this invention have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0070] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of exemplary embodiments according to the invention. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.
[0071] Example 1
[0072] In one or more embodiments, an automatic parameter adjustment method for a distribution network data quality improvement algorithm is disclosed, combining... Figure 1 Specifically, it includes the following process:
[0073] S100: Obtain distribution network operation data, execute the initial target data quality improvement algorithm on the obtained distribution network operation data, and calculate the initial data quality comprehensive score.
[0074] Specifically, distribution network operation data includes: sampled current, voltage, power, and other data. The input data is sampled from different regions and has different data distribution characteristics. Especially for power system data, such as sampled current, voltage, and power data, different regions have different electricity consumption patterns. Therefore, it can reflect the distribution network scenarios with different regional and operational characteristics.
[0075] First, configure the initial default parameters for the target data quality improvement algorithm, input the original data of the distribution network, run the initial distribution network data quality improvement algorithm, and obtain the data after data quality improvement; based on the output results of the initial target data quality improvement algorithm, calculate the accuracy, consistency, completeness, timeliness, topology consistency and time series dynamic stability indicators respectively, calculate the weight of each indicator, and weight the indicators to obtain the initial data quality comprehensive score.
[0076] This embodiment uses the random forest algorithm as a data quality improvement algorithm for outlier detection as an example for illustration.
[0077] The initial parameters for the random forest algorithm are set as follows:
[0078] (1)
[0079] in, WINDOW_SIZE This represents the "sliding window length" when the algorithm processes distribution network time-series data. THRESHOLD This represents the threshold used by the Random Forest algorithm to classify distribution network data as "abnormal data". N_ESTIMATORS This indicates the number of base decision trees included in the random forest algorithm. RANDOM_STATE The "random seed" of an algorithm is a parameter that controls the repeatability of a random process.
[0080] During the first execution, the accuracy is calculated based on the detection results obtained from the initial random forest algorithm. ,consistency Completeness Timeliness Topological consistency Topology Consistency and time-series dynamic stability Temporal Dynamic Stability These six single-dimensional data quality indicators are as follows: Accuracy focuses on the degree of agreement between data values and actual data, ensuring data reliability and identifying obvious measurement errors; Consistency examines the logical consistency within the data and with other data sources, identifying logical contradictions such as mismatches between master and sub-meters; Completeness verifies the completeness of data records; Timeliness assesses data transmission latency to meet the dynamic needs of real-time monitoring and rapid control; Topology Consistency focuses on whether the data conforms to the physical laws and connections of the power grid, such as Kirchhoff's current and voltage laws; it ensures the rationality of the data from a physical perspective and can detect hidden anomalies that traditional methods cannot identify; Time-series Dynamic Stability uses deep learning models to study whether the behavior patterns of data over time are stable and conform to historical patterns.
[0081] As a specific implementation method, the determination of each indicator is as follows:
[0082] Based on the total amount of data, the amount of invalid data, and the amount of redundant data, determine the total amount of valid data that can be used for quality assessment: ;
[0083] Accuracy metrics are based on the amount of inaccurate data and D 有效 The ratio is determined as follows:
[0084] (2)
[0085] The consistency metric is based on the amount of data that does not meet the consistency test and D. 有效 The ratio is determined as follows:
[0086] (3)
[0087] The integrity metric is determined based on the ratio of the number of empty and invalid data to the total amount of data:
[0088] (4)
[0089] Timeliness metrics are based on the amount of data that cannot be transmitted in a timely manner and D 有效 The ratio is determined as follows:
[0090] (5)
[0091] The topology consistency metric is based on the number of data points that violate topology constraints and D. 有效 The ratio is determined as follows:
[0092] (6)
[0093] The time-series dynamic stability index is calculated based on the standardized reconstruction error:
[0094] (7)
[0095] in, D null D1 indicates the amount of invalid data, and D1 indicates the amount of inaccurate data. D all and D redundancy These represent the total amount of data and the amount of redundant data, respectively. D 2 indicates the amount of data that does not meet the consistency test. D 3 indicates the number of empty and invalid data. D 4 indicates the amount of data that cannot be transmitted in time. D 5 indicates the number of data points that violate topology constraints, which include power balance verification and voltage phase angle relationship verification. D 6 represents the standardized reconstruction error, which measures the degree of deviation of the current data from the normal time series pattern.
[0096] After obtaining the values of each indicator, the weight of each indicator is calculated using the CRITIC weighting method. The specific process is as follows:
[0097] use n Sampling data from individual measuring devices and m 1 indicator, construct a decision matrix X :
[0098] (8)
[0099] in, x ij It is the first i The first sample j Individual indicator values.
[0100] Standardize the decision matrix:
[0101] (9)
[0102] in, x j Indicates the first j All values of each indicator.
[0103] Calculate the standard deviation of each indicator σ j :
[0104] (10)
[0105] Calculate the correlation coefficient matrix between the indicators. R :
[0106] (11)
[0107] in, r jk Indicators j and k The Pearson correlation coefficient.
[0108] For each metric j Calculate its conflict with other indicators. C k High conflict rate means that the indicator has low correlation with other indicators and should be given higher weight. C k The specific calculation formula is as follows:
[0109] (12)
[0110] For each metric j Calculate the amount of information C j :
[0111] (13)
[0112] Ultimately, based on each metric j Information content C j and indicators j Conflict with other indicators C k The weights are calculated. ω j as follows:
[0113] (14)
[0114] The initial comprehensive data quality score is obtained by weighted summation of the values of each indicator; in subsequent iterative processes, the calculation is based on the algorithm results and data quality scores of the previous iteration.
[0115] S200: Obtain the code context, historical parameter adjustment records, and data quality score change trends of the target data quality improvement algorithm, and construct prompt words.
[0116] In this embodiment, irrelevant lines are automatically removed during code recognition to obtain the code text;
[0117] Historical parameter adjustment records are kept in a text file in the program's folder, including data quality scores before each adjustment, parameter adjustment suggestions, and the thought process behind the large language model. The data quality score trend is automatically calculated and increased after each adjustment, and finally output as a trend chart, such as... Figure 2 As shown.
[0118] Below is a specific example of a prompt word:
[0119] You are a power system intelligent algorithm parameter tuning expert, proficient in deep learning algorithms. You are currently adjusting the parameters of the LSTM autoencoder algorithm, and the higher the performance score, the better the performance.
[0120] Your task is to identify variables in the algorithm code and provide new suggested values for each variable. Please provide parameter modification suggestions as a parameter tuning expert.
[0121] **Objective:** To improve the algorithm score to above {1 + IMPROVEMENT_THRESHOLD:.0%} of the initial score (target score >= {target_score:.6f}).
[0122] [Output Specification]: Change the variable name from its original value to the new value;
[0123] **Historical Recommendations Review**:
[0124] {history_context if history_context else "(none)"};
[0125] **Initial score:** {base_score:.6f};
[0126] **Current score:** {current_score:.6f};
[0127] **Target score**: >= {target_score:.6f};
[0128] {score_note} (Score Explanation);
[0129] **Rating Trends**:
[0130] {score_trend} (score trend);
[0131] The code content is as follows:
[0132] {original_code} (original code).
[0133] Here, base_score:.6f represents a formatting placeholder, base_score is the variable name representing the initial score; :.6f is the format specification, used to specify how to display this variable; f indicates that the variable is formatted as a floating-point number, and .6 indicates that 6 decimal places are retained.
[0134] S300: Input the prompt words into the large language model, and use the reasoning ability of the large language model to generate parameter suggestions that are suitable for the current power distribution network scenario.
[0135] In this embodiment, a general-purpose large language model can be selected, such as DeepSeek-R1:7B. This model is lightweight and efficient, enabling lightweight local deployment. It is particularly suitable for operation in the localized deployment environment of the power system, perfectly meeting the requirements of data security, real-time performance, and cost control.
[0136] The output parameter suggestions are as follows: for each parameter that needs to be adjusted, suggestions on what value to change each parameter from; for example: increase WINDOW_SIZE (window size) from 10 to 15; increase HIDDEN_UNITS (hidden units) from 64 to 100; increase EPOCHS (training epochs) from 50 to 70, etc.
[0137] In this embodiment, the text output by the model is split into lines, and blank lines, code block marker lines, and other irrelevant lines are automatically filtered out. Then, the system enters the structured pattern matching stage, using specially designed regular expressions to accurately identify the fixed syntax structure of "parameter name changing from its original value to a new value," capturing both the parameter name and numerical information. Finally, parameter extraction and verification are performed. The system extracts the parameter name and new value, verifies the differences between the old and new values and the parameter name format, and ultimately outputs structured key-value pairs for subsequent code modification.
[0138] S400: Based on the obtained parameter suggestions, use abstract syntax tree technology to replace the corresponding parameters of the target data quality improvement algorithm.
[0139] Specifically, the process begins with syntax analysis. The original code string is input, and then a parser maps the source code to the original abstract syntax tree.
[0140] The original abstract syntax tree refers to the syntax tree obtained by parsing the source code using an abstract syntax tree (AST). It contains the initial code content, specifically including: Module: root node, Assign: assignment statement, Call: function / method call, Name: variable name, Constant: constant value, and Keyword: keyword argument, etc.
[0141] (15)
[0142] in, T 0 represents the original syntax tree. S It is the original code string. P () is the parser function; this article uses the ast.parse() function in Python.
[0143] Then define the Boolean matching function. M Used to identify parameter values contained in the abstract syntax tree. p (Referring to nodes with all adjustable parameters):
[0144] (16)
[0145] in, v It is a node in the abstract syntax tree. v ∈ V , V It is the set of all nodes in the abstract syntax tree, where each node represents a syntactic structure. Further, it defines the set of all eligible target nodes.
[0146] (17)
[0147] in, V p This represents all nodes to be modified, and each node contains the parameter value p to be replaced.
[0148] For each v ∈ V p Perform the following replacement operation.
[0149] (18)
[0150] (19)
[0151] The Replace() function will replace the field value with... p Replace with p' The Update() function returns the new node after the field has been replaced, outputting... v'This represents the node of the abstract syntax tree after the structure has been updated.
[0152] Then, a new syntax tree is generated based on the node replacements.
[0153] (20)
[0154] The Substitute() function traverses the original abstract syntax tree and performs replacements on the target nodes. T 1 represents the new syntax tree after the replacement.
[0155] Convert the new syntax tree back to a code string to obtain the algorithm code with adjusted parameters.
[0156] S500: Based on the algorithm code with adjusted parameters, the same original distribution network data as S100 is input, and S100-S400 are run in a loop. The target data quality improvement algorithm is executed on the acquired distribution network operation data, and the comprehensive data quality score is recalculated.
[0157] The data quality comprehensive score is obtained through continuous iterative calculation until the score meets the set requirements or reaches the maximum number of iterations; the output includes a parameter adjustment report, the adjusted algorithm code, and the running results of the adjusted data quality improvement algorithm.
[0158] Figure 3 This is a graph showing the effect of adjusting parameters for various data quality improvement algorithms under different power distribution network conditions. Analysis Figure 3 It is understood that the present invention can accurately and efficiently achieve automatic optimization of algorithm parameters, and is applicable to distribution networks in different regions with different power grid topologies, user characteristics and meteorological characteristics, and is also applicable to a variety of distribution network data quality improvement methods containing different parameters.
[0159] Figure 4 and Figure 5 A comparison chart of the processing results of data from distribution network 1 before and after LSTM algorithm parameter adjustment is given; among them, Figure 4 This is the processing result under the initial parameters. Figure 5 The result is the result of using the parameter automatic adjustment method in this embodiment. It can be seen that the data quality has been improved to a certain extent after processing.
[0160] Figure 6 and Figure 7 A comparison chart of the processing results of Distribution Network 2 data before and after parameter adjustment for the random forest outlier handling method is presented; among them, Figure 6 This is the processing result under the initial parameters. Figure 7 This is the result of the automatic parameter adjustment method used in this embodiment, and the data quality has also been improved to a certain extent after processing.
[0161] In summary, the same algorithm can exhibit different performance on the same power distribution network dataset due to different parameter settings. This invention can automatically adjust the algorithm parameters to be the most suitable for the current dataset, thereby achieving optimal performance.
[0162] Example 2
[0163] In one or more embodiments, an automatic parameter adjustment system for a power distribution network data quality improvement algorithm is disclosed, comprising:
[0164] The initial score calculation module is configured to acquire distribution network operation data, execute an initial target data quality improvement algorithm on the acquired distribution network operation data, obtain data with improved data quality, and calculate the initial data quality comprehensive score.
[0165] The prompt word construction module is configured to obtain the code context of the target data quality improvement algorithm, historical parameter adjustment records, and data quality score change trends to construct prompt words.
[0166] The modification suggestion generation module is configured to input prompt words into a large language model and use the reasoning capabilities of the large language model to generate parameter suggestions that are adapted to the current power distribution network scenario.
[0167] The parameter replacement module is configured to replace the corresponding parameters of the target data quality improvement algorithm based on the parameter suggestions, using abstract syntax tree technology.
[0168] It should be noted that the specific implementation methods of the above modules are the same as those in Example 1, and will not be described in detail again.
[0169] Example 3
[0170] In one or more embodiments, a terminal device is disclosed, comprising a processor and a memory, wherein the processor is used to implement instructions; and the memory is used to store multiple instructions adapted to be loaded by the processor and executed by the automatic parameter adjustment method of the power distribution network data quality improvement algorithm described in Embodiment 1.
[0171] It should be understood that in this embodiment, the processor can be a central processing unit (CPU), or it can be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc.
[0172] Memory may include read-only memory and random access memory, and provides instructions and data to the processor. A portion of memory may also include non-volatile random access memory. For example, memory may also store information about the device type.
[0173] In the implementation process, each step of the above method can be completed by the integrated logic circuits in the processor hardware or by software instructions.
[0174] Example 4
[0175] In one or more embodiments, a computer-readable storage medium is disclosed, wherein a plurality of instructions are stored, the instructions being adapted to be loaded by a processor of a terminal device and executed by the automatic parameter adjustment method of the power distribution network data quality improvement algorithm described in Embodiment 1.
[0176] While the specific embodiments of the present invention have been described above in conjunction with the accompanying drawings, this is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art without creative effort based on the technical solutions of the present invention are still within the scope of protection of the present invention.
Claims
1. An automatic parameter adjustment method for a power distribution network data quality improvement algorithm, characterized in that, include: Acquire distribution network operation data, execute the initial target data quality improvement algorithm on the acquired distribution network operation data to obtain data with improved data quality, and calculate the initial data quality comprehensive score; Obtain the code context, historical parameter adjustment records, and data quality score change trends of the target data quality improvement algorithm to construct prompt words; Input the prompt words into the large language model, and use the reasoning ability of the large language model to generate parameter suggestions that are suitable for the current power distribution network scenario; Based on the parameter suggestions, the corresponding parameters of the target data quality improvement algorithm are replaced using abstract syntax tree technology; Based on the replaced parameters, the target data quality improvement algorithm is executed on the acquired distribution network operation data to recalculate the comprehensive data quality score; Based on the target data quality improvement algorithm after parameter replacement, and the recalculated comprehensive data quality score, the new comprehensive data quality score is continuously calculated iteratively according to the aforementioned automatic parameter adjustment method of the distribution network data quality improvement algorithm, until the score meets the set requirements or reaches the maximum number of iterations. Output parameter adjustment report, adjusted algorithm code, and results of the adjusted algorithm; The initial overall data quality score was calculated as follows: Based on the detection results of the initial target data quality improvement algorithm, the accuracy, consistency, completeness, timeliness, topological consistency and time-series dynamic stability indicators are calculated respectively. The weight of each indicator is calculated, and the weighted average of each indicator is used to obtain the overall score of the initial data quality. Distribution network operation data includes: sampled current, voltage, and power data; Consistency metrics examine the logical consistency of data within the data itself and with other data sources. They are used to identify logical contradictions in the electricity consumption between the master table and the sub-tables. Topology consistency metrics focus on whether the data conforms to the physical laws and connection relationships of the power grid.
2. The automatic parameter adjustment method for a power distribution network data quality improvement algorithm as described in claim 1, characterized in that, The accuracy, consistency, completeness, timeliness, topological consistency, and time-series dynamic stability indices are calculated separately, as follows: Based on the total amount of data, the amount of invalid data, and the amount of redundant data, determine the total amount of valid data D that can be used for quality assessment. 有效 ; The accuracy metric is based on the amount of inaccurate data and D. 有效 The ratio is determined; The consistency metric is based on the amount of data that does not meet the consistency test and D. 有效 The ratio is determined; The integrity index is determined based on the ratio of the number of empty and invalid data to the total amount of data; The timeliness index is based on the amount of data that cannot be transmitted in a timely manner and D. 有效 The ratio is determined; The topology consistency metric is based on the number of data points that violate topology constraints and D. 有效 The ratio is determined; The time-series dynamic stability index is calculated based on the standardized reconstruction error.
3. The automatic parameter adjustment method for a power distribution network data quality improvement algorithm as described in claim 1, characterized in that, The specific process for calculating the weight of each indicator is as follows: use n Sampling data from individual measuring devices and m 1 indicator, construct a decision matrix X For the decision matrix X Standardize; Calculate the standard deviation of each indicator σ j and the correlation coefficient matrix between indicators R ; Based on the standard deviation of each indicator σ j and the correlation coefficient matrix between indicators R Calculate the information content of each indicator C j ; Based on the correlation coefficient matrix between indicators R Calculate the conflict between each indicator and other indicators. C k ; Based on the information content of each indicator C j And its conflict with other indicators C k The weight of each indicator is calculated.
4. The automatic parameter adjustment method for a power distribution network data quality improvement algorithm as described in claim 3, characterized in that, Calculate the first j Information content of each indicator C j Specifically: ; Calculate the first j Conflicts between individual indicators and other indicators C k Specifically: ; Calculation yields the first j Weight of each indicator Specifically: ; in, For the first j The standard deviation of each indicator Represents the standardized first j The first indicator and the first k The Pearson correlation coefficient of the indicators, where m represents the number of indicators.
5. The automatic parameter adjustment method for a power distribution network data quality improvement algorithm as described in claim 1, characterized in that, Using abstract syntax tree (AST) technology, the corresponding parameters of the target data quality improvement algorithm are replaced, specifically as follows: The parser is used to map the source code of the initial data quality improvement algorithm to the original abstract syntax tree; Identify nodes in the abstract syntax tree that contain parameter values; Perform parameter substitution on each node to generate a new syntax tree; Convert the new syntax tree back to a code string to obtain the algorithm code with adjusted parameters.
6. An automatic parameter adjustment system for a power distribution network data quality improvement algorithm, characterized in that, include: The initial score calculation module is configured to acquire distribution network operation data, execute an initial target data quality improvement algorithm on the acquired distribution network operation data, obtain data with improved data quality, and calculate the initial data quality comprehensive score. The prompt word construction module is configured to obtain the code context of the target data quality improvement algorithm, historical parameter adjustment records, and data quality score change trends to construct prompt words. The modification suggestion generation module is configured to input prompt words into a large language model and use the reasoning capabilities of the large language model to generate parameter suggestions that are adapted to the current power distribution network scenario. The parameter replacement module is configured to replace the corresponding parameters of the target data quality improvement algorithm based on the parameter suggestions, using abstract syntax tree technology. Based on the replaced parameters, the target data quality improvement algorithm is executed on the acquired distribution network operation data to recalculate the comprehensive data quality score; Based on the target data quality improvement algorithm after parameter replacement, and the recalculated comprehensive data quality score, the new comprehensive data quality score is continuously calculated iteratively according to the aforementioned automatic parameter adjustment method of the distribution network data quality improvement algorithm, until the score meets the set requirements or reaches the maximum number of iterations. Output parameter adjustment report, adjusted algorithm code, and results of the adjusted algorithm; The initial overall data quality score was calculated as follows: Based on the detection results of the initial target data quality improvement algorithm, the accuracy, consistency, completeness, timeliness, topological consistency and time-series dynamic stability indicators are calculated respectively. The weight of each indicator is calculated, and the weighted average of each indicator is used to obtain the overall score of the initial data quality. Distribution network operation data includes: sampled current, voltage, and power data; Consistency metrics examine the logical consistency of data within the data itself and with other data sources. They are used to identify logical contradictions in the electricity consumption between the master table and the sub-tables. Topology consistency metrics focus on whether the data conforms to the physical laws and connection relationships of the power grid.
7. A terminal device comprising a processor and a memory, the processor for implementing instructions; the memory for storing multiple instructions, characterized in that, The instructions are adapted to be loaded by a processor and executed by the automatic parameter adjustment method of the power distribution network data quality improvement algorithm according to any one of claims 1-5.
8. A computer-readable storage medium storing a plurality of instructions, characterized in that, The instructions are adapted to be loaded by the processor of the terminal device and executed by the automatic parameter adjustment method of the power distribution network data quality improvement algorithm according to any one of claims 1-5.
Citation Information
Patent Citations
Dynamic code generation method and system based on interface document
CN118860356A
Distribution network power supply multi-dimensional auxiliary decision analysis method and system based on machine learning
CN119514999A