A method for predicting electricity consumption of smart city residents based on hesitant generative adversarial network
By adopting a hesitation-based generative adversarial network method in smart city electricity consumption prediction, using ternary attributes and electricity consumption data for prediction, the problem of the reduction in prediction accuracy of existing methods in data inconsistency, inaccuracy, and incompleteness is solved, and stronger data identification and generalization capabilities are achieved.
Patent Information
- Application Number
- CN202411975310.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2044-12-31
AI Technical Summary
The existing smart city electricity prediction methods rely on a large amount of high-quality data, and when data is inconsistent, inaccurate, and incomplete, the accuracy of model predictions decreases and the generalization ability is weak.
Using a method based on hesitation generation adversarial network, a generator and classifier are constructed, and the ternary attributes and power consumption data are used to predict. The generator predicts future power consumption data and attributes, and judges the consistency of the hesitation preferences of the prediction data through the classifier, and calculates the loss function to update the model parameters.
It significantly improves the data recognition and generalization capabilities of the model, reduces the dependence on data samples, and can achieve better actual prediction effects in a small number of samples.
Smart Images

Figure CN119476640B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of urban electricity consumption prediction, and specifically relates to an electricity consumption prediction method, in particular to a smart city resident electricity consumption prediction method based on a hesitant generative adversarial network. Background Art
[0002] Smart city electricity consumption forecasting refers to the analysis and processing of urban residents' electricity consumption data to predict electricity demand in a certain period of time in the future, providing decision support for urban energy management, power dispatching, etc. Accurate electricity consumption forecasting helps optimize the energy structure, improve the operating efficiency of the power system, and reduce energy consumption, which is of great significance to the sustainable development of smart cities.
[0003] At present, smart city electricity consumption forecasting mainly adopts the following two methods:
[0004] 1. Method based on deep learning model: This method establishes a deep network model, extracts features by means of convolution and attention mechanism, and uses a large amount of sample data for training to strengthen the features and the association between features. This method has a good prediction effect when the data quality and volume are sufficient. However, the deep learning model relies on a large amount of high-quality data. When there are inconsistency, inaccuracy, and incompleteness in the electricity consumption sample data, it is difficult for the model to capture the rules that are not contained in the data, resulting in a decrease in prediction accuracy. Inconsistency refers to the contradictory situation that when the characteristic value of residential electricity consumption is large, the electricity consumption is small, and when the characteristic value is small, the electricity consumption increases. Such data often exists in the actual collected data, which will greatly interfere with the model prediction. Inaccuracy refers to the inaccuracy of abnormal jumps and abnormal 0 values in the original data for calculating the characteristics of residential electricity consumption. For example, the daily average load requires the average of the load at all times of the day. If there is an obvious load jump, this inaccuracy will affect the accuracy of the prediction. Incompleteness refers to the incompleteness of the original data for calculating the characteristics of residential electricity consumption. For example, the characteristics of electricity consumption duration need to be counted based on the load curve within the statistical time period. If there are missing load curve collection points within the time period, the accuracy of the prediction will be affected.
[0005] 2. Machine learning-based methods: This method combines preprocessing programs or expert systems and uses expert knowledge bases to label, correct, and introduce prior information. The advantage is that it uses expert prior knowledge, which reduces the dependence on data volume and can achieve good results with a small amount of data. However, this method relies on the updating and matching of expert knowledge.
[0006] Therefore, how to reduce the dependence on the amount of sample data without the help of expert knowledge base, improve the generalization ability of the model, and enable the prediction model to effectively deal with the problems of inconsistency, inaccuracy and incompleteness of the data and complete accurate predictions is an urgent problem to be solved in the current smart city electricity consumption forecasting. Summary of the invention
[0007] The present invention proposes a method for predicting electricity consumption of smart city residents based on hesitant generative adversarial networks, the purpose of which is to solve the problems that traditional methods rely on the amount of sample data and have weak model generalization ability.
[0008] The technical solution of the present invention is as follows:
[0009] A method for predicting electricity consumption of smart city residents based on hesitant generative adversarial networks, comprising the following steps:
[0010] Step 1: Build a generator and a classifier;
[0011] The generator is used to The historical data containing ternary attributes and electricity consumption data predicts the future The strip has prediction data of ternary attributes and power consumption data; the ternary attributes and power consumption data in the historical data correspond to the ternary attributes and power consumption data in the prediction data, and the power consumption data in the prediction data is the prediction result;
[0012] Each ternary attribute includes a positive part, a negative part and an intermediate part. The positive part is used to indicate the positive degree of the attribute to the power consumption data, the negative part indicates the negative degree of the attribute to the power consumption data, and the intermediate part indicates the uncertainty degree of the attribute.
[0013] The classifier is used to determine whether a row of input data with ternary attributes and power consumption data is generated by the generator, and output 0 if it is generated by the generator, otherwise output 1;
[0014] Step 2: Construct a training sample set;
[0015] The training sample set contains multiple training samples; the training samples are obtained by: selecting A continuous known data, convert the original attribute value in the known data into a ternary attribute, and then As the historical data in the training sample, The data is used as the real future data in the training sample;
[0016] Step 3: Train the generator and classifier;
[0017] The training samples The historical data is input into the generator to obtain The predicted data are then judged by the classifier on each predicted data and the real future data, and the hesitation preference consistency between each predicted data and the corresponding real future data is judged. Then, the loss function is calculated based on the hesitation preference consistency and the judgment result of the classifier, and finally the network parameters of the generator and the classifier are updated according to the loss function.
[0018] Step 4: Use the trained generator to make predictions: The original attribute values in the continuous known data to be predicted are converted into ternary attributes, and the The historical data will then The historical data is input into the generator, and we get The predicted data are extracted and the power consumption data in the predicted data are used as the prediction result.
[0019] As a further improvement of the smart city resident electricity consumption prediction method based on hesitant generative adversarial network: the ternary attribute is divided into positive correlation attribute and negative correlation attribute according to the positive and negative correlation between the attribute and the electricity consumption data.
[0020] As a further improvement of the smart city residents' electricity consumption prediction method based on hesitant generative adversarial network:
[0021] The positively correlated attributes include at least one of the following attributes: average daily power consumption, daily power consumption duration, daily maximum load, daily minimum load, daily load variance, daily power consumption weekly proportion, and monthly cumulative power consumption;
[0022] The negatively correlated attributes include at least one of the following attributes: weather coefficient, load fluctuation coefficient, regional electricity price, peak duration, number of household appliances, electricity consumption cycle, and energy-saving electricity consumption;
[0023] The electricity consumption data to be predicted refers to the electricity consumption data for the day.
[0024] As a further improvement of the smart city resident electricity consumption prediction method based on hesitant generative adversarial network, the ternary attribute is calculated based on the original attribute value, and the calculation process is:
[0025] Step A-1: Get continuous known data, each of which contains original attribute values corresponding to the attributes of the ternary numbers, and also contains the power consumption data;
[0026] Step A-2, performing normalization calculation on each original attribute value;
[0027] Set up The first of the known data The original attribute value of the attribute is , calculate the value of the original attribute value after column normalization: ;
[0028] Step A-3, determine the initial positive partial value and the initial negative partial value of each original attribute value: if The first of the known data If the attribute is a positively correlated attribute, then its initial positive partial value , the initial negation of the partial value ; If The first of the known data If an attribute is a negatively correlated attribute, then its initial positive partial value , the initial negation of the partial value ;
[0029] Step A-4: Calculate the middle part of each original attribute value:
[0030] Set up The first of the known data The middle part of the attribute is ,but:
[0031] ;
[0032] in, For the The hesitation on the row of known data, For the The first of the known data The column hesitation of each attribute; is the maximum threshold of hesitation;
[0033] Step A-5: Calculate the positive and negative parts of each original attribute value: The first of the known data The positive part of an attribute , No. The first of the known data The negation of an attribute ;
[0034] No. The first of the known data The ternary attribute of an attribute is represented as .
[0035] As a further improvement of the smart city residents' electricity consumption prediction method based on hesitant generative adversarial network, the hesitancy degree The calculation method is:
[0036] Step B-1: Set the count value for known data ;
[0037] Step B-2: The known data are respectively related to the current Known data are judged for consistency; each time a piece of The known data that is inconsistent with the known data, Add 1;
[0038] Step B-3: Calculate the row hesitation .
[0039] As a further improvement of the smart city residents' electricity consumption prediction method based on hesitant generative adversarial network, The known data and The consistency judgment method of known data is: first find the The vector composed of the original attribute values in the known data and the The difference between the vectors composed of the original attribute values in the known data , and then find the The electricity consumption data of the known data is The difference between the electricity consumption data of the known data If any of the following two conditions are met, the two are considered inconsistent:
[0040] Condition 1: and ;
[0041] Condition 2: and .
[0042] As a further improvement of the smart city residents' electricity consumption prediction method based on hesitant generative adversarial network, the hesitant degree The calculation method is: ,in, For the The first of the known data The missing rate of original data of each attribute, For the The first of the known data The anomaly rate of the original data of each attribute, Express Round to 2 decimal places.
[0043] As a further improvement of the smart city resident electricity consumption prediction method based on hesitant generative adversarial network, in step 3, the training samples in the training sample set are first divided into multiple batches, and then trained in batches.
[0044] As a further improvement of the smart city resident electricity consumption prediction method based on hesitant generative adversarial network, in step 3, the training process of each batch is as follows:
[0045] Step 3-1: The training samples in the current batch The historical data are input into the generator respectively, and the corresponding Prediction data;
[0046] Step 3-2: For each training sample, According to the consistency of hesitation preference between each piece of predicted data and the corresponding real future data, the predicted data are divided into Class I data that conforms to the hesitation preference of the real future data and Class II data that does not conform to the hesitation preference of the real future data;
[0047] Step 3-3: For each training sample in this batch, calculate the corresponding generator loss and classifier loss respectively;
[0048] Generator Loss The calculation method is:
[0049] ;
[0050] in, is a piece of prediction data obtained for the training sample, Represents a piece of prediction data The result obtained after inputting into the classifier is Indicates that the training sample corresponds to The forecast data The vector formed by express A vector of 1s, Indicates the cross entropy loss;
[0051] Classifier Loss The calculation method is:
[0052] ;
[0053] in, is a real future data in the training sample, For a real future data The result obtained after inputting into the classifier is is the training sample The real future data The vector formed by In Representation and All-1 vectors with consistent length; Indicates a piece of predicted data that is judged as Class I data. For a certain type I data The result obtained after inputting into the classifier is is the respective The vector formed by In Representation and All-1 vectors with consistent length; Indicates a piece of predicted data that is judged to be Class II data. For a certain type II data The result obtained after inputting into the classifier is is the respective The vector formed by In Representation and All-zero vectors with the same length;
[0054] Step 3-4: Calculate the average generator loss and the average classifier loss of all training samples in this batch, and update the network parameters of the generator and the classifier respectively according to the average generator loss and the average classifier loss.
[0055] As a further improvement of the smart city resident electricity consumption prediction method based on hesitant generative adversarial network, in step 3-2, the judgment division method based on the consistency of hesitation preference is: for a certain prediction data, if all the ternary attributes in it meet the following two conditions at the same time, then the prediction data is divided into Class I data, otherwise it is divided into Class II data:
[0056] Condition a: The middle part of the attribute in the predicted data is within the extended range of the hesitation of the corresponding attribute in the corresponding real future data;
[0057] The correspondence between the predicted data and the real future data means that the xth predicted data should correspond to the xth future real data under the same training sample;
[0058] The extended range of the hesitation degree means: if the middle part of the attribute in the real future data is , the range will be expanded With range Take the intersection, which is the extended range of the hesitation degree of the attribute; To expand the radius, is the maximum threshold of hesitation;
[0059] Condition b: The ratio of the positive part to the negative part of the attribute in the predicted data is equal to the ratio of the positive part to the negative part of the corresponding attribute in the corresponding real future data.
[0060] Compared with the prior art, the present invention has the following positive effects:
[0061] 1. Before prediction, the present invention converts the original attribute value into a ternary attribute and explicitly quantifies the uncertainty in the attribute data, so that the model can further explore the potential correlation between the uncertainty of the attribute itself and the predicted value while exploring the correlation between the attribute and the predicted value. In the training process, the model parameters are updated through a loss function based on the consistency of hesitation preference to ensure that the predicted data not only conforms to the correlation law between the attribute and the predicted value, but also has a degree of uncertainty similar to the actual data, thereby enhancing the data recognition and generalization capabilities of the model and reducing the dependence on data samples.
[0062] 2. The generator not only predicts future electricity consumption data based on historical data, but also predicts future attributes, making full use of the correlation between the attributes of the time series data to be predicted and the electricity consumption, thereby realizing dual correlation mining, that is, the correlation between the historical time series data and the electricity consumption to be predicted and the correlation within the time series data to be predicted, significantly improving the prediction model's ability to capture complex relationships and laying the foundation for the judgment of hesitant preference consistency.
[0063] 3. The present invention performs adversarial optimization on the generator and classifier. On the one hand, the generator can fit the rules of the data distribution by learning the data distribution and generate diversified prediction data. On the other hand, the classifier can enhance the ability to distinguish authenticity. In the adversarial process, due to the introduction of the consistency of hesitation preference, the generator will gradually learn to generate prediction data similar to the real future data and with the same hesitation characteristics, expanding the space of generated data and making the feature information of limited samples more fully mined and utilized. This allows the method to have better actual prediction results with a small number of samples. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] Figure 1 Schematic diagram of the training process of the present invention. DETAILED DESCRIPTION
[0065] The technical solution of the present invention is described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments.
[0066] A method for predicting electricity consumption of smart city residents based on hesitant generative adversarial networks, comprising the following steps:
[0067] Step 1: Build the generator and classifier.
[0068] The generator is used to The historical data containing ternary attributes and electricity consumption data predicts the future The strip contains the predicted data of ternary attributes and electricity consumption data. The ternary attributes and electricity consumption data in the historical data correspond to the ternary attributes and electricity consumption data in the predicted data, and the electricity consumption data in the predicted data is the predicted result. The purpose of retaining the electricity consumption data in the historical data is to enable the model to fit the potential correlation between the ternary attributes and the electricity consumption data, thereby ensuring that the output ternary attributes maintain the same correlation with the electricity consumption data.
[0069] The ternary attribute is divided into positive correlation attribute and negative correlation attribute according to the positive and negative correlation between the attribute and the power consumption data.
[0070] In this embodiment, the positively correlated attributes include daily average power consumption (average power consumption in the past 7 days), daily power consumption duration (cumulative load duration), daily maximum load (maximum value of the load on the day), daily minimum load (minimum value of the load on the day), daily load variance (statistical calculation value of the load on the day), daily power consumption weekly proportion (proportion of the daily power consumption in the past 7 days) and monthly cumulative power consumption. Negatively correlated attributes include weather coefficient ( ), load fluctuation coefficient (standard deviation of load divided by average), regional electricity price (the electricity price in the user's area on the same day), peak duration (the duration of the peak electricity consumption period on the same day), number of household appliances (obtained by non-intrusive load identification statistics), electricity consumption cycle (represented by hot unique codes 0 to 7) and energy-saving electricity consumption (electricity consumption participating in new energy consumption). The electricity consumption data to be predicted in the present invention refers to the electricity consumption data of the day.
[0071] Each ternary attribute contains a positive part, a negative part and an intermediate part. The positive part is used to indicate the positive degree of the attribute to the power consumption data, the negative part indicates the negative degree of the attribute to the power consumption data, and the intermediate part indicates the uncertainty degree of the attribute. The uncertainty degree corresponds to the aforementioned inconsistency, imprecision and incompleteness.
[0072] The ternary attribute is calculated based on the original attribute value, and the calculation process is:
[0073] Step A-1: Get A continuous known data, each known data contains original attribute values corresponding to each ternary attribute one by one, and also contains the power consumption data.
[0074] Step A-2: perform normalization calculation on each original attribute value.
[0075] Set up The first of the known data The original attribute value of the attribute is , calculate the value of the original attribute value after column normalization: .
[0076] Step A-3, determine the initial positive partial value and the initial negative partial value of each original attribute value: if The first of the known data If the attribute is a positively correlated attribute, then its initial positive partial value , the initial negation of the partial value ; If The first of the known data If an attribute is a negatively correlated attribute, then its initial positive partial value , the initial negation of the partial value .
[0077] Step A-4: Calculate the middle part of each original attribute value:
[0078] Set up The first of the known data The middle part of the attribute is ,but:
[0079] ;
[0080] in, For the The hesitation on the row of known data, For the The first of the known data The column hesitation of each attribute; is the maximum threshold of hesitation, preferably 0.4.
[0081] Hesitation on the line The calculation method is:
[0082] Step B-1: Set the count value for the known data .
[0083] Step B-2: The known data are respectively related to the current Each time a known data is found, it is consistent with the The known data that is inconsistent with the known data, Add 1.
[0084] The consistency judgment method is:
[0085] Suppose the current selection is Given data, first find the The vector composed of the original attribute values in the known data and the The difference between the vectors composed of the original attribute values in the known data , and then find the The electricity consumption data of the known data is The difference between the electricity consumption data of the known data If any of the following two conditions are met, the two are considered inconsistent:
[0086] Condition 1: and ;
[0087] Condition 2: and .
[0088] Step B-3: Calculate the row hesitation .
[0089] List Hesitation The calculation method is: ,in, For the The first of the known data The raw data missing rate of each attribute (i.e., the missing rate of the first missing rate of attributes), For the The first of the known data The raw data anomaly rate of each attribute (i.e., the anomaly rate of the first The abnormality rate of each attribute), Express Round to 2 decimal places.
[0090] Step A-5: Calculate the positive and negative parts of each original attribute value: The first of the known data The positive part of an attribute , No. The first of the known data The negation of an attribute .
[0091] No. The first of the known data The ternary attribute of an attribute is represented as .
[0092] The classifier is used to determine whether a row of input data with ternary attributes and power consumption data is generated by a generator, and outputs 0 if it is determined to be generated by the generator, otherwise outputs 1.
[0093] In this embodiment, the generator adopts a recurrent neural network model, the classifier adopts a standard neural network structure, and the last layer is a binary classification implemented by a SIGMOD module. The network structures of both are the same as the generative adversarial network in the prior art, and will not be described in detail here.
[0094] Step 2: Construct a training sample set.
[0095] The training sample set contains multiple training samples. The training samples are obtained by: selecting A continuous known data, convert the original attribute value in the known data into a ternary attribute, and then As the historical data in the training sample, The data are taken as the real future data in the training sample.
[0096] Step 3: Train the generator and classifier.
[0097] During training, Figure 1 , the training samples The historical data is input into the generator to obtain The predicted data are then judged by the classifier respectively on each predicted data and the real future data, and the hesitation preference consistency between each predicted data and the corresponding real future data is judged. Then the loss function is calculated according to the hesitation preference consistency and the judgment result of the classifier, and finally the network parameters of the generator and the classifier are updated according to the loss function.
[0098] The specific training steps are:
[0099] The training samples in the training sample set are divided into multiple batches, and then trained in batches. The training process of each batch is as follows:
[0100] Step 3-1: The training samples in the current batch The historical data are input into the generator respectively, and the corresponding Forecast data.
[0101] Step 3-2: For each training sample, According to the consistency of hesitation preference between each predicted data and the corresponding real future data, the predicted data are divided into Class I data that conforms to the hesitation preference of the real future data and Class II data that does not conform to the hesitation preference of the real future data.
[0102] The judgment division method based on the consistency of hesitation preference is: for a certain prediction data, if all the ternary attributes in it meet the following two conditions at the same time, then the prediction data is divided into Class I data, otherwise it is divided into Class II data:
[0103] Condition a: The middle part of the attribute in the predicted data is within the extended range of the hesitation of the corresponding attribute in the corresponding real future data.
[0104] The correspondence between the predicted data and the real future data means that the x-th predicted data should correspond to the x-th future real data under the same training sample.
[0105] The extended range of the hesitation degree means: if the middle part of the attribute in the real future data is , the range will be expanded With range Take the intersection, which is the extended range of the hesitation degree of the attribute. is the expansion radius, preferably 0.1; is the maximum threshold of hesitation, preferably 0.4.
[0106] Condition b: The ratio of the positive part to the negative part of the attribute in the predicted data is equal to the ratio of the positive part to the negative part of the corresponding attribute in the corresponding real future data.
[0107] Step 3-3: For each training sample in this batch, calculate the corresponding generator loss and classifier loss respectively.
[0108] Generator Loss The calculation method is:
[0109] ;
[0110] in, is a piece of prediction data obtained for the training sample, Represents a piece of prediction data The result obtained after inputting into the classifier is Indicates that the training sample corresponds to The forecast data The vector formed by express A vector of 1s, Represents the cross entropy loss.
[0111] Classifier Loss The calculation method is:
[0112] ;
[0113] in, is a real future data in the training sample, For a real future data The result obtained after inputting into the classifier is is the training sample The real future data The vector formed by In Representation and All-1 vectors with consistent length; Indicates a piece of predicted data that is judged as Class I data. For a certain type I data The result obtained after inputting into the classifier is is the respective The vector formed by In Representation and All-1 vectors with consistent length; Indicates a piece of predicted data that is judged to be Class II data. For a certain type II data The result obtained after inputting into the classifier is is the respective The vector formed by In Representation and A vector of all zeros with the same length.
[0114] Step 3-4: Calculate the average generator loss and the average classifier loss of all training samples in this batch, and update the network parameters of the generator and the classifier respectively according to the average generator loss and the average classifier loss.
[0115] This method uses batch training to update the parameters of the generator and classifier simultaneously.
[0116] Step 4: Use the trained generator to make predictions: The original attribute values in the continuous known data to be predicted are converted into ternary attributes, and the The historical data will then The historical data is input into the generator, and we get The predicted data are extracted and the power consumption data in the predicted data are used as the prediction result.
[0117] It should be noted that it is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential features of the present invention. The scope of the present invention is defined by the claims rather than the above description.
Claims
1. A method for predicting electricity consumption of smart city residents based on hesitant generative adversarial networks, characterized by: steps include: Step 1: Build a generator and a classifier; The generator is used to The historical data containing ternary attributes and electricity consumption data predicts the future The strip has prediction data of ternary attributes and power consumption data; the ternary attributes and power consumption data in the historical data correspond to the ternary attributes and power consumption data in the prediction data, and the power consumption data in the prediction data is the prediction result; Each ternary attribute includes a positive part, a negative part and an intermediate part. The positive part is used to indicate the positive degree of the attribute to the power consumption data, the negative part indicates the negative degree of the attribute to the power consumption data, and the intermediate part indicates the uncertainty degree of the attribute. The classifier is used to determine whether a row of input data with ternary attributes and power consumption data is generated by the generator, and output 0 if it is generated by the generator, otherwise output 1; The ternary attribute is divided into positive correlation attribute and negative correlation attribute according to the positive and negative correlation between the attribute and the power consumption data; The ternary attribute is calculated based on the original attribute value, and the calculation process is: Step A-1: Get continuous known data, each of which contains original attribute values corresponding to the attributes of the ternary numbers, and also contains the power consumption data; Step A-2, performing normalization calculation on each original attribute value; Set up The first of the known data The original attribute value of the attribute is , calculate the value of the original attribute value after column normalization: ; Step A-3, determine the initial positive partial value and the initial negative partial value of each original attribute value: if The first of the known data If the attribute is a positively correlated attribute, then its initial positive partial value , the initial negation of the partial value ; If The first of the known data If an attribute is a negatively correlated attribute, then its initial positive partial value , the initial negation of the partial value ; Step A-4: Calculate the middle part of each original attribute value: Set up The first of the known data The middle part of the attribute is ,but: ; in, For the The hesitation on the row of known data, For the The first of the known data The column hesitation of each attribute; is the maximum threshold of hesitation; Step A-5: Calculate the positive and negative parts of each original attribute value: The first of the known data The positive part of an attribute , No. The first of the known data The negation of an attribute ; No. The first of the known data The ternary attribute of an attribute is represented as ; Hesitation on the line The calculation method is: Step B-1: Set the count value for known data ; Step B-2: The known data are respectively related to the current Known data are judged for consistency; each time a piece of The known data that is inconsistent with the known data, Add 1; Step B-3: Calculate the row hesitation ; No. The known data and The consistency judgment method of known data is: first find the The vector composed of the original attribute values in the known data and the The difference between the vectors composed of the original attribute values in the known data , and then find the The electricity consumption data of the known data is The difference between the electricity consumption data of the known data , If any of the following two conditions is met, the two are considered inconsistent: Condition 1: and ; Condition 2: and ; List Hesitation The calculation method is: ,in, For the The first of the known data The missing rate of original data of each attribute, For the The first of the known data The anomaly rate of the original data of each attribute, Express Round to 2 decimal places; Step 2: Construct a training sample set; The training sample set contains multiple training samples; the training samples are obtained by: selecting A continuous known data, convert the original attribute value in the known data into a ternary attribute, and then As the historical data in the training sample, The data is used as the real future data in the training sample; Step 3: Train the generator and classifier; The training samples The historical data is input into the generator to obtain The predicted data are then judged by the classifier on each predicted data and the real future data, and the hesitation preference consistency between each predicted data and the corresponding real future data is judged. Then, the loss function is calculated based on the hesitation preference consistency and the judgment result of the classifier, and finally the network parameters of the generator and the classifier are updated according to the loss function. In step 3, the training samples in the training sample set are first divided into multiple batches, and then trained in batches; The training process for each batch is as follows: Step 3-1: The training samples in the current batch The historical data are input into the generator respectively, and the corresponding Prediction data; Step 3-2: For each training sample, According to the consistency of hesitation preference between each piece of predicted data and the corresponding real future data, the predicted data are divided into Class I data that conforms to the hesitation preference of the real future data and Class II data that does not conform to the hesitation preference of the real future data; Step 3-3: For each training sample in this batch, calculate the corresponding generator loss and classifier loss respectively; Generator Loss The calculation method is: ; in, is a piece of prediction data obtained for the training sample, Represents a piece of prediction data The result obtained after inputting into the classifier is Indicates that the training sample corresponds to The forecast data of each The vector formed by express A vector of 1s, Indicates the cross entropy loss; Classifier Loss The calculation method is: ; in, is a real future data in the training sample, For a real future data The result obtained after inputting into the classifier is is the training sample The real future data The vector formed by In Representation and All-1 vectors with consistent length; Indicates a piece of predicted data that is judged as Class I data. For a certain type I data The result obtained after inputting into the classifier is is the respective The vector formed by In Representation and All-1 vectors with consistent length; Indicates a piece of predicted data that is judged to be Class II data. For a certain type II data The result obtained after inputting into the classifier is is the respective The vector formed by In Representation and All-zero vectors with the same length; Step 3-4: Calculate the average generator loss and the average classifier loss of all training samples in this batch, and update the network parameters of the generator and the classifier respectively according to the average generator loss and the average classifier loss; In step 3-2, the judgment division method based on the consistency of hesitation preference is: for a certain prediction data, if all the ternary attributes in it meet the following two conditions at the same time, then the prediction data is divided into Class I data, otherwise it is divided into Class II data: Condition a: The middle part of the attribute in the predicted data is within the extended range of the hesitation of the corresponding attribute in the corresponding real future data; The correspondence between the predicted data and the real future data means that the xth predicted data should correspond to the xth future real data under the same training sample; The extended range of the hesitation degree means: if the middle part of the attribute in the real future data is , the range will be expanded With range Take the intersection, which is the extended range of the hesitation degree of the attribute; To expand the radius, is the maximum threshold of hesitation; Condition b: The ratio of the positive part to the negative part of the attribute in the predicted data is equal to the ratio of the positive part to the negative part of the corresponding attribute in the corresponding real future data; Step 4: Use the trained generator to make predictions: The original attribute values in the continuous known data to be predicted are converted into ternary attributes, and the The historical data will then The historical data is input into the generator, and we get The predicted data are extracted and the power consumption data in the predicted data are used as the prediction result.
2. The method for predicting electricity consumption of smart city residents based on hesitant generative adversarial networks according to claim 1, characterized in that: The positively correlated attributes include at least one of the following attributes: average daily power consumption, daily power consumption duration, daily maximum load, daily minimum load, daily load variance, daily power consumption weekly proportion, and monthly cumulative power consumption; The negatively correlated attributes include at least one of the following attributes: weather coefficient, load fluctuation coefficient, regional electricity price, peak duration, number of household appliances, electricity consumption cycle, and energy-saving electricity consumption; The electricity consumption data to be predicted refers to the electricity consumption data for the day.
Citation Information
Patent Citations
Drainage basin multi-point water level prediction and early warning method based on generative adversarial network
CN115688579A
Airfoil flow field prediction method based on improved generative adversarial network and model compression
CN116227364A