CN115249090A - Electric quantity prediction method and system based on homomorphic encryption - Google Patents

Electric quantity prediction method and system based on homomorphic encryption Download PDF

Info

Publication number
CN115249090A
CN115249090A CN202210779532.4A CN202210779532A CN115249090A CN 115249090 A CN115249090 A CN 115249090A CN 202210779532 A CN202210779532 A CN 202210779532A CN 115249090 A CN115249090 A CN 115249090A
Authority
CN
China
Prior art keywords
power consumption
power
encrypted
consumption prediction
characteristic data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210779532.4A
Other languages
Chinese (zh)
Inventor
胡春强
李文鑫
邓绍江
付春雷
李秀华
蔡斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chongqing University
Original Assignee
Chongqing University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chongqing University filed Critical Chongqing University
Priority to CN202210779532.4A priority Critical patent/CN115249090A/en
Publication of CN115249090A publication Critical patent/CN115249090A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/04Forecasting or optimisation specially adapted for administrative or management purposes, e.g. linear programming or "cutting stock problem"
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
    • G06Q50/06Energy or water supply
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/008Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols involving homomorphic encryption

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Economics (AREA)
  • Human Resources & Organizations (AREA)
  • Strategic Management (AREA)
  • Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Marketing (AREA)
  • General Business, Economics & Management (AREA)
  • Tourism & Hospitality (AREA)
  • General Health & Medical Sciences (AREA)
  • Primary Health Care (AREA)
  • Water Supply & Treatment (AREA)
  • Public Health (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Development Economics (AREA)
  • Game Theory and Decision Science (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Operations Research (AREA)
  • Quality & Reliability (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention provides an electric quantity prediction method and system based on homomorphic encryption, wherein the electric quantity prediction method based on homomorphic encryption comprises the following steps: an input step: inputting power characteristic data at a local customer service end; a prediction step: transmitting the electric power characteristic data to an encrypted power consumption prediction model for prediction; an output step: the electricity consumption prediction model outputs an electricity consumption prediction encryption value and transmits the electricity consumption prediction encryption value to a local client; the encrypted power consumption prediction model takes a multi-time consumption formula as a loss function in the training process, and the multi-time consumption formula is used for solving a mean square error of power consumption prediction encryption values at different moments; the problem of low prediction accuracy when the electric quantity prediction model predicts the electric quantity for a long time in the prior art is solved.

Description

Electric quantity prediction method and system based on homomorphic encryption
Technical Field
The invention belongs to the technical field of artificial intelligence, and particularly relates to an electric quantity prediction method and system based on homomorphic encryption.
Background
Electric power has become an indispensable energy source in human life, and acquisition and efficient allocation of various electric power resources have become particularly important. And the load aggregation businessmen perform secondary distribution and scheduling on the electric power resources of the users according to the electric power consumption of the users in different time periods so as to realize the full utilization of the electric power resources and ensure the effective supply of the electric power. With the large-scale construction of power grids in China, smart power grids gradually become a new development direction, artificial intelligence is introduced into power dispatching, and load aggregators adopt a machine learning technology to model and predict power consumption of users.
In order to ensure the safety of the electric power characteristic data and the electricity consumption prediction encryption value and the accuracy of the decrypted data, the prior art adopts a homomorphic encryption mode to encrypt the electric power characteristic data and the electricity consumption prediction encryption value, and the accuracy of a homomorphic encryption scheme is greatly reduced after a large number of multiplication operations according to the property of homomorphic encryption, and when an electricity consumption prediction model predicts electricity consumption for a long time, a large number of matrix multiplication operations are needed, so that the accuracy of a long-term electricity consumption prediction result is low.
Disclosure of Invention
The invention aims to at least solve the technical problems in the prior art, provides an electric quantity prediction method and system based on homomorphic encryption, and solves the problem that an electric quantity prediction model in the prior art is low in prediction accuracy when long-term electricity consumption prediction is carried out.
In order to achieve the above object of the present invention, according to a first aspect of the present invention, the present invention provides the following basic solutions: the electric quantity prediction method based on homomorphic encryption is characterized by comprising the following steps: the method comprises the following steps:
an input step: inputting power characteristic data at a local customer service end, and carrying out homomorphic encryption on the power characteristic data to obtain ciphertext data;
a prediction step: inputting the encrypted data into an encrypted power consumption prediction model deployed in a cloud server;
an output step: the encrypted power consumption prediction model outputs a power consumption prediction encryption value to the local client, and the local client decrypts the power consumption prediction encryption value to obtain a power consumption prediction value;
the encrypted power consumption prediction model takes a multi-time consumption formula as a loss function in the training process, and the multi-time consumption formula is used for solving the mean square error of the power consumption prediction encryption values at different moments.
The basic principle and the beneficial effects of the basic scheme are as follows: through the difference of the weight parameters, the multi-time loss formula obtains the mean square error of the predicted values at different moments, and the encrypted power consumption model is learned and trained through a large amount of power data.
In another preferred embodiment of the present invention, the multi-time loss formula is:
Figure BDA0003728564920000021
wherein N is the maximum number of times of i;
Figure BDA0003728564920000022
is the tag data at the ith time instant,
Figure BDA0003728564920000023
predicting an encrypted value of the electricity consumption at the ith moment obtained by encrypting the electricity consumption prediction model; omega i The weighting parameter at the ith time point is decreased according to the increase of the time point value.
In another preferred embodiment of the present invention, the weight parameter is generated by a geometric distribution formula; the geometric distribution formula is as follows:
ω i {X=i}=p(1-p) i-1 ,i=1,2,3,…,0<p<1
where p is the distribution parameter of the geometric distribution formula.
In another preferred embodiment of the present invention, the encrypted power consumption prediction model includes a convolution layer, a first fully-connected layer, a second fully-connected layer, and a third fully-connected layer, which are connected in sequence;
wherein the convolution kernel size of the convolution layer is 1 × 5, and the step length is 1; the input raw data is power characteristic data of 300 multiplied by 5 multiplied by 1, a convolution kernel is used, and then a matrix value of 300 multiplied by 1 multiplied by 4 is output;
the input of the first full-connection layer is a vector with a flattened convolutional layer output matrix value;
the input of the second full connection layer is the last output data of the previous layer, and the number of nodes of the second full connection layer is T 3
The input of the third full connection layer is the last output data of the previous layer, and the number of nodes of the third full connection layer is T 4
Has the advantages that: in the process of training the prediction model by using the power characteristic data, the frameworks of various prediction models are selected, and the framework of the prediction model in the scheme is selected as an encryption power consumption prediction model according to the accuracy rate of a prediction result.
In another preferred embodiment of the invention, T 3 Has a value range of { (T) 3 )|gcd(T,96)≤2∩(T 3 )∈[43,95]},T 4 Has a value range of { (T) 4 )|gcd(T,96)≤2∩(T 4 )∈[43,95]}。
Has the advantages that: when the collected power characteristic data are used for training the encrypted power consumption prediction model, the quantity of the collected power characteristic data is 96 pieces per day, so that the value boundary is set to be 96, the encrypted power consumption prediction model can predict the power consumption at different time periods according to different node numbers, and the randomness and diversity of prediction are improved.
In a further preferred embodiment of the invention, the activation function used by the encrypted power consumption prediction model is a square function.
In another preferred embodiment of the present invention, before the inputting step, a deploying step is further included, and the deploying step specifically includes the following steps:
s1: collecting power characteristic data, preprocessing the power characteristic data and making a label;
s2: constructing an encrypted power consumption prediction model, and determining an optimizer of the encrypted power consumption prediction model;
s3: training the encrypted power consumption prediction model, and finely adjusting the hyper-parameters of the encrypted power consumption prediction model according to the accuracy of a training result;
s4: and deploying the encrypted power consumption prediction model trained in the plaintext to a cloud server.
In another preferred embodiment of the present invention, the inputting step is specifically: and the local customer service side performs approximate calculation homomorphic encryption on the electric power characteristic data.
Has the advantages that: compared with other homomorphic encryption modes, the encryption mode adopting approximate calculation homomorphic encryption has higher operation speed.
In another preferred embodiment of the present invention, the step S1 specifically includes the following steps:
s1-1: collecting power characteristic data of multiple days and multiple moments, wherein the power characteristic data comprises time, temperature, humidity, precipitation and electricity consumption;
s1-2: carrying out time-series processing on the power characteristic data, and representing the power characteristic data by a two-dimensional matrix according to days and moments;
s1-3: normalizing the power characteristic data;
s1-4: a part of the power characteristic data is taken as a training set, and the rest of the power characteristic data is taken as a test set.
Has the advantages that: the electricity consumption is influenced by factors such as the quantity and the power consumption of the electric equipment, and meanwhile, the factors such as the temperature, the humidity and the weather change, so that the scheme collects the electric characteristic data formed by the time, the temperature, the humidity, the precipitation and the electricity consumption, and the accuracy of electricity consumption prediction is improved.
In order to achieve the above object of the present invention, according to a second aspect of the present invention, there is provided a power prediction system based on homomorphic encryption, comprising:
the local customer service terminal is used for acquiring the electric power characteristic data, carrying out homomorphic encryption on the electric power characteristic data to obtain ciphertext data and uploading the ciphertext data to the cloud server;
the cloud server is deployed with an encrypted power consumption prediction model, encrypted data are input into the encrypted power consumption prediction model, the encrypted power consumption prediction model outputs a power consumption prediction encryption value, and the power consumption prediction encryption value is sent to a local client to be decrypted to obtain a power consumption prediction value;
the encrypted power consumption prediction model takes a multi-time consumption formula as a loss function in the training process, and the multi-time consumption formula is used for solving the mean square error of the power consumption prediction encryption values at different moments.
Drawings
FIG. 1 is a flow chart of a method for predicting electric quantity based on homomorphic encryption according to the present invention;
FIG. 2 is a schematic diagram of an algorithm structure of an encrypted power consumption prediction model according to the present invention;
FIG. 3 is a flow chart of the encrypted power usage prediction model training process of the present invention;
FIG. 4 is a diagram of the predicted effect of the support vector machine model in an embodiment of the invention;
FIG. 5 is a diagram of the prediction effect of the random forest model in the embodiment of the present invention;
FIG. 6 is a graph of the predicted effect of the LSTM model in an embodiment of the present invention;
FIG. 7 is a graph of the predicted effect of the neural network model of MSELoss in an embodiment of the present invention;
FIG. 8 is a prediction effect diagram of an encryption power consumption prediction model in the embodiment of the present invention;
FIG. 9 is a graph comparing long-term prediction accuracy for multiple models in an embodiment of the present invention;
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the accompanying drawings are illustrative only for the purpose of explaining the present invention, and are not to be construed as limiting the present invention.
In the description of the present invention, it is to be understood that the terms "longitudinal", "lateral", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", and the like, indicate orientations or positional relationships based on those shown in the drawings, and are used merely for convenience of description and for simplicity of description, and do not indicate or imply that the referenced devices or elements must have a particular orientation, be constructed in a particular orientation, and be operated, and thus, are not to be construed as limiting the present invention.
In the description of the present invention, unless otherwise specified and limited, it should be noted that the terms "mounted," "connected," and "connected" are to be interpreted broadly, and may be, for example, a mechanical connection or an electrical connection, a communication between two elements, a direct connection, or an indirect connection through an intermediate medium, and those skilled in the art will understand the specific meaning of the terms as they are used in the specific case.
The invention provides an electric quantity prediction method based on homomorphic encryption, which comprises the following steps in a preferred real-time mode as shown in the attached figure 1: a deployment step, an input step, a prediction step and an output step;
deployment step: constructing an encrypted power consumption prediction model and deploying the encrypted power consumption prediction model to a cloud server;
an input step: inputting power characteristic data at a local customer service terminal, and carrying out approximate calculation homomorphic encryption on the power characteristic data to obtain ciphertext data;
a prediction step: inputting the encrypted data into an encrypted power consumption prediction model;
the specific process of CKKS encryption is
(1) Initialization:
the parameter lambda is used as a safety level coefficient, and L is the upper limit of the depth of finite-level homomorphic encryption.
Select N e { x: x mod 2=0, defining a geometric distribution parameter P > 0 and a modulus P. Define modulus Scale Q =q 0 ·p L So that N and P.Q satisfy the security level coefficient lambda.
Selecting a distribution of private keys s Error distribution χ e And randomly distributed χ r
(2) And (3) key generation:
using the initialized distribution to generate s ← χ s ,a←R Q ,e←χ e S, e, r are each defined by λ s ,λ e ,λ r A generated random number;
generates a private key sk ← (1, s), calculates a public key (b, a),
Figure BDA0003728564920000071
so that a list of equations holds:
b=-a·s+e mod Q
instantiate a' ← R PQ ,e←χ e Obtaining an auxiliary calculation key (b ', a'),
Figure BDA0003728564920000072
satisfies the following conditions:
b′=-a′·s+e′+P·s 2 mod P·Q (13)
the helper calculation key (b ', a') is used for the multiplication operation.
(3) Encryption:
generate r ← χ r ,e 0 ,e 1 ←χ e The encryption formula is:
c←r·pk+(m+e 0 ,e 1 )mod Q (14)
(4) and (3) decryption:
cipher text
Figure BDA0003728564920000081
The private key sk has a decryption formula as follows:
m′=<c,sk>mod q=c 0 +c 1 ·s mod q≈m
(5) and (3) adding:
let us assume that the two ciphertexts c,
Figure BDA0003728564920000082
the addition formula is:
c add ←c+c′mod q
the error of the addition result is the sum of the errors of the respective ciphertexts.
(6) Multiplication:
1) Multiplication of plaintext and ciphertext
Setting cipher text
Figure BDA0003728564920000083
Plaintext m ∈ R q The multiplication formula is:
c mult ←m·c mod q
2) Multiplication between ciphertexts
The user is provided with a ciphertext c,
Figure BDA0003728564920000084
the multiplication formula is:
(d 0 ,d 1 ,d 2 )=(c 0 c′ 0 ,c 0 c′ 1 +c′ 0 c 1 ,c 1 c′ 1 )
Figure BDA0003728564920000085
in CKKS multiplication, ciphertext errors grow exponentially as the number of multiplications increases.
(7) Rescaling:
cipher text
Figure BDA0003728564920000091
Modulus P'<P, rescaling formula is:
Figure BDA0003728564920000095
the absolute precision of the ciphertext operation is fixed through rescaling, so that the increase of the scaling scale in the multiplication process is limited. The addition, multiplication and rescaling are used as the calculation part of the framework and are automatically completed in the calculation process.
An output step: the electricity consumption prediction model outputs an electricity consumption prediction encryption value, and the electricity consumption prediction encryption value is transmitted to a local client; the local client decrypts through a decryption process in the CKKS encryption process to obtain a prediction result;
in the encrypted power consumption prediction model, a multi-time loss formula is used as a loss function in the training process, and the multi-time loss formula is used for solving the mean square error of the power consumption prediction encryption values at different moments.
In a preferred embodiment, the multi-time loss formula is:
Figure BDA0003728564920000092
wherein N is the maximum number of times of i; preferably, the value of N is 86,
Figure BDA0003728564920000093
is the tag data at the ith time instant,
Figure BDA0003728564920000094
predicting an encrypted value of the electricity consumption at the ith moment obtained by encrypting the electricity consumption prediction model; omega i The weighting parameter at the ith time point is decreased according to the increase of the time point value.
In a preferred embodiment, the weight parameters are generated by a geometric distribution formula; the geometric distribution formula is:
ω i {X=i}=p(1-p) i-1 ,i=1,2,3,…,0<p<1
preferably, p =0.6.
In a preferred embodiment, the inputting step further includes a deploying step before the inputting step, and the deploying step specifically includes the following steps:
s1: collecting power characteristic data, preprocessing the power characteristic data and manufacturing a label;
s2: constructing an encrypted power consumption prediction model, and determining an optimizer of the encrypted power consumption prediction model;
s3: training the encrypted power consumption prediction model, and finely adjusting the hyper-parameters of the encrypted power consumption prediction model according to the accuracy of a training result;
s4: and deploying the encrypted power consumption prediction model trained in the plaintext to a cloud server.
In a preferred embodiment, step S1 specifically includes the following steps:
s1-1: collecting power characteristic data of 1270 days between 2018 and 2021, wherein the power characteristic data comprise time, temperature, humidity, precipitation and electricity consumption, the power characteristic data are collected at intervals of 15 minutes and are counted in 96 days;
s1-2: performing time-series processing on the power characteristic data, and representing the power characteristic data by a two-dimensional matrix in the sequence from 2018 to 2021, wherein the power characteristic data comprises m =1270 × 96 rows and n =5 columns; the two-dimensional matrix is as follows:
A={a ij } m×n ={x 1 ,x 2 ,…,x m } T
a is a two-dimensional matrix formed by power characteristic data, and the time unit is set to be second;
s1-3: normalizing the power characteristic data; normalization is to divide the elements of the power characteristic data by the difference between the maximum value of each element and the minimum value of each element, i.e.:
Figure BDA0003728564920000101
the data is elements in a power characteristic data set constructed by a two-dimensional matrix A;
s1-4: taking 730 x 96 lines of power characteristic data of the year 2018 and the year 2019 in total as a training set, and taking the rest power characteristic data as a test set;
the training set was made as m =730 × 96-386, n =5;
Figure BDA0003728564920000111
t<m
wherein D is a training set, x n Represented as the nth dimensional component of the x-vector. The production of the test set is the same as the production of the training set.
In a preferred embodiment, as shown in fig. 2, the prediction model for encrypted power consumption sequentially comprises a convolution layer and a full connection layer with three layers connected; the activation function used by the electricity consumption prediction model is encrypted to be a square function;
the convolution layer inputs the power characteristic data of which the original data is 300 multiplied by 5 multiplied by 1, uses a convolution kernel of 1 multiplied by 5, has a step length of 1, and then outputs a matrix value of 300 multiplied by 1 multiplied by 4;
the input of the first layer of full connection layer is a vector with the flattened output matrix value of the previous layer, and the size is 1200 multiplied by 1; the flattened vector refers to a form of converting a previous layer output matrix value into a vector;
the input of the second layer full connection layer is the last output data of the previous layer, the size is 1200 multiplied by 1, the number of nodes of the right connection layer is T 3
The input of the third full connection layer is the last output data of the previous layer, the size is 1200 multiplied by 1, the number of nodes of the full connection layer is T 4
Wherein, T 3 Has a value range of { (T) 3 )|gcd(T,96)≤2∩(T 3 )∈[43,95]},T 4 Has a value range of { (T) 4 )|gcd(T,96)≤2∩(T 4 )∈[43,95]}; preferably, T 3 A value of 64; t is 4 The value is 86;
before the structure of the prediction model of the encrypted power consumption in the embodiment is obtained, the invention contrasts and analyzes various models, including a support vector machine model, a random forest model, an LSTM model and a convolutional neural network model using MSELoss.
FIG. 4 shows the predicted effect of a support vector machine model (SVM); FIG. 5 shows the predicted effect of a Random forest model (Random forest); FIG. 6 shows the predicted effect of the LSTM model; FIG. 7 shows the predicted effect of the convolutional neural network model of MSELoss (CNN with MSELoss); fig. 8 shows the prediction effect of the prediction model for the encrypted power consumption in the present invention. FIG. 9 shows the comparison of the accuracy of the long-term power consumption prediction of the model;
because the long-term prediction of the LSTM model is too long, the long-term prediction accuracy of the LSTM model is not calculated in the experiment, but the average loss value of the LSTM model is 0.00089, the average loss value of the LSTM model is 0.00009, and the LSTM model is reduced by nearly 10 times; it can be seen that the long-term electricity consumption prediction accuracy of the encrypted electricity consumption prediction model is optimal with the increase of electricity consumption prediction time.
The inference time due to the homomorphic cryptographic model is nearly 100 times slower than the plaintext inference. Limited by computational power, when the homomorphic encryption model is evaluated, the homomorphic encryption model is evaluated by uniformly and randomly selecting 800 power characteristics from a test set, and the obtained evaluation result is as follows:
table 1 homomorphic cryptographic model accuracy comparison
Figure BDA0003728564920000121
It can be considered that the cryptographic model has little cryptographic loss to the prediction result.
In a preferred embodiment, as shown in fig. 3, S3 specifically includes the following: s3-1: initializing parameters of an encrypted power consumption prediction model, and selecting initialization hyper-parameters;
s3-2: training an encrypted power consumption prediction model by using a training set, setting the number of mini-batchs as 20, and traversing the whole training sample 100 times in the training process;
s3-3: judging whether the accuracy of the encrypted power consumption prediction model meets the requirement, if so, finishing training; otherwise, fine adjustment is carried out on the hyper-parameters of the encrypted power consumption prediction model, and the step S3-2 is executed again.
The hyper-parameters are divided into network structure related parameters and model training related parameters; the network structure related parameters include: the number and type of network middle layers, the number of neurons in each layer and an activation function; model training related parameters: loss function, optimization method, batch size, iteration times, learning rate, regular method and coefficient, optimization method;
in addition, the robustness and generalization capability of the network can be enhanced through technologies such as early stopping or regularization.
In a preferred embodiment, the model uses a square function instead of the traditional tanh and sigmoid as the activation function, the square function is as follows: f (x) = x 2
In a preferred embodiment, in order to make the convergence faster, the selected optimizer in step S2 is Adam, whose function is:
Figure BDA0003728564920000131
where α =0.001, and ∈ is a constant added to maintain numerical stability, and ∈ =10 -8 T denotes the number of iterations, w t Model training parameter, m, representing the time at which the number of iterations is t t Is an exponential moving average value of the gradient, is obtained through the first moment of the gradient,
Figure BDA0003728564920000132
is m t And (4) correcting. v. of t Is a squared gradient, is obtained by the second moment of the gradient,
Figure BDA0003728564920000141
is v is t The correction of (1):
Figure BDA0003728564920000142
β 1 exponential decay rate, beta, representing first moment 2 Expressing the exponential rate of decrease of the second moment, where 1 =0.9,β 2 =0.999,m t And v t The updates of (2) are as follows:
m t =β 1 ×m t-1 +(1-β 1 )×g t
Figure BDA0003728564920000143
wherein, g t Representing the gradient at the instant of iteration number t.
The invention also discloses an electric quantity prediction system based on homomorphic encryption, which comprises:
the local customer service terminal is used for acquiring the electric power characteristic data, carrying out homomorphic encryption on the electric power characteristic data to obtain ciphertext data and uploading the ciphertext data to the cloud server;
the cloud server is deployed with an encrypted power consumption prediction model, encrypted data are input into the encrypted power consumption prediction model, the encrypted power consumption prediction model outputs a power consumption prediction encryption value, and the power consumption prediction encryption value is sent to a local client to be decrypted to obtain a power consumption prediction value;
the encrypted power consumption prediction model takes a multi-time loss formula as a loss function in the training process, and the multi-time loss formula is used for solving a mean square error of the power consumption prediction encryption values at different moments.
In the description of the specification, reference to the description of "one embodiment," "some embodiments," "an example," "a specific example," or "some examples" or the like means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
While embodiments of the invention have been shown and described, it will be understood by those of ordinary skill in the art that: various changes, modifications, substitutions and alterations can be made to the embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.

