Regional electricity consumption prediction method based on hybrid machine learning and spatial address matching
By combining hybrid machine learning and spatial address matching technology, build a mixed prediction model for electricity consumption for different user categories. Considering the electricity sequence, cycle rules and weather factors, the electricity prediction in the existing technology has poor adaptability and cannot inleament to the poor adaptability and cannot be unable to use To achieve the problem of any space prediction, high -precision and flexible regional electricity prediction is achieved.
Patent Information
- Application Number
- CN202111352101.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-16
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2041-11-16
AI Technical Summary
The existing power consumption prediction methods are poorly adaptable in complex application scenarios. Most prediction methods are based on a single model, fail to effectively consider external factors such as weather, and cannot realize power consumption prediction in any spatial area.
Adopt the electrical consumption method based on the mixed machine learning and spatial address matching, transform the text address of the meter into spatial coordinates through spatial address matching technology, use the K-MEANS clustering analysis Each type of user's electricity mixed prediction model is considered to consider recent electricity timing, cyclical electricity usage and weather factors, and use Stacking technology to integrate XGBOOST and LightGBM models to improve predictive accuracy and stability.
It achieves high-precision, flexible-range regional power consumption prediction, can maintain good adaptability and robustness in complex scenarios, and takes into account a variety of factors that affect power consumption.
Smart Images

