Construction method and device for obtaining power data processing model and computer program product
Through federated learning technology, the acquisition of power data processing model is built in power data evaluation, which solves the problems of data privacy leakage and data silos, realizes the secure sharing of data and efficient optimization of models, and makes full use of the value of power data.
Patent Information
- Application Number
- CN202510252339.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-05
- Publication Date
- 2025-06-27
AI Technical Summary
The existing power data evaluation methods have the risk of data privacy leakage and data islands, making it difficult to effectively integrate and share data.
Using federated learning technology, a power data processing model is built through local training of the client and encryption aggregation on the server side. The client pre-trains the initial model according to the indicator system, and uses the encrypted model parameters distributed by the server to train locally before uploading the updated value. The server receives and aggregates the model update values of each client, allocates and encrypts the new model parameters to the client according to the contribution degree until the model error is less than the preset threshold.
It realizes the security of data during transmission and processing, avoids the risk of data leakage, breaks data silos, realizes data sharing and collaboration, improves the accuracy and reliability of the model, and fully explores and utilizes the value of power data.
Smart Images

Figure CN120218711A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of power systems, and particularly to a construction method, device, and computer program product for obtaining a power data processing model. Background Art
[0002] In the World Bank's Doing Business evaluation indicator system, "Getting Electricity" records all the procedures that an enterprise must go through to obtain a permanent electricity connection for a standardized warehouse, including applying to the electricity enterprise and signing a contract, going through all necessary inspections and approval procedures from the electricity enterprise and other institutions, and external and final connection operations. In the power industry, the accurate assessment of the getting electricity indicators for each region is a key link in optimizing the allocation of power resources and improving service quality. Traditional assessment methods mostly rely on the centralized collection and unified processing mode of data. However, this mode exposes two major drawbacks in practical applications: one is the high risk of data privacy leakage, and the centralized storage and processing of a large amount of sensitive information are extremely vulnerable to data leakage; the other is the serious phenomenon of data islands. Since the data is in the hands of multiple different institutions or departments, it is difficult to achieve cross-domain sharing, resulting in incomplete assessment data and limited accuracy of assessment results.
[0003] With the increasing diversification of the sources of getting electricity data and the continuous enhancement of data privacy protection awareness, the power industry urgently needs a new assessment method that can both protect data privacy and effectively integrate multi-party data resources. In this context, federated learning technology has emerged as a highly potential solution. As an emerging artificial intelligence technology, the core of federated learning is that it can achieve the collaborative training and learning of multi-party data without the data leaving the domain, effectively solving the two major problems of data privacy protection and data islands. However, although federated learning has significant advantages in data privacy protection and data sharing, its application in the field of power indicator assessment is still in the initial exploration stage and requires further in-depth research and practical verification. Summary of the Invention
[0004] The technical problem to be solved by the embodiments of the present invention is to provide a construction method, device, and computer program product for obtaining a power data processing model, so as to improve the security of power data processing, break data islands at the same time, and maximize the value of power data.
[0005] To solve the above technical problem, the present invention provides a construction method for obtaining a power data processing model, including the following steps:
[0006] Step S1, collect and calculate the data required for obtaining power indicators, and establish an evaluation index system for getting electricity;
[0007] Step S2, the client pre-trains the initial model according to the metric system, and uploads the updated value after local training using the encrypted model parameters distributed by the server;
[0008] Step S3, the server receives and aggregates the model update values of each client, and allocates and encrypts and sends new model parameters to the client according to the contribution degree;
[0009] Step S4, repeatedly execute the client pre-training and local training steps and the server model aggregation and update steps until the model error is less than the preset threshold;
[0010] Step S5, each client uploads the model weights and biases after iterative training to the server, and the server decrypts the received model weights and biases to obtain the finally trained power data processing model.
[0011] Preferably, the obtained power metrics include: obtained power connection time metric, power connection service cost metric, power supply reliability metric, and electricity bill transparency metric.
[0012] Preferably, the specific steps of step S2 include:
[0013] The client calculates the metric scores according to the obtained power evaluation metric system and pre-trains the initial model;
[0014] The client receives the encrypted model weights and biases generated and distributed by the server;
[0015] The client uses the received encrypted model weights and biases, combines with local data for local training, and obtains the updated model weights and biases.
[0016] Preferably, the server initializes the weights and biases using the Xavier initialization method, encrypts them and distributes them to each client; the client obtains the updated model weights and biases, also calculates the local training dataset size, and then sends the updated model weights and biases and the local training data size to the server.
[0017] Preferably, the specific steps of step S3 include:
[0018] The server receives the updated values of the model weights and biases after local training uploaded by each client and the local training data size;
[0019] The server aggregates according to the model parameter update values uploaded by each client to obtain new model weights and biases;
[0020] The server calculates the number of model weight and bias update values allocated to each client according to the contribution degree, and encrypts and sends the corresponding number of weight and bias update values to the client.
[0021] Preferably, after the server encrypts and sends the corresponding number of weight and bias update values to the client, the client downloads the allocated weight and bias update values to obtain the finally updated model of this round.
[0022] Preferably, the server uses the CKKS encryption algorithm to generate a public key and a private key.
[0023] The present invention also provides a construction device for obtaining a power data processing model, including:
[0024] A data collection module, configured to collect data required for calculating power indicators and establish a power evaluation index system;
[0025] A model training module, configured to pre-train an initial model according to the index system on the client side, and perform local training using the encrypted model parameters distributed by the server and then upload the update values;
[0026] An aggregation update module, configured to receive and aggregate the model update values of each client on the server side, allocate and encrypt new model parameters according to the contribution degree and send them to the client;
[0027] An iterative training module, configured to repeatedly execute the client pre-training and local training steps and the server-side model aggregation and update steps until the model error is less than a preset threshold;
[0028] A decryption module, configured to decrypt the received model weights and biases on the server side after each client uploads the model weights and biases after iterative training to the server side to obtain the finally trained power data processing model.
[0029] The present invention also provides a construction device for obtaining a power data processing model, including:
[0030] One or more processors;
[0031] A memory;
[0032] One or more applications, wherein the one or more applications are stored in the memory and are configured to be executed by the one or more processors, and the one or more applications are configured to execute the construction method of the power data processing model described above.
[0033] The present invention also provides a computer program product, including computer instructions, and the computer instructions direct a computer device to perform the operations corresponding to the method.
[0034] Implementing the present invention has the following beneficial effects: Through local training on the client side and encrypted aggregation on the server side, the present invention ensures the security of data during transmission and processing, avoiding the risk of data leakage. At the same time, the present invention breaks data silos, enabling the aggregation and utilization of power data scattered across various clients, realizing data sharing and collaboration. Through the iterative training process, the model parameters are continuously optimized, improving the accuracy and reliability of the model. The power data processing model constructed by the present invention can fully exploit and utilize the value of power data, providing strong support for decision-making and optimization in the power industry, maximizing the value of obtained power data, and having broad application prospects and important practical significance. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0036] Figure 1 It is a schematic flowchart of a method for constructing a power data processing model according to Embodiment 1 of the present invention.
[0037] Figure 2 It is a schematic diagram of the composition of the "obtained power" index system in the embodiments of the present invention.
[0038] Figure 3 It is a schematic flowchart of the federated learning process in the embodiments of the present invention.
[0039] Figure 4 It is a schematic diagram of the federated learning incentive mechanism based on model fairness in the embodiments of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0040] The following descriptions of the embodiments refer to the drawings to illustrate specific embodiments in which the present invention can be implemented.
[0041] Please refer to Figure 1 As shown, Embodiment 1 of the present invention provides a method for constructing a power data processing model, including the following steps:
[0042] Step S1, collect the data required for calculating the obtained power index, and establish an obtained power evaluation index system;
[0043] Step S2, the client pre-trains the initial model according to the index system, and uploads the updated value after local training using the encrypted model parameters distributed by the server;
[0044] Step S3, the server receives and aggregates the model update values of each client, and allocates and encrypts the new model parameters according to the contribution degree and sends them to the client;
[0045] Step S4, repeatedly execute the client pre-training and local training steps and the server model aggregation and update steps until the model error is less than the preset threshold;
[0046] Step S5, each client uploads the model weights and biases after iterative training to the server, and the server decrypts the received model weights and biases to obtain the finally trained power data processing model.
[0047] Specifically, please combine Figure 2 As shown, the data required for calculating the power indicators collected in the embodiments of the present invention include: the time of obtaining power connection (low-voltage area) T l , the time of obtaining power connection (high-voltage area) T h , the total annual electricity bill E of power users with a usage voltage of 10 KV and a load capacity of 180 KVA, the total annual disposable income R of residents in this area, the total number of electricity users N of customers in this area within a quarter, the number of power outage users n of customers in this area within a quarter, the power outage duration t of customers in this area within a quarter, the loss LossF caused by power outage of companies with female ownership, the loss LossM caused by power outage of companies without female ownership, and the three standard evaluations θ of electricity bill transparency j . The following will be specifically described separately.
[0048] (1) Obtaining power connection time index
[0049] The score of the power connection time index is divided into two parts: the low-voltage area and the high-voltage area according to the voltage level: the power access score P l of low-voltage (below 1 KV) users and the power access score P h of high-voltage (above 1 KV) users.
[0050] The time of obtaining power connection in the low-voltage area (i.e., the time from completing and submitting the application to connection supply) = T l , and the optimal time for obtaining power connection is set to T lg = 1 (day), and the longest limit time for obtaining power connection is T lb = 7 (days).
[0051] P l Calculation formula:
[0052]
[0053] The time of obtaining power connection in the high-voltage area (i.e., the time from completing and submitting the application to connection supply) = T h, set the optimal time to obtain a power connection as T hg = 3 (days), and the maximum limit time to obtain a power connection is T hb = 17 (days).
[0054] P h Calculation formula:
[0055]
[0056] Then the index score P for the power connection time a = P l + P h .
[0057] (2) Power connection service cost index
[0058] The score P of the power connection service cost index b :
[0059]
[0060] In the formula, E represents the annual total electricity bill of power users with a usage voltage of 10 KV and a load capacity of 180 KVA, R represents the annual total disposable income of residents in this area, and F represents the power connection service cost coefficient, which is used to evaluate the power connection service cost level in this area.
[0061] (3) Power supply reliability index
[0062] The power supply reliability is evaluated from three aspects: the average customer outage time, the average customer outage frequency, and the losses caused by outages.
[0063] The calculation method of the average customer outage time score P1 is as follows:
[0064] The average customer outage time SAIDI (hours / customer) in this area within a quarter
[0065]
[0066] In the formula, N is the total number of electricity users, n is the number of outage users, and t is the outage duration.
[0067] Set the optimal average customer outage time SAIDI_g = 0 within a quarter, and the worst average customer outage time SAIDI_b = 0.7 within a quarter.
[0068]
[0069] The calculation method of the average customer outage frequency score P2 is as follows:
[0070] The average customer outage frequency SAIFI (times) in this area within a quarter
[0071]
[0072] Wherein, N is the total number of electricity users, and n is the number of power outage users.
[0073] Set the average customer interruption frequency SAIFI_g = 0 within the optimal quarter, and the average customer interruption frequency SAIFI_b = 0.1 within the worst quarter.
[0074]
[0075] Calculation method of the loss score P3 caused by power outage:
[0076]
[0077] Set the minimum percentage of power outage loss in the total sales amount = 0, and the maximum percentage of power outage loss in the total sales amount = 1.3.
[0078]
[0079] P3 = P F +P M
[0080] Wherein, Sales is the total quarterly sales amount (in ten thousand yuan) of a company in this region.
[0081] The final score P of this index c = P1 + P2 + P3.
[0082] (4) Electricity charge transparency index
[0083] The electricity charge transparency index includes the following three criteria:
[0084] a. The current electricity price in this region can be obtained on the official website of the public utility or regulatory agency
[0085] b. The change in electricity price is notified to the public at least one billing cycle in advance (the notification forms include but are not limited to letters, bills, emails, SMS, and the notification channels include but are not limited to being published in the media, regulations or websites)
[0086] c. The formula for calculating the final electricity charge level of users is publicly available (the formula public methods include but are not limited to being published online and in customer bills)
[0087] If any one of the above criteria is met, get P d1 points;
[0088] If any two of the above criteria are met, get P d2 points;
[0089] Meeting three of the above criteria earns P d3 points.
[0090] Score for this indicator:
[0091]
[0092] According to the power acquisition evaluation indicators of the present invention described above, the data to be collected is divided into questionnaire type and numerical type.
[0093] (1) Questionnaire type data
[0094] For the electricity bill transparency indicator in the power acquisition evaluation indicator system used in the present invention, a questionnaire needs to be sent to the power company to collect the satisfaction of the corresponding standards. When filling out the questionnaire, attach the supporting materials for meeting the corresponding standards. After verification, if the standard is met, the judgment data θ j (j represents the jth standard of the ith indicator) value is 1; otherwise, θ j is 0.
[0095] (2) Numerical type data
[0096] In the power connection time indicator for power acquisition, T l represents the time for power connection of users with access voltage below 10KV (i.e., the time from completing and submitting the application to connection and supply), and T n represents the time for power connection of users with access voltage above 10KV (i.e., the time from completing and submitting the application to connection and supply). Both of these data are provided by power users.
[0097] In the power connection cost indicator, E represents the annual total electricity bill of power users with a usage voltage of 10KV and a load capacity of 180KVA, which should be provided by power users. R represents the annual total disposable income of residents in this area, which can be collected from the public information of the corresponding regional statistics bureau.
[0098] In the power supply reliability indicator, the total number of electricity users N, the number of power outage users n, the power outage duration t, the loss Loss F / M caused by power outage, and the total sales amount Sales of a certain company in this area in this quarter can all be collected on the official website of the power company.
[0099] In step S2, the client calculates the scores of the four indicators according to the power acquisition indicator evaluation system, and the client pre-trains the model based on its own data.
[0100] Power companies and other clients all have the relevant data required to calculate power indicators and the BP neural network model sent by the server. The client uses its own dataset to train the BP neural network model. The inputs to the BP neural network are the time to obtain power connection (low-voltage area) T l and the time to obtain power connection (high-voltage area) T h 、the annual total electricity bill E of power users with a usage voltage of 10 KV and a load capacity of 180 KVA, the annual total disposable income R of residents in this area, the total number N of electricity users of customers in this area within a quarter, the number n of power outage users of customers in this area within a quarter, the power outage duration t of customers in this area within a quarter, the loss LossF caused by power outage for companies with female ownership, the loss LossM caused by power outage for companies without female ownership, and three standard evaluations θ of electricity bill transparency j ; The output of the BP neural network model is the scores of four power acquisition indicators.
[0101] The training process is as follows:
[0102] Step S21, initialize weights and biases using Xavier: Assign initial values to the weights of each connection and the biases of each neuron.
[0103] Determine the initialization range of weights based on the analysis of signal variances during the forward and backward propagation processes in the neural network. The weight ω ij has an initialization range of:
[0104]
[0105] where, n in is the number of input neurons, and n out is the number of output neurons; Biases are usually initialized to 0.
[0106] Step S22, forward propagation: Pass the input samples through the neural network and calculate the outputs of neurons layer by layer. For each neuron, multiply the outputs of the previous layer of neurons by the corresponding weights, sum the results, and then obtain the output of the current neuron through the activation function Tanh(x).
[0107]
[0108] In the formula, x is the input value of the BP neural network model, and e is the natural constant.
[0109] Step S23, calculate the error: Compare the output of the neural network with the actual labels and calculate the mean square error (MSE).
[0110]
[0111] Where n is the number of samples, and y i is the true value of the i-th sample, and
[0112] Step S24, Backpropagation: Calculate the gradient of each weight according to the error value through the chain rule, and update the weights and biases using the gradient descent algorithm. Specifically, it includes:
[0113] Step S241, Calculate the gradient of the loss function with respect to the weights of the output layer:
[0114] Use the mean squared error (MSE) as the loss function, that is:
[0115]
[0116] The predicted value and the input of the neurons in the output layer (L represents the output layer) are related as
[0117]
[0118] First, calculate the partial derivative of the loss function with respect to the predicted value :
[0119]
[0120] Then, calculate the partial derivative of the predicted value with respect to the input of the neurons in the output layer :
[0121]
[0122] where tanh′ is the derivative of the activation function;
[0123] Finally, calculate the partial derivative of the input of the neurons in the output layer with respect to the weights of the output layer (j represents the serial number of the neurons in the previous layer, and k represents the serial number of the neurons in the output layer) ( is the output of the j-th neuron in the previous layer).
[0124] According to the chain rule, the gradient of the loss function with respect to the weights of the output layer is:
[0125]
[0126] Step S242, Calculate the gradient of the loss function with respect to the weights of the hidden layer (calculate sequentially from the j-th hidden layer to the 1st hidden layer):
[0127] a. Calculate the partial derivative of the loss function with respect to the output of the hidden layer neurons (taking the last hidden layer as an example)
[0128] First, calculate the partial derivative of the loss function with respect to the output of the k-th neuron in the j-th hidden layer :
[0129]
[0130] In the formula, is the weight vector connecting the output layer to the k-th neuron in the j-th hidden layer, is the output of the k-th neuron in the j-th hidden layer.
[0131] b. Calculate the partial derivative of the output of the hidden layer neurons with respect to the input of the hidden layer neurons (taking the last hidden layer as an example)
[0132] The relationship between the output of the neurons in the j-th hidden layer and the input of the neurons in the j-th hidden layer is:
[0133]
[0134] Then the partial derivative of the output of the neurons in the j-th hidden layer with respect to the input of the neurons in the j-th hidden layer is:
[0135]
[0136] c. Calculate the partial derivative of the input of the hidden layer neurons with respect to the weights of the hidden layer (taking the last hidden layer as an example)
[0137] The relationship between the input of the neurons in the j-th hidden layer, the output of the neurons in the previous layer (the (j - 1)-th hidden layer), and the weights (l represents the serial number of the neurons in the previous layer, k represents the serial number of the neurons in the hidden layer) of the j-th hidden layer is:
[0138]
[0139] Then the partial derivative of the input of the neurons in the j-th hidden layer with respect to the weights of the hidden layer is:
[0140]
[0141] d. Calculate the gradient of the weights of the j-th hidden layer
[0142] According to the chain rule, the gradient of the loss function with respect to the weights of the j-th hidden layer is:
[0143]
[0144] e. Calculate the gradients of the weights of other hidden layers in sequence (from the (j - 1)-th layer to the 1st layer).
[0145] For the p-th hidden layer (1 ≤ p ≤ j - 1), first calculate the partial derivative of the loss function with respect to the output of the neurons in the p-th hidden layer :
[0146]
[0147] In the formula,
[0148] Then calculate the partial derivative of the output of the neurons in the p-th hidden layer with respect to the input of the neurons in the p-th hidden layer :
[0149]
[0150] Next, calculate the partial derivative of the input of the neurons in the p-th hidden layer with respect to the weights of the p-th hidden layer :
[0151]
[0152] Finally, calculate the gradient of the loss function with respect to the weights of the p-th hidden layer according to the chain rule:
[0153]
[0154] Step S243, update the weights and biases using the gradient descent algorithm:
[0155] 1) Update of weights
[0156] a. Update formula for the weights of the output layer:
[0157]
[0158] In the formula, is the updated weight of the output layer, is the weight of the output layer before update, and α is the learning rate.
[0159] b. Update formula for the weights of the hidden layer:
[0160]
[0161] In the formula, is the updated weight of the hidden layer, is the weight of the hidden layer before update, and α is the learning rate.
[0162] 2) Bias update formula:
[0163] a. The calculation of the output layer bias gradient is similar to that of the weights. First, calculate the partial derivative of the loss function with respect to the bias:
[0164]
[0165] In the formula, is the output layer bias.
[0166] Output layer bias update formula:
[0167]
[0168] In the formula, is the updated output layer bias, is the output layer bias before update, and α is the learning rate.
[0169] b. For the hidden layer bias, first calculate the partial derivative of the loss function with respect to the hidden layer bias in the same way:
[0170]
[0171] In the formula, is the output layer bias.
[0172] Hidden layer bias update formula:
[0173]
[0174] In the formula, is the updated hidden layer bias, is the hidden layer bias before update, and α is the learning rate.
[0175] Step S25: Repeat steps S22 - S24 until the convergence condition (error is less than the threshold) is reached.
[0176] Please also combine with Figure 3 、 Figure 4 As shown, the present invention constructs an incentive mechanism based on model fairness to improve the effect of federated learning. In the federated incentive mechanism based on model fairness, all clients are data owners. By evaluating the contribution degree of each party, different performance models are allocated to the clients according to the contribution degree. The measurement of the contribution degree comprehensively considers factors such as the quantity and category of data owned by the clients; after aggregating the global model at the server side, the updated values of the model parameters are allocated to the clients from large to small according to the proportion of the contribution degree, and the clients with a high contribution degree can obtain more model parameters to update the local model.
[0177] The BP neural network is a neural network model with forward information transmission and backward error transmission. Its structure includes an input layer, a hidden layer, and an output layer. The input layer receives training samples, and then the data enters the hidden layer for processing and is transmitted to the output layer. If there is an error between the actual output value and the theoretical value, it will enter the stage of backward error propagation. In this stage, the error of the output signal starts from the hidden layer and propagates backward along the original channel back to the input layer. The error information of each layer is transmitted to the neurons of their respective layers, and each neuron adjusts its connection weights according to the received error information with the aim of reducing the error. This process is repeated continuously, and the neural network adjusts the weights and thresholds in this way until the error is reduced to the preset range or the preset number of training times is reached.
[0178] (1) Contribution measurement method
[0179] The contribution measurement method adopts the direct evaluation method. According to factors such as the quantity and category quantity of data owned by the client, the contribution of each client is calculated. If the data volume of client i is D i , and the category quantity is v i , its contribution C i is expressed as:
[0180]
[0181] (2) Model parameter update value allocation method
[0182] The federated incentive mechanism based on model fairness is mainly aimed at the mode where all clients are data owners. Each client locally has a part of the dataset required to calculate the power index. Through the federated incentive mechanism, multi-party data information is fused to jointly train a better model, and different performance models are obtained according to their respective contributions.
[0183] After aggregating the global model on the server side, each client will obtain all or part of the model parameter update values according to their respective contributions. The maximum value method is adopted in the process of allocating the global model parameter update values, that is, the model parameter update values are arranged in descending order, and according to the contribution ratio of each client, the corresponding number of model parameter update values is allocated to them for the update of their respective local models.
[0184] (3) Algorithm process
[0185] The federated incentive algorithm based on model fairness is divided into the server side and the client side, and adopts the original Federated Average (FedAvg) algorithm (as shown in Table 1 and Table 2) as the basic framework of the federated training process. The server side initializes the global model weights and biases and send it to each client. After local training by client k, the updated values of the model weights and biases are calculated and and sent to the server for aggregation. Then, the server obtains the updated values of the model weights and biases through the aggregation method and and allocates the corresponding number M k of the updated values of the model weights and biases k to client k according to the contribution degree C and of each client. Finally, client k performs local model update based on the allocated updated values of the model weights and biases and to obtain the local model and
[0186] Table 1 Original Federated Averaging (FedAvg) Algorithm: Server
[0187]
[0188]
[0189] Table 2 Original Federated Averaging (FedAvg) Algorithm: Client
[0190]
[0191]
[0192] To prevent the security of the model weights and biases during transmission, the embodiments of the present invention use the CKKS (Cheon-Kim-Kim-Song) encryption algorithm to encrypt them. The CKKS encryption algorithm process is as follows:
[0193] (1) Initialization: Select the security level parameter λ and the upper limit L of the algorithm depth; select the complex vector space C N / 2 as the plaintext space of the algorithm, where N is a power of 2 and satisfies the security level λ; select the base g>0 and the modulus G for rescaling, and define to satisfy the security level λ; select the private key-related distribution X s , the error distribution X e , and the random distribution X r for encryption.
[0194] (2) Encoding: To construct encryption based on the Ring-Learning With Error (RLWE) problem, the complex vector space CN / 2 Mapped to a polynomial quotient ring (denoted as R). The encoding process can be expressed as:
[0195] Encode(X) = [σ -1 (Δ·π -1 (z))] ∈ R
[0196] In the formula, π -1 is to conjugate and reverse the vector and append it to the end of the original vector; Δ is a scaling factor; σ -1 is a system of linear equations with a Vandermonde matrix as the coefficient, that is:
[0197]
[0198] In the formula, ξ 2i-1 is the N primitive roots of the polynomial X N +1; [x] is the integer closest to the real number x, and when the distances are equal, it is rounded up preferentially.
[0199] (3) Key generation algorithm: Sample s from the private key-related distribution Xs, that is, s ← X, and set the private key as sk ← (1, s); Sample a from the polynomial quotient ring (denoted as RQ), that is, a ← R Q , sample e from the error distribution Xe, that is, e ← X e , and calculate the public key where Set the auxiliary calculation key where a′ ← R PQ , e′ ← X e ,
[0200] (4) Encryption algorithm: For the plaintext polynomial m ∈ R, output the ciphertext where r ← X r , e0, e1 ← X e .
[0201] (5) Decryption algorithm: For the ciphertext and the private key sk, calculate Output the plaintext polynomial m. Where represents the inner product of two vectors.
[0202] (6) Decoding: is the inverse process of encoding.
[0203] The overall process of the method for constructing the power data processing model in the embodiments of the present invention is summarized as follows:
[0204] The client calculates the score of the power index according to the obtained power evaluation system, and uses the received model weights and biases to perform local training based on its own data to obtain new model weights and biases. and Calculate the local training dataset size. Send the weights and biases of the updated model and the data volume during local training to the server.
[0205] The server receives the updated values of the model weights and parameters after local training of each client and the local training data volume of each client Aggregate to obtain according to the updated values of the model parameters uploaded by each participant and
[0206] Calculate the number of updated values of the model weights and biases allocated to participant k according to the contribution degree:
[0207]
[0208] According to the aggregated gradient allocation method, allocate the corresponding number M k1 and M k2 of updated values of weights and biases and Encrypt and send to client k.
[0209] The client downloads the allocated model update values and Combine the update values to obtain the finally updated model for this round
[0210] Continuously repeat the above steps until the error is less than the threshold.
[0211] Each client uploads the iterated model weights and biases to the server, and the server decrypts the received model weights and biases to obtain the trained model.
[0212] Corresponding to the method for constructing the power data processing model described in the foregoing Embodiment 1 of the present invention, Embodiment 2 of the present invention further provides a device for constructing a power data processing model, including:
[0213] A data collection module for collecting data required to calculate power indicators and establishing a power evaluation index system;
[0214] A model training module for pre-training an initial model according to the index system on the client and uploading update values after local training using encrypted model parameters distributed by the server;
[0215] An aggregation update module, configured to receive and aggregate the model update values of each client on the server side, allocate and encrypt new model parameters according to the contribution degree, and send them to the client;
[0216] An iterative training module, configured to repeatedly execute the client pre-training and local training steps and the server-side model aggregation and update steps until the model error is less than a preset threshold;
[0217] A decryption module, configured to decrypt the received model weights and biases on the server side after the model weights and biases after iterative training are uploaded to the server side by each client, so as to obtain the finally trained power data processing model.
[0218] Corresponding to the method for constructing the power data processing model described in the foregoing Embodiment 1 of the present invention, Embodiment 3 of the present invention further provides a device for constructing a power data processing model, including:
[0219] One or more processors;
[0220] A memory;
[0221] One or more applications, wherein the one or more applications are stored in the memory and are configured to be executed by the one or more processors, and the one or more applications are configured to execute the method for constructing the power data processing model described in the foregoing Embodiment 1 of the present invention.
[0222] Corresponding to the method for constructing the power data processing model described in the foregoing Embodiment 1 of the present invention, Embodiment 4 of the present invention further provides a computer program product, including computer instructions, and the computer instructions direct a computer device to execute operations corresponding to the method for constructing the power data processing model described in the foregoing Embodiment 1 of the present invention.
[0223] Preferably, the processor may be a Central Processing Unit (CPU), or may also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field-Programmable Gate Arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor, or the processor may also be any conventional processor. The processor is the control center of the device and connects various parts of the device through various interfaces and lines.
[0224] The memory mainly includes a program storage area and a data storage area. Among them, the program storage area can store an operating system, application programs required for at least one function, etc., and the data storage area can store relevant data, etc. In addition, the memory can be a high-speed random access memory, or a non-volatile memory, such as a plug-in hard disk, a SmartMedia Card (SMC), a Secure Digital (SD) card, a Flash Card, etc., or the memory can also be other volatile solid-state storage devices.
[0225] It should be noted that the above device may include but is not limited to a processor and a memory, which can be understood by those skilled in the art.
[0226] Regarding the working principle and process of the above embodiments, refer to the description of Embodiment 1 of the present invention above, and details will not be repeated here.
[0227] It can be seen from the above description that compared with the prior art, the beneficial effects of the present invention are as follows: Through local training on the client side and encrypted aggregation on the server side, the present invention ensures the security of data during transmission and processing, and avoids the risk of data leakage. At the same time, the present invention breaks the data silos, enabling the power data scattered in each client to be aggregated and utilized, realizing data sharing and collaboration. Through the iterative training process, the model parameters are continuously optimized, improving the accuracy and reliability of the model. The power data processing model constructed by the present invention can fully explore and utilize the value of power data, provide strong support for decision-making and optimization in the power industry, realize the maximum value of the obtained power data, and has broad application prospects and important practical significance.
[0228] The above-disclosed are only the preferred embodiments of the present invention. Of course, the scope of the rights of the present invention cannot be limited by this. Therefore, equivalent changes made according to the claims of the present invention still fall within the scope covered by the present invention.
Claims
1. A method for constructing a power data processing model, characterized in that: The following steps are involved: Step S1, collect and calculate the data required to obtain the power index, and establish a power evaluation index system; Step S2: The client pre-trains the initial model according to the indicator system, and uses the encrypted model parameters distributed by the server to perform local training and then upload the updated values; Step S3, the server receives and aggregates the model update values of each client, distributes and encrypts the new model parameters and sends them to the client according to the contribution; Step S4, repeatedly executing the client pre-training and local training steps and the server-side model aggregation and updating steps until the model error is less than a preset threshold; In step S5, each client uploads the iteratively trained model weights and biases to the server, and the server decrypts the received model weights and biases to obtain the final trained power data processing model.
2. The method according to claim 1, characterized in that The electricity obtaining index includes: an electricity connection time index, an electricity connection service cost index, a power supply reliability index and an electricity fee transparency index.
3. The method according to claim 1, characterized in that The step S2 specifically includes: The client calculates the index score according to the obtained power evaluation index system and pre-trains the initial model; The client receives the encrypted model weights and biases generated and distributed by the server; The client uses the received encrypted model weights and biases and combines them with local data for local training to obtain updated model weights and biases.
4. The method according to claim 3, characterized in that The server uses the Xavier initialization method to initialize weights and biases, and distributes them to each client after encryption; the client obtains the updated model weights and biases, calculates the amount of local training data set, and then sends the updated model weights and biases and the amount of local training data to the server.
5. The method according to claim 3, characterized in that: The step S3 specifically includes: The server receives the updated values of the locally trained model weights and biases and the amount of local training data uploaded by each client; The server aggregates the model parameter update values uploaded by each client to obtain new model weights and biases; The server calculates the number of model weights and bias update values allocated to each client based on the contribution, encrypts the corresponding number of weights and bias update values and sends them to the client.
6. The method according to claim 5, characterized in that After the server encrypts the corresponding number of weight and bias update values and sends them to the client, the client downloads the allocated weight and bias update values to obtain the final updated model of this round.
7. The method according to claim 1, characterized in that The server uses the CKKS encryption algorithm to generate public and private keys.
8. A device for constructing a power data processing model, characterized in that: include: The data collection module is used to collect the data required for calculating the power indicators and establish a power evaluation indicator system; The model training module is used to pre-train the initial model on the client according to the indicator system, and upload the updated value after local training using the encrypted model parameters distributed by the server; Aggregation update module, used to receive and aggregate the model update values of each client on the server side, distribute and encrypt the new model parameters and send them to the client according to the contribution; Iterative training module, used to repeatedly execute client pre-training and local training steps and server-side model aggregation and update steps until the model error is less than a preset threshold; The decryption module is used to decrypt the received model weights and biases on the server side after each client uploads the iteratively trained model weights and biases to the server side to obtain the final trained power data processing model.
9. A device for constructing a power data processing model, characterized in that: include: one or more processors; Memory; One or more applications, wherein the one or more applications are stored in the memory and are configured to be executed by the one or more processors, and the one or more applications are configured to execute the method for constructing a power data processing model as described in any one of claims 1 to 7.
10. A computer program product, characterized in that The method comprises computer instructions, wherein the computer instructions instruct a computer device to execute operations corresponding to the method according to any one of claims 1 to 7.