Claims (10)

1. The electric quantity prediction method based on homomorphic encryption is characterized by comprising the following steps: the method comprises the following steps:
an input step: inputting power characteristic data at a local customer service terminal, and carrying out homomorphic encryption on the power characteristic data to obtain ciphertext data;
a prediction step: inputting the encrypted data into an encrypted power consumption prediction model deployed in a cloud server;
an output step: the encrypted power consumption prediction model outputs a power consumption prediction encryption value to the local client, and the local client decrypts the power consumption prediction encryption value to obtain a power consumption prediction value;
the encrypted power consumption prediction model takes a multi-time consumption formula as a loss function in the training process, and the multi-time consumption formula is used for solving the mean square error of the power consumption prediction encryption values at different moments.
2. The homomorphic encryption-based power prediction method of claim 1, wherein: the multi-time loss formula is:
Figure FDA0003728564910000011
wherein N is the maximum number of times of i;
Figure FDA0003728564910000012
is the tag data at the ith time instant,
Figure FDA0003728564910000013
predicting an encrypted value of the electricity consumption at the ith moment obtained by encrypting the electricity consumption prediction model; omega i The weighting parameter at the ith time instant is decreased according to the increase of the time instant value.
3. The homomorphic encryption-based power prediction method of claim 2, wherein: the weight parameters are generated through a geometric distribution formula; the geometric distribution formula is as follows:
P{X=k}=p(1-p) k-1 ,k=1,2,3,…,0<p<1
where P is the distribution parameter of the geometric distribution formula.
4. The method for predicting electric quantity based on homomorphic encryption according to claim 1, 2 or 3, characterized in that: the encrypted power consumption prediction model comprises a convolution layer, a first full-connection layer, a second full-connection layer and a third full-connection layer which are connected in sequence;
wherein the convolution kernel size of the convolution layer is 1 × 5, and the step length is 1; the input original data is power characteristic data of 300 multiplied by 5 multiplied by 1, a convolution kernel is used, and then a matrix value of 300 multiplied by 1 multiplied by 4 is output;
the input of the first full-connection layer is a vector with a flattened convolutional layer output matrix value;
the input of the second full connection layer is the last output data of the previous layer, and the number of nodes of the second full connection layer is T 3
The input of the third full connection layer is the last output data of the previous layer, and the number of nodes of the third full connection layer is T 4
5. The homomorphic encryption-based power prediction method of claim 4, wherein: t is 3 Has a value range of { (T) 3 )|gcd(T,96)≤2∩(T 3 )∈[43,95]},T 4 Has a value range of { (T) 4 )|gcd(T,96)≤2∩(T 4 )∈[43,95]}。
6. The method of claim 4, wherein the power prediction method based on homomorphic encryption comprises: the activation function used by the encrypted power usage prediction model is a squaring function.
7. The method of claim 6, wherein the power prediction method based on homomorphic encryption comprises: the method further comprises a deployment step before the input step, wherein the deployment step specifically comprises the following steps:
s1: collecting power characteristic data, preprocessing the power characteristic data and manufacturing a label;
s2: constructing an encrypted power consumption prediction model, and determining an optimizer of the encrypted power consumption prediction model;
s3: training the encrypted power consumption prediction model, and finely adjusting the hyper-parameters of the encrypted power consumption prediction model according to the accuracy of the training result;
s4: and deploying the encrypted power consumption prediction model trained in the plaintext to a cloud server.
8. The homomorphic encryption-based power prediction method of claim 7, wherein: the input steps are specifically as follows: and the local customer service end performs approximate calculation homomorphic encryption on the power characteristic data.
9. The method of claim 7, wherein the power prediction method based on homomorphic encryption comprises: the step S1 specifically includes the steps of:
s1-1: collecting power characteristic data of multiple days and multiple moments, wherein the power characteristic data comprise time, temperature, humidity, precipitation and electricity consumption;
s1-2: carrying out time-series processing on the power characteristic data, and representing the power characteristic data by a two-dimensional matrix according to days and moments;
s1-3: normalizing the power characteristic data;
s1-4: and taking part of the power characteristic data as a training set, and taking the rest of the power characteristic data as a test set.
10. Electric quantity prediction system based on homomorphic encryption, its characterized in that: the method comprises the following steps:
the local customer service terminal is used for acquiring the electric power characteristic data, carrying out homomorphic encryption on the electric power characteristic data to obtain ciphertext data and uploading the ciphertext data to the cloud server;
the cloud server is deployed with an encrypted power consumption prediction model, encrypted data are input into the encrypted power consumption prediction model, the encrypted power consumption prediction model outputs a power consumption prediction encryption value, and the power consumption prediction encryption value is sent to a local client to be decrypted to obtain a power consumption prediction value;
the encrypted power consumption prediction model takes a multi-time consumption formula as a loss function in the training process, and the multi-time consumption formula is used for solving the mean square error of the power consumption prediction encryption values at different moments.
CN202210779532.4A 2022-07-04 2022-07-04 Electric quantity prediction method and system based on homomorphic encryption Pending CN115249090A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210779532.4A CN115249090A (en) 2022-07-04 2022-07-04 Electric quantity prediction method and system based on homomorphic encryption

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210779532.4A CN115249090A (en) 2022-07-04 2022-07-04 Electric quantity prediction method and system based on homomorphic encryption