Figure CN114021837B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of electricity, and in particular to a method for predicting regional electricity consumption based on hybrid machine learning and spatial address matching. Background Art
[0002] Accurately predicting user electricity consumption is of great significance to the optimization and dispatching of power systems. Improving the accuracy of electricity consumption prediction has always been a hot research direction in the construction of smart grids. Electricity consumption prediction is essentially similar to load prediction and is a time series regression problem. Traditional electricity consumption prediction methods include autoregressive moving average model and autoregressive integral sliding model. With the development of machine learning and deep learning, these technologies are used for electricity consumption prediction, such as random forest, support vector machine, long short-term memory network, etc. Through comparison, it is found that deep learning methods generally have better accuracy than traditional methods.
[0003] In summary, there are many electricity consumption forecasting methods at present, but most of the existing forecasts are based on a single model, which has poor adaptability in complex application scenarios, and most of the forecast inputs are historical electricity consumption data, without considering the influence of external factors such as weather; in addition, the current regional electricity consumption forecasts are mostly based on administrative divisions, and it is impossible to achieve electricity consumption forecasts in any spatial area. Therefore, it is of great significance to study a regional electricity consumption forecasting method with high prediction accuracy, flexible prediction range, and strong robustness. Summary of the invention
[0004] In order to overcome the above shortcomings of the prior art, the present invention provides a regional electricity consumption prediction method based on hybrid machine learning and spatial address matching, which can effectively solve the above problems. The specific technical solutions adopted by the present invention are as follows:
[0005] A method for predicting regional electricity consumption based on hybrid machine learning and spatial address matching, comprising the following steps:
[0006] S1. Input the original power consumption monitoring data of all electric meters in the spatial range covering the area to be predicted, including a metadata table and several user tables, wherein the metadata table stores the device category and meter address of each electric meter; each user table records the time series monitoring data of one electric meter, including the monitoring time and the power consumption corresponding to each monitoring time;
[0007] S2. traverse the metadata table, perform spatial address matching analysis on the meter address represented in text form, and map the meter address to spatial point coordinates;
[0008] S3. Perform k-means cluster analysis on the power consumption time series data of all user tables and divide them into multiple user categories according to power consumption characteristics;
[0009] S4. For each type of user, the recent electricity consumption time series, periodic electricity consumption pattern, historical weather conditions and future weather conditions are used as input, and the two machine learning models of XGBoost and LightGBM are integrated using Stacking technology to complete the construction of a hybrid electricity consumption prediction model for each type of user, which is used to predict the electricity consumption on the predicted date;
[0010] S5. Superimpose the spatial area of the area to be predicted and the spatial points of all electric meters to analyze and select the electric meters located in the predicted area;
[0011] S6. Based on the constructed hybrid electricity consumption prediction model, the electricity consumption of each electric meter in the prediction area is predicted, and the prediction results are superimposed. The result is the predicted total electricity consumption of the prediction area.
[0012] Preferably, S2 comprises the following steps:
[0013] S21. Chinese word segmentation: Based on the jieba Chinese word segmentation tool, the monitoring text address recorded in each meter is segmented;
[0014] S22. Generate word vectors: Use the Word2Vec tool to convert the segmented characters into word vectors;
[0015] S23. Generate sentence vector: Generate the address sentence vector based on the frequency of the word vector in the address corpus using the TF-IDF weighted average method;
[0016] S24. Spatial point coordinate mapping: The address sentence vector obtained in S23 is input into the deep text matching model ESIM pre-trained based on the address corpus to obtain the longitude and latitude coordinates corresponding to the address sentence vector, that is, the spatial point coordinates of each electricity meter.
[0017] Preferably, the k-menas clustering described in S3 uses dynamic time warping (DTW) distance as a distance measurement indicator for measuring the distance between power consumption monitoring time series.
[0018] As a preference, the three types of data described in S4 are used as input, namely, the recent power consumption monitoring time series, the periodic power consumption pattern and the weather conditions. The specific input data include:
[0019] (1) Recent electricity consumption monitoring time series: including the user's daily electricity consumption time series data within a month before the predicted date;
[0020] (2) Periodic electricity consumption patterns: including electricity consumption data on the same day as the prediction date in the past b years, electricity consumption data on the same day as the prediction date in the past c weeks, whether the prediction date is a holiday, and whether the prediction date is a weekend;
[0021] (3) Historical weather conditions: time series data consisting of the highest temperature, lowest temperature and humidity of each day within a month before the predicted date;
[0022] (4) Future weather conditions: including the maximum temperature, minimum temperature and humidity on the predicted date.
[0023] Preferably, for any type of user, the construction of the hybrid power consumption prediction model in S4 includes the following sub-steps:
[0024] S41. Training set segmentation: The training data obtained after the input data is standardized and encoded is equally segmented into two parts: training set 1 and training set 2;
[0025] S42. Training the first layer model: The first layer model selects two types of machine learning methods, XGBoost and LightGBM, as power consumption prediction learners. Training set 1 is used for learning the XGBoost model to obtain the prediction model xgb1, and training set 2 is used for learning the LightGBM model to obtain the prediction model lgb1;
[0026] S43. Synthesize a new training set: Use prediction models xgb1 and lgb1 to generate new data features, integrate the prediction results obtained by inputting training set 2 into prediction model xgb1 with the original training set 2 to obtain training set 3, and integrate the prediction results obtained by inputting training set 1 into prediction model lgb1 with the original training set 1 to obtain training set 4;
[0027] S44. Training the second layer model: The second layer model also selects two types of machine learning methods, XGBoost and LightGBM, as power consumption prediction learners, where training set 3 is used for learning the LightGBM model to obtain the prediction model lgb2, and training set 4 is used for learning the XGBoost model to obtain the prediction model xgb2;
[0028] S45. Output the hybrid prediction model: merge the prediction models obtained in S42 and step S44 to obtain two hybrid prediction models, namely, a first hybrid model in which the prediction model xgb1 is in front and the prediction model lgb2 is in the back, and a second hybrid model in which the prediction model lgb2 is in front and the prediction model lgb1 is in the back; compare the prediction effects of the two hybrid prediction models, and select the hybrid prediction model with high prediction accuracy as the final hybrid prediction model for electricity consumption of the current type of users.
[0029] Preferably, when performing word segmentation on the monitoring text address recorded in each electric meter based on the Jieba Chinese word segmentation library as described in S21, precise mode, full mode or search engine mode can be selected.
[0030] Preferably, during the training process of the deep text matching model ESIM described in S24, the input encoding layer uses BiLSTM to extract features, the local reasoning layer uses the attention mechanism to enhance the extracted features, and the BiLSTM is used again in the reasoning combination layer to capture the local reasoning information to obtain the reasoning combination and perform a pooling operation. Finally, the pooling operation result is input into the fully connected layer and the result is sent to the softmax layer; the model input is the address sentence vector corresponding to the text address in the address prediction library, the model output is the spatial point coordinates corresponding to the text address, and the activation function adopts the tanh function.
[0031] Compared with traditional electricity consumption prediction, the present invention has the following benefits: 1. Combined with spatial address matching technology, the text address of the electricity meter is converted into spatial coordinates, and all electricity meters in any area to be predicted can be accurately identified by spatial overlay analysis; 2. Since different users have different electricity consumption patterns, the method performs cluster analysis on all electricity meters, divides users into multiple categories, and constructs electricity consumption prediction models for each category; 3. In addition to considering the recent electricity consumption time series when predicting electricity consumption, the method also considers periodic electricity consumption patterns (such as annual electricity consumption characteristics, weekly electricity consumption characteristics, whether it is a holiday, etc.) and the impact of weather on electricity consumption; 4. Stacking technology is used to integrate multiple machine learning methods, and the constructed hybrid prediction model has better robustness and can be applied to various complex scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 A flowchart of a method for predicting regional electricity consumption based on hybrid machine learning and spatial address matching according to the present invention;
[0033] Figure 2 It is the training graph of the hybrid prediction model for electricity consumption;
[0034] Figure 3 All the electricity meters located in the area to be predicted that are screened out after overlay analysis;
[0035] Figure 4 Figure 3. Effect of different settings of k value for k-means clustering on prediction results (first mixed model). DETAILED DESCRIPTION
[0036] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is described in detail below in conjunction with the accompanying drawings and embodiments.
[0037] On the contrary, the present invention covers any substitution, modification, equivalent method and scheme made on the essence and scope of the present invention as defined by the claims. Further, in order to make the public have a better understanding of the present invention, some specific details are described in detail in the following detailed description of the present invention. Those skilled in the art can fully understand the present invention without the description of these details.
[0038] like Figure 1 As shown, a method for predicting regional electricity consumption based on hybrid machine learning and spatial address matching of the present invention comprises the following steps:
[0039] S1. Input the original electricity consumption monitoring data of all electricity meters in the spatial range covering the area to be predicted, including a metadata table and several user tables. The metadata table stores the device category and meter address of each electricity meter; each user table records the time series monitoring data of an electricity meter, including the monitoring time and the electricity consumption corresponding to each monitoring time.
[0040] S2. Traverse the metadata table, perform spatial address matching analysis on the meter addresses represented in text form, and map the meter addresses to spatial point coordinates; specifically, it includes the following sub-steps:
[0041] S21. Chinese word segmentation: Based on the jieba Chinese word segmentation tool, the monitoring text address recorded in each meter is segmented. When segmenting, you can choose precise mode, full mode or search engine mode. Here, the precise mode is selected.
[0042] S22. Generate word vectors: Use the Word2Vec tool to convert the segmented characters into word vectors;
[0043] S23. Generate sentence vector: Generate the address sentence vector based on the frequency of the word vector in the address corpus using the TF-IDF weighted average method;
[0044] S24. Spatial point coordinate mapping: Input the address sentence vector obtained in S23 into the deep text matching model ESIM pre-trained based on the address corpus to obtain the longitude and latitude coordinates corresponding to the address sentence vector, that is, the spatial point coordinates of each electric meter;
[0045] Specifically, the input encoding layer of the ESIM model uses BiLSTM for feature extraction, the local reasoning layer uses the attention mechanism to enhance the extracted features, and the reasoning combination layer uses BiLSTM again to capture local reasoning information to obtain the reasoning combination and perform pooling operations. Finally, the pooling operation results are input into the fully connected layer and the results are sent to the softmax layer. The model input is the address sentence vector corresponding to the text address in the address prediction library, and the model output is the spatial point coordinates corresponding to the text address. The activation function uses the tanh function.
[0046] S3. Perform k-means clustering analysis on the electricity consumption time series data of all user tables and divide them into multiple user categories according to the electricity consumption characteristics. Dynamic time warping (DTW) distance is used as the distance measurement indicator to measure the distance between electricity consumption monitoring time series during clustering analysis. In addition, k-means clustering requires the selection of k as the number of categories. Here, 8 k values from 1 to 8 are selected for experiments, and the k value with the best final prediction effect is selected from them.
[0047] S4. For each type of user, the recent electricity consumption time series, periodic electricity consumption pattern, historical weather conditions and future weather conditions are used as input, and the Stacking technology is used to fuse the two machine learning models of XGBoost and LightGBM to complete the construction of a hybrid electricity consumption prediction model for each type of user, which is used to predict the electricity consumption on the predicted date.
[0048] The four types of input data are:
[0049] (1) Recent electricity consumption monitoring time series: including the user's daily electricity consumption time series data within a month before the predicted date;
[0050] (2) Periodic electricity consumption patterns: including electricity consumption data on the same day as the prediction date in the past b years, electricity consumption data on the same day as the prediction date in the past c weeks, whether the prediction date is a holiday, and whether the prediction date is a weekend;
[0051] (3) Historical weather conditions: time series data consisting of the highest temperature, lowest temperature and humidity of each day within a month before the predicted date;
[0052] (4) Future weather conditions: including the maximum temperature, minimum temperature and humidity on the predicted date.
[0053] The construction of the hybrid prediction model is as follows Figure 2 As shown, it specifically includes the following sub-steps:
[0054] S41. Training set segmentation: The training data obtained after the input data is standardized and encoded is equally segmented into two parts: training set 1 and training set 2;
[0055] S42. Training the first layer model: The first layer model selects two types of machine learning methods, XGBoost and LightGBM, as power consumption prediction learners. Training set 1 is used for learning the XGBoost model to obtain the prediction model xgb1, and training set 2 is used for learning the LightGBM model to obtain the prediction model lgb1;
[0056] S43. Synthesize a new training set: Use prediction models xgb1 and lgb1 to generate new data features, integrate the prediction results obtained by inputting training set 2 into prediction model xgb1 with the original training set 2 to obtain training set 3, and integrate the prediction results obtained by inputting training set 1 into prediction model lgb1 with the original training set 1 to obtain training set 4;
[0057] S44. Training the second layer model: The second layer model also selects two types of machine learning methods, XGBoost and LightGBM, as power consumption prediction learners, where training set 3 is used for learning the LightGBM model to obtain the prediction model lgb2, and training set 4 is used for learning the XGBoost model to obtain the prediction model xgb2;
[0058] S45. Output the hybrid prediction model: merge the prediction models obtained in S42 and step S44 to obtain two hybrid prediction models, namely, a first hybrid model in which the prediction model xgb1 is in front and the prediction model lgb2 is in the back, and a second hybrid model in which the prediction model lgb2 is in front and the prediction model lgb1 is in the back; compare the prediction effects of the two hybrid prediction models, and select the hybrid prediction model with high prediction accuracy as the final hybrid prediction model for electricity consumption of the current type of users.
[0059] S5. Superimpose the spatial area of the area to be predicted and the spatial points of all electric meters to analyze and select the electric meters located in the predicted area;
[0060] S6. Based on the constructed hybrid electricity consumption prediction model, the electricity consumption of each electric meter in the prediction area is predicted, and the prediction results are added together. The result is the predicted total electricity consumption of the prediction area.
[0061] Based on the above method flow of S1 to S6, the technical effect is further demonstrated through examples.
[0062] Example
[0063] The steps of this embodiment are the same as those of the above-mentioned specific implementation method, and will not be repeated here. The following is a demonstration of some implementation processes and implementation results:
[0064] This example uses the historical electricity consumption data of a city and collects the weather forecast data of the area, with a time span of nearly 3 years. The above data is standardized, and the missing data is filled with the average value, and then the regional electricity consumption forecast is performed using the method of the present invention:
[0065] Figure 3 This is the result of superimposing the spatial point coordinates of the area to be predicted and all the electricity meters in the city. A total of 11 electricity meters in the area to be predicted were screened out.
[0066] Figure 4 The figure shows the result of k-means clustering analysis of user categories for all electricity meters in the city. Since the number of clusters in the k-means clustering analysis mainly depends on the preset k value, in this embodiment, values of 1 to 8 are taken for experiments. The results show that as the number of clusters increases, the prediction error of the overall electricity consumption continues to decrease, because the increase in cluster predictions means more types and more accurate predictions, but the increase in the number of clusters will also lead to an increase in the amount of calculation. Therefore, after comprehensive consideration, this implementation selects the final number of clusters as 5, which can take into account both prediction accuracy and calculation amount.
[0067] Table 1 is the final result of regional electricity consumption forecast (taking k = 5), which is divided into two parts. The first part is a comparison with four single models, namely, Random Frost (RF), Support Vector Machine (SVM), and XGBoost and LightGBM, which are common time series forecasting models. The second part is a comparison of two hybrid models (the first hybrid model-XGBoost+LightGBM, the second hybrid model-LightGBM+XGBoost). It can be seen from the results that the results of the hybrid model are significantly better than those of the single model, which confirms that the hybrid prediction model proposed in this paper effectively improves the prediction accuracy. It is worth noting that the prediction effect of the second hybrid model is slightly better than that of the first hybrid model. This is because LightGBM uses a histogram strategy to discretize continuous eigenvalues, which in turn has a certain impact on the prediction accuracy. Therefore, when it is used as the second-layer prediction output model, the effect is slightly worse. However, the advantage of this strategy is that it can greatly save the memory occupied by the read-in data and prevent overfitting to a certain extent. Therefore, when processing massive data, its training cycle is shorter and the prediction accuracy can be maintained.
[0068] Table 1 is the comparison results of the experimental results of the present invention and other prediction methods (k=5)
[0069]
[0070] The above-described embodiment is only a preferred solution of the present invention, but it is not intended to limit the present invention. A person skilled in the relevant technical field may make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, any technical solution obtained by equivalent replacement or equivalent transformation falls within the protection scope of the present invention.
Claims
1. A regional electricity consumption prediction method based on hybrid machine learning and spatial address matching, characterized in that The following steps are involved: S1. Input the original power consumption monitoring data of all electric meters in the spatial range covering the area to be predicted, including a metadata table and several user tables, wherein the metadata table stores the device category and meter address of each electric meter; each user table records the time series monitoring data of one electric meter, including the monitoring time and the power consumption corresponding to each monitoring time; S2. traverse the metadata table, perform spatial address matching analysis on the meter address represented in text form, and map the meter address to spatial point coordinates; S3. Perform k-means cluster analysis on the power consumption time series data of all user tables and divide them into multiple user categories according to power consumption characteristics; S4. For each type of user, the recent electricity consumption time series, periodic electricity consumption pattern, historical weather conditions and future weather conditions are used as input, and the two machine learning models of XGBoost and LightGBM are integrated using Stacking technology to complete the construction of a hybrid electricity consumption prediction model for each type of user, which is used to predict the electricity consumption on the predicted date; The construction of hybrid electricity consumption prediction model includes the following sub-steps: S41. Training set segmentation: The training data obtained after the input data is standardized and encoded is equally segmented into two parts: training set 1 and training set 2; S42. Training the first layer model: The first layer model selects two types of machine learning methods, XGBoost and LightGBM, as power consumption prediction learners. Training set 1 is used for learning the XGBoost model to obtain the prediction model xgb1, and training set 2 is used for learning the LightGBM model to obtain the prediction model lgb1; S43. Synthesize a new training set: Use prediction models xgb1 and lgb1 to generate new data features, integrate the prediction results obtained by inputting training set 2 into prediction model xgb1 with the original training set 2 to obtain training set 3, and integrate the prediction results obtained by inputting training set 1 into prediction model lgb1 with the original training set 1 to obtain training set 4; S44. Training the second layer model: The second layer model also selects two types of machine learning methods, XGBoost and LightGBM, as power consumption prediction learners, where training set 3 is used for learning the LightGBM model to obtain the prediction model lgb2, and training set 4 is used for learning the XGBoost model to obtain the prediction model xgb2; S45. Output the hybrid prediction model: merge the prediction models obtained in step S42 and step S44 to obtain two hybrid prediction models, namely, a first hybrid model in which the prediction model xgb1 is in front and the prediction model lgb2 is in the back, and a second hybrid model in which the prediction model lgb2 is in front and the prediction model lgb1 is in the back; compare the prediction effects of the two hybrid prediction models, and select the hybrid prediction model with high prediction accuracy as the final hybrid prediction model for the power consumption of the current type of user; S5. Overlay analysis is performed on the spatial area of the area to be predicted and the spatial points of all electric meters to select the electric meters located in the predicted area; S6. Based on the constructed hybrid electricity consumption prediction model, the electricity consumption of each electric meter in the prediction area is predicted, and the prediction results are added together. The result is the predicted total electricity consumption of the prediction area.
2. The regional electricity consumption prediction method based on hybrid machine learning and spatial address matching as claimed in claim 1 is characterized in that The S2 comprises the following steps: S21. Chinese word segmentation: Based on the jieba Chinese word segmentation tool, the monitoring text address recorded in each meter is segmented; S22. Generate word vectors: Use the Word2Vec tool to convert the segmented characters into word vectors; S23. Generate sentence vector: Generate the address sentence vector based on the frequency of the word vector in the address corpus using the TF-IDF weighted average method; S24. Spatial point coordinate mapping: The address sentence vector obtained in S23 is input into the deep text matching model ESIM pre-trained based on the address corpus to obtain the longitude and latitude coordinates corresponding to the address sentence vector, that is, the spatial point coordinates of each electricity meter.
3. The regional electricity consumption prediction method based on hybrid machine learning and spatial address matching as claimed in claim 1 is characterized in that In the k-means clustering described in S3, dynamic time warping (DTW) distance is used as a distance metric to measure the distance between power consumption monitoring time series.
4. The regional electricity consumption prediction method based on hybrid machine learning and spatial address matching as claimed in claim 1 is characterized in that As described in S4, the three types of data, namely, recent power consumption time series, periodic power consumption pattern and weather conditions, are used as input. The specific input data include: (1) Recent electricity consumption monitoring time series: including the user's daily electricity consumption time series data within a month before the predicted date; (2) Periodic electricity consumption patterns: including electricity consumption data on the same day as the prediction date in the past b years, electricity consumption data on the same day as the prediction date in the past c weeks, whether the prediction date is a holiday, and whether the prediction date is a weekend; (3) Historical weather conditions: time series data consisting of the highest temperature, lowest temperature and humidity of each day within a month before the predicted date; (4) Future weather conditions: including the maximum temperature, minimum temperature and humidity on the predicted date.
5. The regional electricity consumption prediction method based on hybrid machine learning and spatial address matching as claimed in claim 2 is characterized in that When performing word segmentation on the monitoring text address recorded in each electric meter based on the jieba Chinese word segmentation library as described in S21, the precise mode, the full mode or the search engine mode can be selected.
6. The regional electricity consumption prediction method based on hybrid machine learning and spatial address matching as claimed in claim 2 is characterized in that During the training process of the deep text matching model ESIM described in S24, the input encoding layer uses BiLSTM for feature extraction, the local reasoning layer uses the attention mechanism to enhance the extracted features, and the reasoning combination layer uses BiLSTM again to capture the local reasoning information to obtain the reasoning combination and perform pooling operations. Finally, the pooling operation results are input into the fully connected layer and the results are sent to the softmax layer; the model input is the address sentence vector corresponding to the text address in the address prediction library, the model output is the spatial point coordinates corresponding to the text address, and the activation function uses the tanh function.
Citation Information
Patent Citations
Power load forecasting method based on customer segmentation in power industry
CN102999791A
User electricity consumption relevant factor identification and electricity consumption quantity prediction method under environment of big data
CN105512768A