Data-driven model error tracking and parameter local fine tuning method and system, and medium
By collecting high-dimensional data in the power system, eliminating outliers and using cosine similarity and output uncertainty values to perform local fine-tuning of model weights, the problem of traditional data-driven models in the power system is solved, and the continuous efficiency and accuracy of the model is achieved.
Patent Information
- Application Number
- CN202411763627.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-03-25
AI Technical Summary
In the power system, traditional data-driven models cannot quickly adapt to factors such as load changes, weather conditions and equipment aging, resulting in a decline in model performance, accumulation of prediction errors, and may even cause major operating problems.
A data-driven model error tracking and local parameter fine-tuning method is proposed. By collecting high-dimensional data of the power system, removing abnormal data points, using cosine similarity to trigger local fine-tuning of the model weight, and determining the error deviation layer based on the output uncertainty value for weight adjustment.
It effectively solves the problem of model prediction error accumulation in the power system, ensures that the model maintains high efficiency and accuracy in a complex and changeable operating environment, and provides reliable data support for the operation and management of the power system.
Smart Images

Figure CN119691645A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data-driven models, and in particular to a method, system and medium for data-driven model error tracking and local parameter fine-tuning. Background Art
[0002] Data-driven models refer to mathematical or statistical models that can describe system behavior or predict future trends, mainly through the analysis and learning of historical data. The characteristic of this type of model is that it relies on the data itself, rather than being based on the physical laws or prior knowledge of the system. Therefore, it is particularly suitable for complex, nonlinear systems that are difficult to describe through traditional physical modeling methods. Data-driven models have been widely used because they can handle complex nonlinear relationships, predict future trends, and optimize system performance.
[0003] In power systems, traditional data-driven model training is usually performed offline. This means that during the model building phase, the model is trained using historical data, and then the model remains fixed in actual applications. However, the operating environment of the power system is dynamically changing. For example, as factors such as weather, seasons, user demand, or equipment aging change, the system's load demand, equipment status, and power generation will also change. If a fixed model continues to be used, the performance of the model may deteriorate over time and may not accurately reflect the current system status. With the influence of factors such as changes in the load of the power system, changes in weather conditions, and aging of equipment, the operating data of the power system presents complex spatiotemporal variation characteristics. Traditional fixed models cannot quickly adapt to these changes, resulting in the accumulation of errors in system predictions and may even cause major operational problems. Summary of the invention
[0004] Based on this, it is necessary to propose a data-driven model error tracking and parameter local fine-tuning method, system and medium to address the above problems.
[0005] A data-driven model error tracking and parameter local fine-tuning method, the method comprising:
[0006] High-dimensional data in the power system is collected, each of the high-dimensional data is used as a data point, a data point set is obtained, abnormal data points in the data point set are eliminated, and non-abnormal data points are used as input data.
[0007] The data-driven model is triggered to perform local weight fine-tuning according to the comparison between the cosine similarity between the input data and the high-dimensional data and the cosine similarity threshold, and the update step size of the data-driven model is adjusted according to the cosine similarity.
[0008] The output uncertainty value of each layer is determined according to the weight of each layer in the data-driven model and the input data.
[0009] According to the comparison between the output uncertainty value of the current layer and the output uncertainty threshold, the layer is determined to be an error deviation layer.
[0010] The weights are locally fine-tuned according to the weights and update step size of the error bias layer.
[0011] The collecting of high-dimensional data in the power system, taking each high-dimensional data as a data point, obtaining a data point set, removing abnormal data points in the data point set, and taking non-abnormal data points as input data, specifically includes:
[0012] Collect high-dimensional data in the power system, take each high-dimensional data as a data point, and obtain a data point set;
[0013] Dividing each data point in the data point set until a maximum number of levels is reached, and determining a corresponding decision tree;
[0014] Determining anomaly scores of data points according to an average path length of the data points in the corresponding decision tree;
[0015] Performing preliminary screening based on the comparison between the abnormal score of the data point and the abnormal score threshold to obtain potential abnormal data points;
[0016] Determining a normalized anomaly score by normalized distance of the potential abnormal data point from the data mean;
[0017] Perform secondary screening based on the comparison between the standardized anomaly score and the standardized anomaly score threshold to obtain abnormal data points;
[0018] Abnormal data points in the data point set are eliminated, and non-abnormal data points are used as input data.
[0019] The step of performing preliminary screening based on the comparison between the abnormal score of the data point and the abnormal score threshold to obtain potential abnormal data points specifically includes:
[0020] Determine whether the data point anomaly score of the current data point is greater than the anomaly score threshold.
[0021] If the data point anomaly score is greater than the anomaly score threshold, the current data point is a potential anomaly data point.
[0022] If the data point anomaly score is less than or equal to the anomaly score threshold, the current data point is a non-potential anomaly data point.
[0023] The standardized anomaly score model is determined by the standardized distance between the potential abnormal data point and the data mean, and the standardized anomaly score model is:
[0024] in;
[0025] The current potential abnormal data point is input into the standardized abnormal score model to determine the standardized abnormal score of the current potential abnormal data point.
[0026] The second screening is performed based on the comparison between the standardized anomaly score and the standardized anomaly score threshold to obtain abnormal data points, specifically including:
[0027] Determine whether the normalized anomaly score of the current potential abnormal data point is greater than the normalized anomaly score threshold;
[0028] If the normalized anomaly score is greater than the normalized anomaly score threshold, the current potential data point is an abnormal data point;
[0029] If the normalized anomaly score is less than or equal to the normalized anomaly score threshold, the current potential data point is a non-anomalous data point.
[0030] The method of determining the data-driven model to perform local weight fine-tuning according to the comparison between the cosine similarity between the input data and the high-dimensional data and the cosine similarity threshold, and adjusting the update step size of the data-driven model according to the cosine similarity, specifically includes:
[0031] Determine whether the cosine similarity between the input data and the high-dimensional data is less than the cosine similarity threshold;
[0032] If the cosine similarity between the input data and the high-dimensional data is less than the cosine similarity threshold, the data-driven model is triggered to perform local weight fine-tuning, and the update step size of the data-driven model is adjusted according to the cosine similarity;
[0033] If the cosine similarity between the input data and the high-dimensional data is greater than or equal to the cosine similarity threshold, the data-driven model does not perform local weight fine-tuning.
[0034] The step of adjusting the update step of the data-driven model according to the cosine similarity specifically includes:
[0035] When the cosine similarity is equal to 1, the update step size of the data driven model is adjusted to a first preset update step size.
[0036] When the cosine similarity is less than 1, the update step size of the data driven model is adjusted to a second preset update step size.
[0037] The step of determining the output uncertainty value of each layer according to the weight of each layer in the data-driven model and the input data specifically includes:
[0038] The output corresponding to each layer is determined according to the weight of each layer in the data-driven model and the input data, and the output is: l =f(x l ;w l ), where f is the activation function of the current layer, o l is the output of the current layer, x l is the input data of the front layer of network layer l, w l is the weight of the current layer.
[0039] The output uncertainty value model is determined according to the output of each layer, and the output uncertainty value model is:
[0040]
[0041] in, is the output uncertainty value, is the variance of the posterior distribution, o l is the output of the current layer, x l is the input data of the front layer of network layer l, w l is the weight of the current layer.
[0042] Substitute the output of the current layer into the output uncertainty value model to obtain the output uncertainty value of the layer.
[0043] The step of determining that the layer is an error deviation layer according to the comparison between the output uncertainty value of the current layer and the output uncertainty threshold value specifically includes:
[0044] Determine whether the output uncertainty value of the current layer is greater than the output uncertainty threshold.
[0045] If the output uncertainty value of the current layer is greater than the output uncertainty threshold, the layer is determined to be an error deviation layer.
[0046] If the output uncertainty value of the current layer is less than or equal to the output uncertainty threshold, the layer is determined to be a non-error deviation layer.
[0047] The local fine-tuning of the weights according to the weights and update step size of the error deviation layer specifically includes:
[0048] The input data is clustered to determine the cluster category to which each of the non-abnormal data points belongs, and each of the cluster categories corresponds to a submodule of the data-driven model.
[0049] The module error function is defined by the gap between the predicted value and the true value of the non-abnormal data point in the submodule, and the predicted value of the non-abnormal data point is determined according to the weight of the error deviation layer.
[0050] The module loss function is subjected to gradient descent to determine the weight gradient of the error bias layer.
[0051] The weight of the submodule is updated through the weight gradient and update step size of the error bias layer to complete local weight fine-tuning.
[0052] The step of performing gradient descent on the module loss function to determine the weight gradient of the error bias layer specifically includes:
[0053] The gradient descent model is determined according to the predicted value of the non-abnormal data point, the weight of the error bias layer and the true value. The gradient descent model is: Where ω is the weight of the error bias layer, f(C i,t ; w) is the predicted value of the tth non-abnormal data point, y t is the true value, L(C i ) is the module loss function, is the weight gradient of the error bias layer.
[0054] The module loss function is gradient-decreased through the gradient descent model to determine the weight gradient of the error bias layer.
[0055] The weight gradient of the error bias layer and the update step size update submodule weights are used to complete the local weight fine-tuning, which specifically includes:
[0056] The submodule weight update model is determined by the weight gradient and update step size of the error deviation layer, and the submodule weight update model is: in, is the weight gradient of the error bias layer, w new is the updated weight of the submodule, w old is the weight of the submodule before updating, η is the update step length;
[0057] The weight gradient and update step size of the error deviation layer corresponding to the current non-abnormal data point are input into the submodule weight update model, and the weight of the submodule where the non-abnormal data point is located is updated to complete local weight fine-tuning.
[0058] A data-driven model error tracking and parameter local fine-tuning system, the system comprising:
[0059] The input data determination module is used to collect high-dimensional data in the power system, take each of the high-dimensional data as a data point, obtain a data point set, eliminate abnormal data points in the data point set, and take non-abnormal data points as input data.
[0060] The weight local fine-tuning trigger and update step adjustment module is used to trigger the data-driven model to perform local weight fine-tuning according to the comparison between the cosine similarity between the input data and the high-dimensional data and the cosine similarity threshold, and adjust the update step of the data-driven model according to the cosine similarity.
[0061] The output uncertainty value determination module is used to determine the output uncertainty value of each layer according to the weight of each layer in the data-driven model and the input data.
[0062] The error deviation layer determination module is used to determine that the layer is an error deviation layer according to the comparison between the output uncertainty value of the current layer and the output uncertainty threshold.
[0063] The weight local fine-tuning module is used to perform weight local fine-tuning according to the weight and update step size of the error deviation layer.
[0064] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the steps of the method described above.
[0065] The embodiments of the present invention have the following beneficial effects:
[0066] The present invention collects high-dimensional data in the power system and removes abnormal data points, reduces the impact of noise and errors on subsequent analysis, takes non-abnormal data points as input data, uses cosine similarity to measure the similarity between input data and high-dimensional data, triggers the data-driven model to perform local weight fine-tuning according to the comparison between the cosine similarity between the input data and the high-dimensional data and the cosine similarity threshold, and adjusts the update step of the data-driven model according to the cosine similarity. Further, the output uncertainty value of each layer is determined according to the weight and input data of each layer in the data-driven model, and the prediction uncertainty of the model at different levels can be quantified. According to the comparison between the output uncertainty value of the current layer and the output uncertainty threshold, the layer is determined to be the error deviation layer, and by estimating the uncertainty of the weights and outputs of each layer, the error deviation source of the model when switching scenes can be located online. After determining the error deviation layer, by locally fine-tuning the weights of these layers, the performance of the model is improved in a targeted manner, which can effectively solve the problem of model prediction error accumulation in the power system, and ensure that the model continues to maintain high efficiency and accuracy in the complex and changeable power system operation environment, thereby providing reliable data support for the operation and management of the power system. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0068] in:
[0069] Figure 1 A schematic flow chart of an embodiment of a method for data-driven model error tracking and local parameter fine-tuning provided by the present invention;
[0070] Figure 2 A schematic flow chart of another embodiment of a data-driven model error tracking and parameter local fine-tuning method provided by the present invention;
[0071] Figure 3 A schematic diagram of the structure of an embodiment of a data-driven model error tracking and parameter local fine-tuning system provided by the present invention;
[0072] Figure 4 A schematic structural diagram of an embodiment of the medium provided by the present invention. DETAILED DESCRIPTION
[0073] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0074] like Figure 1 As shown, Figure 1 A data-driven model error tracking and local parameter fine-tuning method is provided by the present invention. The method comprises:
[0075] S101: Collect high-dimensional data in the power system, take each high-dimensional data as a data point, obtain a data point set, remove abnormal data points in the data point set, and take non-abnormal data points as input data.
[0076] Exemplarily, high-dimensional data in the power system is collected, and each high-dimensional data is used as a data point to obtain a data point set. Assuming that the data point set X contains N data points (such as voltage, load and other characteristics), each data point in the data point set is divided using the isolation forest until the maximum number of levels is reached, and T decision trees are generated. The depth of each tree represents the degree to which each data point is isolated. After constructing T decision trees, the average path length of each data point on these trees is determined. Since abnormal data points are usually more easily "isolated", that is, their average path length is usually shorter, the data point abnormality score is determined by comparing the average path length of the data point with the average path length of the entire data set.
[0077] For each data point x i , the isolation forest outputs the data point anomaly score A(x i ):
[0078]
[0079] Among them, E(h(x i )) is x i The average path length of the data point A(x i ) is closer to 1, indicating that the data point is more likely to be an outlier.
[0080] Furthermore, we set the abnormal score threshold θ if , perform preliminary screening based on the comparison between the data point anomaly score and the anomaly score threshold to obtain potential anomaly data points. i )>θ if , then the data point may be abnormal in the operation of the power system, and the data point is a potential abnormal data point.
[0081] Furthermore, the potential abnormal data points screened out by the isolation forest need to be further tested for Z-score to ensure that the data is not only abnormal in structure, but also deviates from the normal value in value. Z-score detection determines its abnormality by calculating the standard deviation of the potential abnormal data point from the data mean, which is particularly suitable for fluctuating data such as load or voltage in the power system. The calculation formula of Z-score is:
[0082]
[0083] Among them, Z i is the standardized anomaly score, μ is the mean of normal data, and σ is the standard deviation of the data.
[0084] If | Z i |Exceeds the set normalized anomaly score threshold Z threshold, then the potential abnormal data point is considered an abnormal data point. For example, if the Z-score of a load data point exceeds the normal range (such as 3 standard deviations), it means that the load value of the data point deviates significantly from the normal range, which may affect the effect of data modeling.
[0085] Furthermore, abnormal data points in the data point set are eliminated, and non-abnormal data points are used as input data.
[0086] S102: triggering the data-driven model to perform local weight fine-tuning according to the comparison between the cosine similarity between the input data and the high-dimensional data and the cosine similarity threshold, and adjusting the update step size of the data-driven model according to the cosine similarity.
[0087] Exemplarily, it is determined whether the cosine similarity between the input data and the high-dimensional data is less than the cosine similarity threshold; if the cosine similarity between the input data and the high-dimensional data is less than the cosine similarity threshold, the data-driven model is triggered to perform local weight fine-tuning, and the update step size of the data-driven model is adjusted according to the cosine similarity; if the cosine similarity between the input data and the high-dimensional data is greater than or equal to the cosine similarity threshold, the data-driven model does not perform local weight fine-tuning.
[0088] When adjusting the update step size of the data-driven model according to the cosine similarity, when the cosine similarity is equal to 1, the update step size of the data-driven model is adjusted to the first preset update step size; when the cosine similarity is less than 1, the update step size of the data-driven model is adjusted to the second preset update step size.
[0089] S103: Determine the output uncertainty value of each layer according to the weight and input data of each layer in the data-driven model.
[0090] Exemplarily, the output corresponding to each layer is determined according to the weight and input data of each layer in the data-driven model, and the output is: l =f(x l ;w l ), where f is the activation function of the current layer, o l is the output of the current layer, x l is the input data, w l is the weight of the current layer;
[0091] The output uncertainty value model is determined according to the output of each layer. The output uncertainty value model is:
[0092]
[0093] in, is the output uncertainty value, is the variance of the posterior distribution, o l is the output of the current layer, xl is the input data of the front layer of network layer l, w l is the weight of the current layer;
[0094] Substitute the output of the current layer into the output uncertainty value model to obtain the output uncertainty value of the layer.
[0095] S104: According to the comparison between the output uncertainty value of the current layer and the output uncertainty threshold, the layer is determined to be an error deviation layer.
[0096] Exemplarily, it is determined whether the output uncertainty value of the current layer is greater than the output uncertainty threshold. If the output uncertainty value of the current layer is greater than the output uncertainty threshold, the layer is determined to be an error deviation layer; if the output uncertainty value of the current layer is less than or equal to the output uncertainty threshold, the layer is determined to be a non-error deviation layer.
[0097] S105: Perform local weight fine-tuning according to the weight and update step size of the error bias layer.
[0098] Exemplarily, the input data is clustered to determine the cluster category to which each non-abnormal data point belongs, and each cluster category corresponds to a submodule of the data-driven model; the module error function is defined by the gap between the predicted value and the true value of the non-abnormal data point in the submodule, and the predicted value of the non-abnormal data point is determined according to the weight of the error bias layer; the module loss function is gradient descent to determine the weight gradient of the error bias layer; the weight of the submodule is updated through the weight gradient and update step size of the error bias layer to complete local weight fine-tuning.
[0099] Furthermore, the gradient descent model is determined according to the predicted value of the non-abnormal data point, the weight of the error bias layer, and the true value. The gradient descent model is:
[0100]
[0101] Where ω is the weight of the error bias layer, f(C i,t ; w) is the predicted value of the tth non-abnormal data point, y t is the true value, L(C i ) is the module loss function, is the weight gradient of the error bias layer.
[0102] The module loss function is gradient-descented through the gradient descent model to determine the weight gradient of the error bias layer.
[0103] Furthermore, the submodule weight update model is determined by the weight gradient and update step size of the error bias layer. The submodule weight update model is:
[0104]
[0105] in, is the weight gradient of the error bias layer, is the weight after the submodule is updated, is the weight before the submodule is updated, η is the update step size, η∈(η small , η large ).
[0106] The weight gradient and update step size of the error deviation layer corresponding to the current non-abnormal data point are input into the sub-module weight update model, and the weight of the sub-module where the non-abnormal data point is located is updated to complete the local weight fine-tuning.
[0107] It can be seen from the above description that the present invention collects high-dimensional data in the power system and removes abnormal data points, reduces the impact of noise and errors on subsequent analysis, uses non-abnormal data points as input data, and uses cosine similarity to measure the similarity between input data and high-dimensional data. The data-driven model is triggered to perform local weight fine-tuning according to the comparison of the cosine similarity between the input data and the high-dimensional data and the cosine similarity threshold, and the update step size of the data-driven model is adjusted according to the cosine similarity. Further, the output uncertainty value of each layer is determined according to the weight and input data of each layer in the data-driven model, and the prediction uncertainty of the model at different levels can be quantified. According to the comparison of the output uncertainty value of the current layer with the output uncertainty threshold, the layer is determined to be the error deviation layer. By estimating the uncertainty of the weights and outputs of each layer, the source of the error deviation of the model when switching scenes can be located online. After determining the error deviation layer, by locally fine-tuning the weights of these layers, the performance of the model is improved in a targeted manner, which can effectively solve the problem of model prediction error accumulation in the power system, and ensure that the model continues to maintain high efficiency and accuracy in the complex and changeable power system operation environment, thereby providing reliable data support for the operation and management of the power system.
[0108] like Figure 2 As shown, Figure 2 A data-driven model error tracking and local parameter fine-tuning method provided by the present invention is a flow chart of another embodiment. A data-driven model error tracking and local parameter fine-tuning method, the method comprising:
[0109] S201: Collect high-dimensional data in the power system, take each high-dimensional data as a data point, and obtain a data point set.
[0110] Exemplarily, high-dimensional data in the power system is collected, each high-dimensional data is used as a data point, and a data point set is obtained. It is assumed that the data point set X contains N data points (such as voltage, load and other characteristics).
[0111] S202: Divide each data point in the data point set until a maximum number of levels is reached, and determine a corresponding decision tree.
[0112] Exemplarily, each data point in the data point set is divided using the isolation forest until the maximum number of levels is reached, generating T decision trees, and the depth of each tree represents the degree to which each data point is isolated.
[0113] S203: Determine the abnormal score of the data point according to the average path length of the data point in the corresponding decision tree.
[0114] Exemplarily, after constructing T decision trees, the average path length of each data point on these trees is determined. Since abnormal data points are usually easier to be "isolated", that is, their average path length is usually shorter, the data point abnormality score is determined by comparing the average path length of the data point with the average path length of the entire data set.
[0115] For each data point x i , the isolation forest outputs the data point anomaly score A(x i ):
[0116]
[0117] Among them, E(h(x i )) is x i The average path length of the data point A(x i ) is closer to 1, indicating that the data point is more likely to be an outlier.
[0118] S204: Determine whether the data point anomaly score of the current data point is greater than an anomaly score threshold.
[0119] S2041: If the data point anomaly score is greater than the anomaly score threshold, the current data point is a potential anomaly data point.
[0120] S2042: If the data point anomaly score is less than or equal to the anomaly score threshold, the current data point is a non-potential anomaly data point.
[0121] For example, the abnormal score threshold θ is set if , perform preliminary screening based on the comparison between the data point anomaly score and the anomaly score threshold to obtain potential anomaly data points. Determine whether the data point anomaly score of the current data point is greater than the anomaly score threshold. If the anomaly score A(x i )>θ if , then the data point may be abnormal in the operation of the power system, and the data point is a potential abnormal data point. If the data point abnormal score is less than or equal to the abnormal score threshold, the current data point is a non-potential abnormal data point.
[0122] S205: Determine a standardized anomaly score by the standardized distance between the potential abnormal data point and the data mean.
[0123] S206: Perform secondary screening based on the comparison between the standardized anomaly score and the standardized anomaly score threshold to obtain abnormal data points.
[0124] S207: Eliminate abnormal data points in the data point set and use non-abnormal data points as input data.
[0125] For example, the potential abnormal data points screened out by the isolation forest need to be further tested for Z-score to ensure that the data is not only abnormal in structure, but also deviates from the normal value in value. Z-score detection determines its abnormality by calculating the standard deviation of the potential abnormal data point from the data mean, which is particularly suitable for fluctuating data such as load or voltage in the power system. The calculation formula of Z-score is:
[0126]
[0127] Among them, μ is the mean of normal data and σ is the standard deviation of the data.
[0128] If | Z i |Exceeds the set threshold Z threshold , then the potential abnormal data point is considered an abnormal data point. For example, if the Z-score of a load data point exceeds the normal range (such as 3 standard deviations), it means that the load value of the data point deviates significantly from the normal range, which may affect the effect of data modeling.
[0129] Furthermore, the abnormal data points in the data point set are eliminated, and the non-abnormal data points are used as input data.
[0130] The present invention can effectively improve the validity of input data by combining the hybrid detection method of isolation forest and Z-score. Isolation forest quickly identifies structural anomalies by randomly dividing features and data subsets, while Z-score further refines the judgment of these potential anomalies through numerical detection. This method ensures that the model can eliminate the interference of invalid data when processing high-dimensional complex data, thereby providing reliable input for subsequent model optimization and error tracking.
[0131] S208: Determine whether the cosine similarity between the input data and the high-dimensional data is less than a cosine similarity threshold.
[0132] S2081: If the cosine similarity between the input data and the high-dimensional data is less than the cosine similarity threshold, the data-driven model is triggered to perform local weight fine-tuning, and the update step size of the data-driven model is adjusted according to the cosine similarity.
[0133] S2082: If the cosine similarity between the input data and the high-dimensional data is greater than or equal to the cosine similarity threshold, the data-driven model does not perform local weight fine-tuning.
[0134] S209: Determine the output uncertainty value of each layer according to the weight and input data of each layer in the data-driven model.
[0135] For example, when the power system switches to a new scenario, the weights or outputs of some model layers of the data-driven model may not adapt to the new data distribution, resulting in an increase in output error deviation. The advantage of Bayesian neural networks is that they can identify the part with the largest error deviation in the new scenario by estimating the uncertainty of the weights or outputs of each layer.
[0136] First, the output of each layer is determined according to the weight and input data of each layer in the data-driven model. The output is:
[0137] o l =f(x l ;w l );
[0138] Among them, f is the activation function of the current layer, o l is the output of the current layer, x l is the input data of the front layer of network layer l, w l is the weight of the current layer.
[0139] In a Bayesian neural network, the weight w l is modeled as a probability distribution rather than a definite value, usually assuming a normal distribution:
[0140]
[0141] Among them, μ l is the mean of the weights, is the standard deviation, which indicates the uncertainty of the weight.
[0142] When the system switches to a new scene, the existing weight w l The distribution of may no longer be suitable for the data distribution in the new scenario. Therefore, the weight distribution of each layer is recalculated through Bayesian inference, and the variance of the posterior distribution is used to calculate the weight distribution of each layer. To quantify uncertainty. For each layer output o l Output uncertainty value model, the output uncertainty value model is:
[0143]
[0144] in, is the output uncertainty value, is the variance of the posterior distribution, ol is the output of the current layer, x l is the input data of the front layer of network layer l, w l is the weight of the current layer.
[0145] Substitute the output of the current layer into the output uncertainty value model to obtain the output uncertainty value of the layer.
[0146] S210: Determine whether the output uncertainty value of the current layer is greater than the output uncertainty threshold.
[0147] S2101: If the output uncertainty value of the current layer is greater than the output uncertainty threshold, the layer is determined to be an error deviation layer.
[0148] S2102: If the output uncertainty value of the current layer is less than or equal to the output uncertainty threshold, the layer is determined to be a non-error deviation layer.
[0149] It should be noted that steps S208-S2082 are Figure 1 This has been discussed in detail in the implementation scenario shown and will not be repeated here.
[0150] S211: Cluster the input data to determine the cluster category to which each non-abnormal data point belongs, and each cluster category corresponds to a submodule of the data-driven model.
[0151] For example, the input data of the power system is first clustered using a Gaussian mixture model. The probability that each input data belongs to each cluster category is estimated by the expectation maximization (EM) algorithm, and the input data is finally divided into multiple cluster categories C1, C2, ..., C k , such as voltage fluctuation data, load data, etc. Each clustering category corresponds to a submodule of the data-driven model.
[0152] (1) Step E: Calculate each input data x t Belongs to a category C j , the posterior probability γ of j∈(1,2,…,k) ij :
[0153]
[0154] Among them, μ j is the mean of the input data, Σ k To sum k class samples, Σ j To sum j class samples, π j is the weight of the j-th class sample, π k is the k-th class sample weight,
[0155] (2) Step M: Maximize the log-likelihood function and update the model parameters (mean μj , the covariance matrix Σ j , weight π j ):
[0156]
[0157] Where T is the total time length, n is the total number of data slices,
[0158] By dividing the input data into multiple categories, the Gaussian mixture model can dynamically adjust the update intensity according to the similarity between each category of data and historical data, and fine-tune specific modules. This approach not only reduces the computational burden of global updates, but also can cope with changes in different scenarios in the power system.
[0159] S212: defining a module error function by the difference between the predicted value and the true value of the non-abnormal data point in the submodule, wherein the predicted value of the non-abnormal data point is determined according to the weight of the error deviation layer.
[0160] For example, for each submodule (such as a voltage submodule or a load submodule), the module error function L(C i ) can be defined as the gap between the predicted value of the module and the true value:
[0161]
[0162] Among them, f(C i,t ; w) represents the predicted value of the tth data point calculated based on the current weight ω of the error bias layer, y t is the true value.
[0163] Among them, the predicted value of the non-abnormal data point is determined according to the weight of the error bias layer.
[0164] S213: Perform gradient descent on the module loss function to determine the weight gradient of the error bias layer.
[0165] Exemplarily, a gradient descent model is determined according to the predicted value of the non-abnormal data point, the weight of the error bias layer, and the true value to update the weight of each sub-model. The gradient descent model is:
[0166]
[0167] Where ω is the weight of the error bias layer, f(C i,t ; w) is the predicted value of the tth non-abnormal data point, yt is the true value, L(C i ) is the module loss function, is the weight gradient of the error bias layer.
[0168] The module loss function is gradient-descented through the gradient descent model to determine the weight gradient of the error bias layer.
[0169] S214: Update the weight of the submodule through the weight gradient and update step size of the error bias layer to complete local weight fine-tuning.
[0170] Exemplarily, the submodule weight update model is determined by the weight gradient and update step size of the error bias layer, and the submodule weight update model is:
[0171]
[0172] in, is the weight gradient of the error bias layer, w new is the updated weight of the submodule, w old is the weight of the submodule before updating, η is the update step length, η∈(η small , η large ).
[0173] The weight gradient and update step size of the error deviation layer corresponding to the current non-abnormal data point are input into the submodule weight update model, and the weight of the submodule where the non-abnormal data point is located is updated to complete the local weight fine-tuning. Through this gradient descent update method, the model can perform local fine-tuning on specific categories of data while maintaining overall stability, ensuring that the model can dynamically adapt to data changes in different scenarios in the power system and enable the model to have continuous online learning capabilities.
[0174] like Figure 3 As shown, Figure 3 The present invention provides a data-driven model error tracking and parameter local fine-tuning system 10, which includes:
[0175] The input data determination module 11 is used to collect high-dimensional data in the power system, take each high-dimensional data as a data point, obtain a data point set, remove abnormal data points in the data point set, and take non-abnormal data points as input data.
[0176] The weight local fine-tuning triggering and update step adjustment module 12 is used to trigger the data-driven model to perform weight local fine-tuning according to the comparison between the cosine similarity between the input data and the high-dimensional data and the cosine similarity threshold, and adjust the update step of the data-driven model according to the cosine similarity.
[0177] The output uncertainty value determination module 13 is used to determine the output uncertainty value of each layer according to the weight and input data of each layer in the data-driven model.
[0178] The error deviation layer determination module 14 is used to determine that the layer is an error deviation layer according to the comparison between the output uncertainty value of the current layer and the output uncertainty threshold.
[0179] The weight local fine-tuning module 15 is used to perform weight local fine-tuning according to the weight and update step size of the error deviation layer.
[0180] Exemplarily, in the input data determination module 11, high-dimensional data in the power system is collected, and each high-dimensional data is used as a data point to obtain a data point set; each data point in the data point set is divided until the maximum number of levels is reached, and the corresponding decision tree is determined; the data point abnormality score is determined according to the average path length of the data point in the corresponding decision tree; preliminary screening is performed based on the comparison between the data point abnormality score and the abnormal score threshold to obtain potential abnormal data points; the standardized abnormal score is determined by the standardized distance between the potential abnormal data point and the data mean; secondary screening is performed based on the comparison between the standardized abnormal score and the standardized abnormal score threshold to obtain abnormal data points; the abnormal data points in the data point set are eliminated, and non-abnormal data points are used as input data. In the weight local fine-tuning trigger and update step adjustment module 12, it is determined whether the cosine similarity between the input data and the high-dimensional data is less than the cosine similarity threshold; if the cosine similarity between the input data and the high-dimensional data is less than the cosine similarity threshold, the data-driven model is triggered to perform local weight fine-tuning, and the update step of the data-driven model is adjusted according to the cosine similarity; if the cosine similarity between the input data and the high-dimensional data is greater than or equal to the cosine similarity threshold, the data-driven model does not perform local weight fine-tuning. In the output uncertainty value determination module 13, the output uncertainty value of each layer is determined according to the weight and input data of each layer in the data-driven model. In the error deviation layer determination module 14, it is determined whether the output uncertainty value of the current layer is greater than the output uncertainty threshold; if the output uncertainty value of the current layer is greater than the output uncertainty threshold, the layer is determined to be an error deviation layer; if the output uncertainty value of the current layer is less than or equal to the output uncertainty threshold, the layer is determined to be a non-error deviation layer. In the weight local fine-tuning module 15, the input data is clustered to determine the cluster category to which each non-abnormal data point belongs, and each cluster category corresponds to a submodule of the data-driven model; the module error function is defined by the gap between the predicted value and the true value of the non-abnormal data point in the submodule, and the predicted value of the non-abnormal data point is determined according to the weight of the error bias layer; the module loss function is gradient descended to determine the weight gradient of the error bias layer; the weight of the submodule is updated through the weight gradient and update step size of the error bias layer to complete the weight local fine-tuning.
[0181] like Figure 4 As shown, Figure 4The structure diagram of an embodiment of the medium provided by the present invention is shown in FIG. The medium 20 stores at least one computer program 21, which is executed by a processor to implement the following Figure 1 , Figure 2 In one embodiment, the medium 20 may be a storage chip, a hard disk, a mobile hard disk, a USB flash drive, an optical disk, or other readable and writable storage tools, or a server, etc.
[0182] The above describes specific embodiments of the present specification, and other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily have to be performed in the specific order or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0183] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, equipment, and non-volatile computer-readable storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0184] The apparatus, device, non-volatile computer-readable storage medium and method provided in the embodiments of this specification correspond to each other, and therefore, the apparatus, device, and non-volatile computer storage medium also have similar beneficial technical effects as the corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the corresponding apparatus, device, and non-volatile computer storage medium will not be repeated here.
[0185] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0186] For the convenience of description, the above device is described by being divided into various units according to their functions and described separately. Of course, when implementing this specification, the functions of each unit can be implemented in one or more software and / or hardware. It should be understood by those skilled in the art that this specification embodiment can be provided as a method, system, or computer program product. Therefore, this specification embodiment can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this specification embodiment can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0187] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0188] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0189] The above disclosure is only the preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.
Claims
1. A data-driven model error tracking and parameter local fine-tuning method, characterized in that: The method comprises: Collect high-dimensional data in the power system, use each high-dimensional data as a data point, obtain a data point set, remove abnormal data points in the data point set, and use non-abnormal data points as input data; Triggering the data-driven model to perform local weight fine-tuning according to the comparison of the cosine similarity between the input data and the high-dimensional data and the cosine similarity threshold, and adjusting the update step size of the data-driven model according to the cosine similarity; Determine an output uncertainty value of each layer according to the weight of each layer in the data-driven model and the input data; According to the comparison between the output uncertainty value of the current layer and the output uncertainty threshold, determining that the layer is an error deviation layer; The weights are locally fine-tuned according to the weights and update step size of the error bias layer.
2. The data-driven model error tracking and parameter local fine-tuning method according to claim 1, characterized in that: The collecting of high-dimensional data in the power system, taking each high-dimensional data as a data point, obtaining a data point set, removing abnormal data points in the data point set, and taking non-abnormal data points as input data specifically includes: Collect high-dimensional data in the power system, take each high-dimensional data as a data point, and obtain a data point set; Dividing each data point in the data point set until a maximum number of levels is reached, and determining a corresponding decision tree; Determining anomaly scores of data points according to an average path length of the data points in the corresponding decision tree; Performing preliminary screening based on the comparison between the abnormal score of the data point and the abnormal score threshold to obtain potential abnormal data points; Determining a normalized anomaly score by normalized distance of the potential abnormal data point from the data mean; Perform secondary screening based on the comparison between the standardized anomaly score and the standardized anomaly score threshold to obtain abnormal data points; Abnormal data points in the data point set are eliminated, and non-abnormal data points are used as input data.
3. The data-driven model error tracking and parameter local fine-tuning method according to claim 2, characterized in that: The preliminary screening is performed based on the comparison between the abnormal score of the data point and the abnormal score threshold to obtain potential abnormal data points, specifically including: Determine whether the data point anomaly score of the current data point is greater than the anomaly score threshold; If the data point anomaly score is greater than the anomaly score threshold, the current data point is a potential anomaly data point; If the data point anomaly score is less than or equal to the anomaly score threshold, the current data point is a non-potential anomaly data point.
4. The data-driven model error tracking and parameter local fine-tuning method according to claim 3 is characterized in that: The obtaining of abnormal data points by using the standardized distance between the potential abnormal data points and the data mean specifically includes: The standardized anomaly score model is determined by the standardized distance between the potential abnormal data point and the data mean, and the standardized anomaly score model is: in; The current potential abnormal data point is input into the standardized abnormal score model to determine the standardized abnormal score of the current potential abnormal data point.
5. The data-driven model error tracking and parameter local fine-tuning method according to claim 4, characterized in that: The performing secondary screening according to the comparison between the standardized anomaly score and the standardized anomaly score threshold to obtain the abnormal data point specifically includes: Determine whether the normalized anomaly score of the current potential abnormal data point is greater than the normalized anomaly score threshold; If the normalized anomaly score is greater than the normalized anomaly score threshold, the current potential data point is an abnormal data point; If the normalized anomaly score is less than or equal to the normalized anomaly score threshold, the current potential data point is a non-anomalous data point.
6. The data-driven model error tracking and parameter local fine-tuning method according to claim 2, characterized in that: The method of determining the data-driven model to perform local weight fine-tuning according to the comparison between the cosine similarity between the input data and the high-dimensional data and the cosine similarity threshold, and adjusting the update step size of the data-driven model according to the cosine similarity, specifically includes: Determine whether the cosine similarity between the input data and the high-dimensional data is less than the cosine similarity threshold; If the cosine similarity between the input data and the high-dimensional data is less than the cosine similarity threshold, the data-driven model is triggered to perform local weight fine-tuning, and the update step size of the data-driven model is adjusted according to the cosine similarity; If the cosine similarity between the input data and the high-dimensional data is greater than or equal to the cosine similarity threshold, the data-driven model does not perform local weight fine-tuning.
7. The data-driven model error tracking and parameter local fine-tuning method according to claim 6, characterized in that: The step of adjusting the update step of the data-driven model according to the cosine similarity specifically includes: When the cosine similarity is equal to 1, adjusting the update step size of the data-driven model to a first preset update step size; When the cosine similarity is less than 1, the update step size of the data driven model is adjusted to a second preset update step size.
8. The data-driven model error tracking and parameter local fine-tuning method according to claim 2, characterized in that: Determining the output uncertainty value of each layer according to the weight of each layer in the data-driven model and the input data specifically includes: The output corresponding to each layer is determined according to the weight of each layer in the data-driven model and the input data, and the output is: l =f(x l ;w l ), where f is the activation function of the current layer, o l is the output of the current layer, x l is the input data of the front layer of network layer l, w l is the weight of the current layer; The output uncertainty value model is determined according to the output of each layer, and the output uncertainty value model is: in, is the output uncertainty value, is the variance of the posterior distribution, o l is the output of the current layer, x l is the input data of the front layer of network layer l, w l is the weight of the current layer; Substitute the output of the current layer into the output uncertainty value model to obtain the output uncertainty value of the layer.
9. The data-driven model error tracking and parameter local fine-tuning method according to claim 8, characterized in that: The step of determining that the layer is an error deviation layer according to a comparison between the output uncertainty value of the current layer and the output uncertainty threshold value specifically includes: Determine whether the output uncertainty value of the current layer is greater than the output uncertainty threshold; If the output uncertainty value of the current layer is greater than the output uncertainty threshold, the layer is determined to be an error deviation layer; If the output uncertainty value of the current layer is less than or equal to the output uncertainty threshold, the layer is determined to be a non-error deviation layer.
10. The data-driven model error tracking and parameter local fine-tuning method according to claim 9, characterized in that: The local fine-tuning of weights according to the weights and update steps of the error deviation layer specifically includes: Clustering the input data to determine the cluster category to which each of the non-abnormal data points belongs, each of the cluster categories corresponding to a submodule of the data-driven model; A module error function is defined by the difference between the predicted value and the true value of the non-abnormal data point in the submodule, and the predicted value of the non-abnormal data point is determined according to the weight of the error deviation layer; Performing gradient descent on the module loss function to determine the weight gradient of the error bias layer; The weight of the submodule is updated through the weight gradient and update step size of the error bias layer to complete local weight fine-tuning.
11. The data-driven model error tracking and parameter local fine-tuning method according to claim 10, characterized in that: The step of performing gradient descent on the module loss function to determine the weight gradient of the error bias layer specifically includes: The gradient descent model is determined according to the predicted value of the non-abnormal data point, the weight of the error bias layer and the true value. The gradient descent model is: Where ω is the weight of the error bias layer, f(C i,t ; w) is the predicted value of the tth non-abnormal data point, y t is the true value, L(C i ) is the module loss function, is the weight gradient of the error bias layer; The module loss function is gradient-decreased through the gradient descent model to determine the weight gradient of the error bias layer.
12. The data-driven model error tracking and parameter local fine-tuning method according to claim 11, characterized in that: The weight gradient and update step size of the error bias layer are used to update the weight of the submodule to complete the local weight fine-tuning, which specifically includes: The submodule weight update model is determined by the weight gradient and update step size of the error deviation layer, and the submodule weight update model is: in, is the weight gradient of the error bias layer, w new is the updated weight of the submodule, w old is the weight of the submodule before updating, η is the update step length; The weight gradient and update step size of the error deviation layer corresponding to the current non-abnormal data point are input into the submodule weight update model, and the weight of the submodule where the non-abnormal data point is located is updated to complete local weight fine-tuning.
13. A data-driven model error tracking and parameter local fine-tuning system, characterized in that: The system comprises: An input data determination module is used to collect high-dimensional data in the power system, take each high-dimensional data as a data point, obtain a data point set, remove abnormal data points in the data point set, and take non-abnormal data points as input data; A weight local fine-tuning trigger and update step adjustment module, used to trigger the data-driven model to perform weight local fine-tuning according to the comparison between the cosine similarity between the input data and the high-dimensional data and the cosine similarity threshold, and adjust the update step of the data-driven model according to the cosine similarity; An output uncertainty value determination module, used to determine the output uncertainty value of each layer according to the weight of each layer in the data-driven model and the input data; An error deviation layer determination module, used to determine that the layer is an error deviation layer according to a comparison between the output uncertainty value of the current layer and the output uncertainty threshold; The weight local fine-tuning module is used to perform weight local fine-tuning according to the weight and update step size of the error deviation layer.
14. A computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the processor is caused to perform the steps of the method according to any one of claims 1 to 12.