Publications (1)

Publication Number Publication Date
CN115249090A true CN115249090A (en) 2022-10-28

Family

ID=83699946

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210779532.4A Pending CN115249090A (en) 2022-07-04 2022-07-04 Electric quantity prediction method and system based on homomorphic encryption

Country Status (1)

Country Link
CN (1) CN115249090A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115719116A (en) * 2022-11-21 2023-02-28 重庆大学 Power load prediction method and device and terminal equipment
CN116383666A (en) * 2023-05-23 2023-07-04 重庆大学 Power data prediction method and device and electronic equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112633604A (en) * 2021-01-04 2021-04-09 重庆邮电大学 Short-term power consumption prediction method based on I-LSTM
CN112910624A (en) * 2021-01-14 2021-06-04 东北大学 Ciphertext prediction method based on homomorphic encryption
CN114021848A (en) * 2021-11-24 2022-02-08 西安热工研究院有限公司 Generating capacity demand prediction method based on LSTM deep learning

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112633604A (en) * 2021-01-04 2021-04-09 重庆邮电大学 Short-term power consumption prediction method based on I-LSTM
CN112910624A (en) * 2021-01-14 2021-06-04 东北大学 Ciphertext prediction method based on homomorphic encryption
CN114021848A (en) * 2021-11-24 2022-02-08 西安热工研究院有限公司 Generating capacity demand prediction method based on LSTM deep learning

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
YASIN *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115719116A (en) * 2022-11-21 2023-02-28 重庆大学 Power load prediction method and device and terminal equipment
CN116383666A (en) * 2023-05-23 2023-07-04 重庆大学 Power data prediction method and device and electronic equipment
CN116383666B (en) * 2023-05-23 2024-04-19 重庆大学 Power data prediction method and device and electronic equipment

Similar Documents

Publication Publication Date Title
Pan et al. Deepopf: A deep neural network approach for security-constrained dc optimal power flow
CN115249090A (en) Electric quantity prediction method and system based on homomorphic encryption
Mahmoud et al. An advanced approach for optimal wind power generation prediction intervals by using self-adaptive evolutionary extreme learning machine
Subathra et al. A hybrid with cross-entropy method and sequential quadratic programming to solve economic load dispatch problem
Dong et al. Data-driven scenario generation of renewable energy production based on controllable generative adversarial networks with interpretability
Tian et al. Short-term wind speed prediction based on improved PSO algorithm optimized EM-ELM
Luo et al. Generalized nesterov's acceleration-incorporated, non-negative and adaptive latent factor analysis
Jithish et al. Distributed anomaly detection in smart grids: a federated learning-based approach
JP5888640B2 (en) Photovoltaic power generation prediction apparatus, solar power generation prediction method, and solar power generation prediction program
Geetha et al. Green energy aware and cluster based communication for future load prediction in IoT
Niu et al. Model turbine heat rate by fast learning network with tuning based on ameliorated krill herd algorithm
CN105023070A (en) Output power prediction method of photovoltaic system
Kumari et al. An energy efficient smart metering system using edge computing in LoRa network
Tao et al. A human-machine reinforcement learning method for cooperative energy management
Yang et al. Robustified extreme learning machine regression with applications in outlier-blended wind-speed forecasting
Singh et al. SCADA system dataset exploration and machine learning based forecast for wind turbines
Li et al. Data-driven peer-to-peer blockchain framework for water consumption management
Wang et al. Missing value filling based on the collaboration of cloud and edge in artificial intelligence of things
CN115907231A (en) Power grid data prediction method and device
Suresh et al. IoT with evolutionary algorithm based deep learning for smart irrigation system
Sayed et al. Optimal operable power flow: Sample-efficient holomorphic embedding-based reinforcement learning
Li et al. Data partition and rate control for learning and energy efficient edge intelligence
Liu et al. Soil water content forecasting by ANN and SVM hybrid architecture
Gao et al. Bayesian deep neural networks for spatio-temporal probabilistic optimal power flow with multi-source renewable energy
Liang et al. A wind speed combination forecasting method based on multifaceted feature fusion and transfer learning for centralized control center

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20221028