Power load prediction method, system and equipment based on clustering and ensemble learning, and medium
By using clustering and ensemble learning methods, power load data is classified and models are combined, which solves the problems of low prediction accuracy and weak robustness caused by data heterogeneity, and achieves efficient and accurate load prediction in complex scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- STATE GRID HUNAN ELECTRIC POWER CO LTD ELECTRIC POWER SCI RES INST
- Filing Date
- 2026-01-12
- Publication Date
- 2026-05-12
AI Technical Summary
Existing load forecasting technologies fail to effectively handle data heterogeneity, resulting in low forecast accuracy, weak robustness, poor adaptability in complex scenarios, difficulty in capturing characteristic patterns in specific scenarios, and high computational complexity of deep learning models, which limits real-time scheduling applications.
Historical power load data is classified using clustering algorithms, the optimal number of clusters is selected, and multiple prediction algorithms are combined for training to build an ensemble model. A combination of base learners and meta-learners is used to establish an ensemble model for each cluster for prediction.
It significantly reduces prediction errors, enhances adaptability to multidimensional characteristics and non-stationary loads, improves prediction consistency and anti-interference capabilities, and balances computational efficiency, making it suitable for real-time applications of large-scale power grid data.
Smart Images

Figure CN122026318A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of machine learning and power load forecasting technology, and in particular to a power load forecasting method, system, device and medium based on clustering and ensemble learning. Background Technology
[0002] Electricity load forecasting is a key technology in power system operation and planning. It predicts electricity demand over a future period by analyzing historical load data, weather, and holiday factors. Accurate load forecasting is crucial for the economic operation, safety, stability, and environmental protection of the power system. Through precise load forecasting, power companies can more effectively schedule power generation, reduce unnecessary generation costs, and improve energy efficiency. Furthermore, accurate load forecasting helps grid operators adjust their power supply strategies in a timely manner, preventing grid failures caused by supply-demand imbalances and ensuring the safe and stable operation of the power system.
[0003] Currently, load forecasting technology mainly relies on traditional statistical models and machine learning methods. Traditional methods, such as Autoregressive Integral Moving Average (ARIMA), depend on linear assumptions and struggle to capture the non-stationary characteristics of load. While single machine learning models, such as Support Vector Machines (SVM) and Long Short-Term Memory Networks (LSTM), can extract temporal dependencies, their ability to fuse multi-dimensional features is limited. In recent years, ensemble learning techniques (such as Random Forests and Gradient Boosting Trees) have partially improved prediction robustness by combining the prediction results of multiple models; however, their base learners are highly homogeneous and do not consider the heterogeneity of load data. For example, the electricity consumption patterns of residential, commercial, and industrial loads differ significantly, and when mixed-modeling is used, different patterns interfere with each other, leading to insufficient sensitivity of the model to local features and a decrease in prediction accuracy.
[0004] The limitations of existing technologies are mainly reflected in the following aspects: First, most methods do not classify the load data, and the mixed input of heterogeneous loads makes it difficult for models to capture the characteristic patterns in subdivided scenarios; second, single models or simple ensemble strategies are difficult to balance bias and variance, and overfitting or underfitting problems easily occur in complex scenarios; in addition, although deep learning models can extract temporal dependencies, their high computational complexity limits their application in real-time scheduling. Therefore, there is an urgent need for a prediction method that can integrate load classification characteristics and the advantages of multiple models to improve prediction accuracy and generalization ability in complex scenarios. Summary of the Invention
[0005] This invention provides a power load forecasting method, system, device, and medium based on clustering and ensemble learning, to overcome the problems of low forecasting accuracy and weak robustness caused by data heterogeneity, insufficient model generalization ability, and poor adaptability to complex scenarios in existing load forecasting technologies.
[0006] Firstly, a power load forecasting method based on clustering and ensemble learning is provided, comprising the following steps:
[0007] Historical power load data is preprocessed, and sample data is obtained using the sliding window method;
[0008] Clustering algorithms are used to cluster the sample data, and the silhouette coefficients under different numbers of clusters are calculated to select the optimal cluster.
[0009] Train a variety of pre-selected prediction algorithms, obtain the prediction error of each prediction algorithm, analyze the differences between different prediction algorithms, and select the optimal combination of prediction algorithms as the base learner combination.
[0010] In each cluster, the selected prediction algorithms are used as meta-learners and trained one by one. The prediction algorithm with the smallest prediction error is selected as the meta-learner for that cluster, thereby establishing an ensemble model for each cluster.
[0011] The system acquires real-time power load data sequences, determines their respective clusters, and calls the ensemble model of the corresponding cluster to perform power load forecasting.
[0012] Furthermore, the preprocessing of historical power load data includes: data cleaning and normalization of the historical power load data.
[0013] Furthermore, the process of selecting the optimal clustering includes:
[0014] Different numbers of clusters are set, and the sample data is clustered under different numbers of clusters using the K-Medoids algorithm;
[0015] Calculate the silhouette coefficient for different numbers of clusters, and select the clustering result corresponding to the number of clusters with the largest silhouette coefficient as the optimal cluster.
[0016] Furthermore, the selection process for the base learner combination includes:
[0017] Multiple prediction algorithms are selected in advance;
[0018] The sample data was used to train a variety of pre-selected prediction algorithms individually, and the prediction error of each prediction algorithm was obtained.
[0019] The Pearson correlation coefficient was used to analyze the differences between different prediction algorithms;
[0020] Based on the prediction error, multiple prediction algorithms are sorted in ascending order. Then, the top m prediction algorithms that satisfy the condition that the Pearson correlation coefficient between them is less than a threshold are selected as the optimal combination of prediction algorithms, and these are used as the base learner combination.
[0021] Furthermore, the process of building the ensemble model for each cluster includes:
[0022] An integrated model framework is constructed, with the first layer built by a combination of base learners, and the second layer built by any one of the prediction algorithms in the optimal combination of prediction algorithms. The meta-learner takes the original input and the output of the combination of the first layer base learners as input.
[0023] The base learner combination is retrained in each cluster. Then, the selected prediction algorithms are used as meta-learners and trained one by one. The prediction algorithm with the smallest prediction error is selected as the meta-learner of the cluster, and the ensemble model of the cluster is obtained.
[0024] Furthermore, the process of retraining the base learner combination in each cluster includes:
[0025] Let the combination of base learners be {f1, f2, …, f m}, f m This represents the m-th base learner;
[0026] For each cluster C k Clustering C k The samples in the dataset are divided into training set D. train,k With test set D test,k ;
[0027] Using an m-fold cross-validation strategy, D train,k Divide into m parts, and use one part as the validation subset in a traversal manner, and use the remaining m-1 parts as the training subset to train each base learner in turn.
[0028] The meta-learner selection process includes:
[0029] Construct training and testing datasets for the meta-learner, and combine the original samples with the predictions of each base learner for that original sample to obtain the training samples for the meta-learner. ;in , Let be the input features and labels of the i-th original sample, respectively. Let m represent the prediction value of the m-th base learner for the i-th original sample; As input to the meta-learner, As the corresponding tag;
[0030] Each of the selected prediction algorithms is used as a meta-learner and trained using the training sample dataset of the meta-learner. The meta-learner is then tested using the test sample dataset of the meta-learner. The prediction algorithm with the smallest prediction error is selected as the meta-learner for this cluster.
[0031] Secondly, a power load forecasting system based on clustering and ensemble learning is provided, including:
[0032] The sample data acquisition module is used to preprocess historical power load data and acquire sample data using the sliding window method.
[0033] The clustering module is used to cluster sample data using clustering algorithms, calculate the silhouette coefficient under different numbers of clusters, and select the optimal cluster.
[0034] The base learner selection module is used to train a variety of pre-selected prediction algorithms, obtain the prediction error of each prediction algorithm, analyze the differences between different prediction algorithms, and select the optimal combination of prediction algorithms as the base learner combination.
[0035] The ensemble model building module is used to train each selected prediction algorithm as a meta-learner in each cluster, and select the prediction algorithm with the smallest prediction error as the meta-learner for that cluster, thereby building an ensemble model for each cluster.
[0036] The real-time forecasting module is used to acquire real-time power load data sequences, determine their respective clusters, and call the ensemble model of the respective clusters to perform power load forecasting.
[0037] Furthermore, the process of preprocessing historical power load data by the sample data acquisition module includes: data cleaning and normalization of the historical power load data.
[0038] Furthermore, the clustering module selects the optimal clustering process, which includes:
[0039] Different numbers of clusters are set, and the sample data is clustered under different numbers of clusters using the K-Medoids algorithm;
[0040] Calculate the silhouette coefficient for different numbers of clusters, and select the clustering result corresponding to the number of clusters with the largest silhouette coefficient as the optimal cluster.
[0041] Furthermore, the process of selecting a combination of base learners by the base learner selection module includes:
[0042] Multiple prediction algorithms are selected in advance;
[0043] The sample data was used to train a variety of pre-selected prediction algorithms individually, and the prediction error of each prediction algorithm was obtained.
[0044] The Pearson correlation coefficient was used to analyze the differences between different prediction algorithms;
[0045] Based on the prediction error, multiple prediction algorithms are sorted in ascending order. Then, the top m prediction algorithms that satisfy the condition that the Pearson correlation coefficient between them is less than a threshold are selected as the optimal combination of prediction algorithms, and these are used as the base learner combination.
[0046] Furthermore, the process of establishing an ensemble model for each cluster by the ensemble model building module includes:
[0047] An integrated model framework is constructed, with the first layer built by a combination of base learners, and the second layer built by any one of the prediction algorithms in the optimal combination of prediction algorithms. The meta-learner takes the original input and the output of the combination of the first layer base learners as input.
[0048] The base learner combination is retrained in each cluster. Then, the selected prediction algorithms are used as meta-learners and trained one by one. The prediction algorithm with the smallest prediction error is selected as the meta-learner of the cluster, and the ensemble model of the cluster is obtained.
[0049] Furthermore, the process of retraining the base learner combination in each cluster includes:
[0050] Let the combination of base learners be {f1, f2, …, f m}, f m This represents the m-th base learner;
[0051] For each cluster C k Clustering C k The samples in the dataset are divided into training set D. train,k With test set D test,k ;
[0052] Using an m-fold cross-validation strategy, D train,k Divide into m parts, and use one part as the validation subset in a traversal manner, and use the remaining m-1 parts as the training subset to train each base learner in turn.
[0053] The meta-learner selection process includes:
[0054] Construct training and testing datasets for the meta-learner, and combine the original samples with the predictions of each base learner for that original sample to obtain the training samples for the meta-learner. ;in , Let be the input features and labels of the i-th original sample, respectively. Let m represent the prediction value of the m-th base learner for the i-th original sample; As input to the meta-learner, As the corresponding tag;
[0055] Each of the selected prediction algorithms is used as a meta-learner and trained using the training sample dataset of the meta-learner. The meta-learner is then tested using the test sample dataset of the meta-learner. The prediction algorithm with the smallest prediction error is selected as the meta-learner for this cluster.
[0056] Thirdly, an electronic device is provided, comprising:
[0057] A memory on which computer programs are stored;
[0058] A processor is used to load and execute the computer program to implement the power load forecasting method based on clustering and ensemble learning as described above.
[0059] Fourthly, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the power load forecasting method based on clustering and ensemble learning as described above.
[0060] This invention proposes a power load forecasting method, system, device, and medium based on clustering and ensemble learning. Compared with existing technologies, this invention has the following advantages: First, clustering preprocessing reduces data complexity, enabling the model to capture local load characteristics more precisely, thereby significantly reducing prediction errors. Second, the ensemble model framework effectively suppresses the overfitting tendency of a single model through differentiated base learner combinations and meta-learner weight optimization, enhancing its adaptability to multi-dimensional features and non-stationary loads, and exhibiting strong prediction consistency, anti-interference ability, and generalization performance in complex load scenarios. Third, this invention balances computational efficiency and prediction accuracy; the combination of clustering algorithms and lightweight ensemble strategies ensures real-time performance while being scalable to large-scale power grid data applications. Attached Figure Description
[0061] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0062] Figure 1 This is a flowchart illustrating the implementation of the power load forecasting method based on clustering and ensemble learning provided in this embodiment of the invention.
[0063] Figure 2 This is the clustering result of the K-Medoids algorithm provided in this embodiment of the invention;
[0064] Figure 3 This is the correlation coefficient matrix between the prediction errors of different prediction algorithms provided in the embodiments of the present invention;
[0065] Figure 4 The prediction results are provided by the power load prediction method based on clustering and ensemble learning in the embodiments of the present invention. Detailed Implementation
[0066] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be described in detail below. Obviously, the described embodiments are merely some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other implementation methods obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0067] like Figure 1 As shown, this embodiment of the invention provides a power load forecasting method based on clustering and ensemble learning, including the following steps:
[0068] S1: Preprocess historical power load data and use the sliding window method to obtain sample data.
[0069] In this embodiment, the preprocessing of historical power load data includes: data cleaning and normalization to provide high-quality input for subsequent modeling. Data cleaning includes, but is not limited to, removing outliers and interpolating to fill in missing values. After data cleaning, the data is normalized using Min-Max normalization to map the load values to the [0,1] interval, eliminating the impact of dimensional differences on model training.
[0070] To preserve the temporal dependence and periodicity of electricity load, this embodiment uses a sliding window method to acquire sample data. The sliding window adopts a length design of P+Q, where P is the length of the input and Q is the length of the predicted output. The specific length of the sliding window is selected according to actual needs. For example, the following explanation uses electricity load data from a certain region in 2018, with a data sampling interval of 15 minutes and a total of 96 data sampling points per day. For electricity load data with a sampling interval of 15 minutes, the window length is set to 96+1 data points, the sliding step size is 1 data point, and the first 96 data points within the window are used as the input feature x. i The 97th data point is used as the prediction target y. i Sample D was obtained. i ={x i , y i}
[0071] S2: Use a clustering algorithm to cluster the sample data, calculate the silhouette coefficient under different numbers of clusters, and select the optimal cluster.
[0072] In this embodiment, the K-Medoids algorithm is used for clustering. The K-Medoids algorithm divides the dataset into K clusters {C1, C2, …, C6} by minimizing the sum of the distances from a set of objects to the centroids representing that set. K Cluster center μ k Determined by minimizing the total distance cost:
[0073] ;
[0074] In the formula, x represents the input feature of the i-th sample. i With the kth cluster C k Cluster center μ k The distance between them. In this embodiment, Euclidean distance is used as the distance metric for the K-Medoids algorithm, and its calculation formula is as follows:
[0075] ;
[0076] in, x represents i The eigenvalues at time point p.
[0077] During the clustering process, k actual samples are first randomly selected as initial centroids. Then, each sample is classified into the nearest centroid cluster. Non-centroid samples are traversed, centroids are tried to be replaced and the total distance cost is calculated. The centroid combination with the lowest cost is selected and iterated until the centroids are stable or the maximum number of iterations is reached.
[0078] Therefore, the process of selecting the optimal clustering includes:
[0079] Different numbers of clusters are set, and the sample data is clustered under different numbers of clusters using the K-Medoids algorithm;
[0080] Calculate the silhouette coefficient for different numbers of clusters, and select the clustering result corresponding to the number of clusters with the largest silhouette coefficient as the optimal cluster.
[0081] The silhouette coefficient is used to measure the quality of clustering, and its calculation formula is as follows:
[0082] ;
[0083] in, Let represent the silhouette coefficient of the i-th sample; a(i) is the average distance from the i-th sample to other samples in the same cluster, and b(i) is the average distance from the i-th sample to its nearest neighbor. When selecting the cluster with the largest silhouette coefficient as the optimal cluster, the mean of the silhouette coefficients of all samples is used as the criterion. It should be noted that other clustering algorithms, such as the K-Means algorithm, can be selected as needed in other embodiments.
[0084] The pre-set cluster number range is [2, 13]. The silhouette coefficients for different cluster numbers are shown in Table 1. As can be seen from the table, the K-Medoids algorithm achieves the largest silhouette coefficient when the cluster number is 2; therefore, the optimal cluster number is 2. When the cluster number is 2, the clustering results for the load data are as follows: Figure 2 As shown, the load values in cluster 1 are relatively small and the load fluctuations are not significant, while the load in cluster 2 shows obvious peak-valley differences.
[0085]
[0086] S3: Train a variety of pre-selected prediction algorithms, obtain the prediction error of each prediction algorithm, analyze the differences between different prediction algorithms, and select the optimal combination of prediction algorithms as the base learner combination.
[0087] Specifically, the process of selecting the base learner combination includes:
[0088] Appropriate prediction algorithms are pre-selected. In this embodiment, seven prediction algorithms are pre-selected for training, including Gradient Boosting Decision Tree (GBDT), Extreme Gradient Boosting (XGBoost), Light Gradient Boosting Machine (LightGBM), Random Forest (RF), k-Nearest Neighbors (KNN), Logistic Regression (LR), and Support Vector Regression (SVR).
[0089] The sample data was divided into a training set and a test set in an 8:2 ratio. Then, the training set and the test set were used to train and test a variety of pre-selected prediction algorithms separately, and the prediction error of each prediction algorithm was obtained.
[0090] The Pearson correlation coefficient was used to analyze the differences between different prediction algorithms. The Pearson correlation coefficient between prediction algorithms was calculated using the following formula:
[0091] ;
[0092] In the formula, e represents the Pearson correlation coefficient between prediction algorithm A and prediction algorithm B. A e B These are the prediction errors of prediction algorithm A and prediction algorithm B, respectively. , are the average prediction errors of prediction algorithm A and prediction algorithm B, respectively, where the subscript i represents the i-th sample, and M is the number of samples;
[0093] Based on the prediction error, multiple prediction algorithms are sorted in ascending order. Then, the top m prediction algorithms that satisfy the condition that the Pearson correlation coefficient between them is less than a threshold are selected as the optimal combination of prediction algorithms, and these are used as the base learner combination.
[0094] Figure 3 The Pearson correlation coefficient matrix of prediction errors among different prediction algorithms is shown in Table 2, which displays the prediction errors of different algorithms. Figure 3 As can be seen from Table 2, since GBDT, XGBoost, LightGBM, and RF are based on similar principles, the correlation coefficients of their prediction errors are all greater than 0.9. Integrating these four algorithms might easily amplify the error. Therefore, according to Table 2, XGBoost and LightGBM, which have the lowest MAE and MSE, were selected as the base learners. The other algorithms have low correlation coefficients of prediction errors, so they were all adopted. In conclusion, XGBoost, LightGBM, KNN, LR, and SVR were ultimately selected as the five base learners.
[0095]
[0096] S4: In each cluster, the selected prediction algorithms are used as meta-learners and trained one by one. The prediction algorithm with the smallest prediction error is selected as the meta-learner for that cluster, thereby establishing an ensemble model for each cluster.
[0097] Specifically, the process of building the ensemble model for each cluster includes:
[0098] An integrated model framework is constructed, with the first layer built by a combination of base learners, and the second layer built by any one of the prediction algorithms in the optimal combination of prediction algorithms. The meta-learner takes the original input and the output of the combination of the first layer base learners as input.
[0099] The base learner combination is retrained in each cluster. Then, the selected prediction algorithms are used as meta-learners and trained one by one. The prediction algorithm with the smallest prediction error is selected as the meta-learner of the cluster, and the ensemble model of the cluster is obtained.
[0100] The process of retraining the base learner combination in each cluster includes:
[0101] Let the combination of base learners be {f1, f2, …, f m}, f m This represents the m-th base learner;
[0102] For each cluster C k Clustering C k The samples in the dataset are divided into training set D. train,k With test set D test,k ;
[0103] Using an m-fold cross-validation strategy, D train,k Divide the data into m parts, and use one part as the validation subset and the remaining m-1 parts as the training subset to train each base learner in turn to obtain better differentiation.
[0104] The meta-learner selection process includes:
[0105] The current clustering training set D train,k With test set D test,k For each original sample, combine it with the predictions made by each base learner for that original sample to obtain the meta-learner training sample. ;in , Let be the input features and labels of the i-th original sample, respectively. Let m represent the prediction value of the m-th base learner for the i-th original sample; As input to the meta-learner, As corresponding labels, the training sample dataset for the meta-learner is thus constructed. and test sample dataset ;
[0106] Each selected prediction algorithm is used as a meta-learner, and the training sample dataset of the meta-learners is used. Train the model using the test sample dataset of the meta-learner. Tests were conducted, and the prediction algorithm with the smallest prediction error was selected as the meta-learner for this cluster.
[0107] Based on the load data of the two clusters, each prediction algorithm was trained. The MAE and MSE on the test set after training are shown in Table 3. It can be seen that after clustering, the prediction performance of all single models except the SVR algorithm improved, with both MAE and MSE being better than the un-clustered case. The ensemble models also showed similar characteristics; except for the model using SVR as the meta-learner, the MAE and MSE of the other models all improved. This demonstrates the superiority of ensemble models, namely, by selecting multiple base models, it is beneficial to overcome the performance instability of single models when facing data in different scenarios, thereby improving the model's generalization ability. Among the ensemble models of the two clusters, the ensemble learning model using LR as the meta-learner achieved the best prediction performance; therefore, it was selected as the meta-learner for the two cluster ensemble models. Ensemble models were constructed independently for clusters 1 and 2. The prediction results of the two clusters were concatenated according to their chronological order to obtain the final prediction result. Some prediction results are shown below. Figure 4 As shown.
[0108]
[0109] For each cluster C k Each cluster establishes an independent ensemble model through the above process. Different clusters of load data will have their own exclusive ensemble models to ensure that the model can fully adapt to the special patterns of that type of load.
[0110] S5: Obtain the real-time collected power load data sequence, determine its cluster, and call the ensemble model of the cluster to perform power load prediction.
[0111] If multi-step rolling forecasting is required, the predicted power load values can be spliced into the power load data sequence. Then, the process of determining the cluster to which it belongs and calling the ensemble model of the cluster to perform power load forecasting can be repeated. Finally, the forecast results are spliced together according to their time sequence to obtain a complete load forecast curve.
[0112] The power load forecasting method based on clustering and ensemble learning provided in the above embodiments has the following advantages: First, clustering preprocessing reduces data complexity, enabling the model to capture local load characteristics more precisely, thereby significantly reducing prediction errors. Second, the ensemble model framework effectively suppresses the overfitting tendency of a single model through differentiated base learner combinations and meta-learner weight optimization, enhancing its adaptability to multi-dimensional features and non-stationary loads, and exhibiting strong prediction consistency, anti-interference ability, and generalization performance in complex load scenarios. Third, this invention balances computational efficiency and prediction accuracy; the combination of clustering algorithms and lightweight ensemble strategies ensures real-time performance while being scalable to large-scale power grid data applications.
[0113] This invention also provides a power load forecasting system based on clustering and ensemble learning, comprising:
[0114] The sample data acquisition module is used to preprocess historical power load data and acquire sample data using the sliding window method. The preprocessing process includes data cleaning and normalization of the historical power load data.
[0115] The clustering module is used to cluster sample data using clustering algorithms, calculate the silhouette coefficient under different numbers of clusters, and select the optimal cluster.
[0116] Specifically, the clustering module selects the optimal clustering process, which includes:
[0117] Different numbers of clusters are set, and the sample data is clustered under different numbers of clusters using the K-Medoids algorithm;
[0118] Calculate the silhouette coefficient for different numbers of clusters, and select the clustering result corresponding to the number of clusters with the largest silhouette coefficient as the optimal cluster.
[0119] The base learner selection module is used to train a variety of pre-selected prediction algorithms, obtain the prediction error of each prediction algorithm, analyze the differences between different prediction algorithms, and select the optimal combination of prediction algorithms as the base learner combination.
[0120] Specifically, the process of selecting a combination of base learners by the base learner selection module includes:
[0121] Multiple prediction algorithms are selected in advance;
[0122] The sample data was used to train a variety of pre-selected prediction algorithms individually, and the prediction error of each prediction algorithm was obtained.
[0123] The Pearson correlation coefficient was used to analyze the differences between different prediction algorithms;
[0124] Based on the prediction error, multiple prediction algorithms are sorted in ascending order. Then, the top m prediction algorithms that satisfy the condition that the Pearson correlation coefficient between them is less than a threshold are selected as the optimal combination of prediction algorithms, and these are used as the base learner combination.
[0125] The ensemble model building module is used to train each selected prediction algorithm as a meta-learner in each cluster, and select the prediction algorithm with the smallest prediction error as the meta-learner for that cluster, thereby building an ensemble model for each cluster.
[0126] Specifically, the process of the ensemble model building module building an ensemble model for each cluster includes:
[0127] An integrated model framework is constructed, with the first layer built by a combination of base learners, and the second layer built by any one of the prediction algorithms in the optimal combination of prediction algorithms. The meta-learner takes the original input and the output of the combination of the first layer base learners as input.
[0128] The base learner combination is retrained in each cluster. Then, the selected prediction algorithms are used as meta-learners and trained one by one. The prediction algorithm with the smallest prediction error is selected as the meta-learner of the cluster, and the ensemble model of the cluster is obtained.
[0129] More specifically, the process of retraining the base learner combination in each cluster includes:
[0130] Let the combination of base learners be {f1, f2, …, f m}, f m This represents the m-th base learner;
[0131] For each cluster C k Clustering C k The samples in the dataset are divided into training set D. train,k With test set D test,k ;
[0132] Using an m-fold cross-validation strategy, D train,k Divide into m parts, and use one part as the validation subset in a traversal manner, and use the remaining m-1 parts as the training subset to train each base learner in turn.
[0133] The meta-learner selection process includes:
[0134] Construct training and testing datasets for the meta-learner, and combine the original samples with the predictions of each base learner for that original sample to obtain the training samples for the meta-learner. ;in , Let be the input features and labels of the i-th original sample, respectively. Let m represent the prediction value of the m-th base learner for the i-th original sample; As input to the meta-learner, As the corresponding tag;
[0135] Each of the selected prediction algorithms is used as a meta-learner and trained using the training sample dataset of the meta-learner. The meta-learner is then tested using the test sample dataset of the meta-learner. The prediction algorithm with the smallest prediction error is selected as the meta-learner for this cluster.
[0136] The real-time forecasting module is used to acquire real-time power load data sequences, determine their respective clusters, and call the ensemble model of the respective clusters to perform power load forecasting.
[0137] It should be understood that the functional unit modules in the various embodiments of the present invention can be concentrated in one processing unit, or each unit module can exist physically separately, or two or more unit modules can be integrated into one unit module, and can be implemented in hardware or software.
[0138] This invention also provides an electronic device, comprising:
[0139] A memory on which computer programs are stored;
[0140] A processor is used to load and execute the computer program to implement the power load forecasting method based on clustering and ensemble learning as described above.
[0141] This invention also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the power load forecasting method based on clustering and ensemble learning as described above.
[0142] It is understood that the same or similar parts in the above embodiments can be referred to each other, and the contents not described in detail in some embodiments can be referred to the same or similar contents in other embodiments.
[0143] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0144] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0145] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0146] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0147] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.
Claims
1. A power load forecasting method based on clustering and ensemble learning, characterized in that, Includes the following steps: Historical power load data is preprocessed, and sample data is obtained using the sliding window method; Clustering algorithms are used to cluster the sample data, and the silhouette coefficients under different numbers of clusters are calculated to select the optimal cluster. Train a variety of pre-selected prediction algorithms, obtain the prediction error of each prediction algorithm, analyze the differences between different prediction algorithms, and select the optimal combination of prediction algorithms as the base learner combination. In each cluster, the selected prediction algorithms are used as meta-learners and trained one by one. The prediction algorithm with the smallest prediction error is selected as the meta-learner for that cluster, thereby establishing an ensemble model for each cluster. The system acquires real-time power load data sequences, determines their respective clusters, and calls the ensemble model of the corresponding cluster to perform power load forecasting.
2. The power load forecasting method based on clustering and ensemble learning according to claim 1, characterized in that, The process of preprocessing historical power load data includes: data cleaning and normalization of historical power load data.
3. The power load forecasting method based on clustering and ensemble learning according to claim 1, characterized in that, The process of selecting the optimal clustering includes: Different numbers of clusters are set, and the sample data is clustered under different numbers of clusters using the K-Medoids algorithm; Calculate the silhouette coefficient for different numbers of clusters, and select the clustering result corresponding to the number of clusters with the largest silhouette coefficient as the optimal cluster.
4. The power load forecasting method based on clustering and ensemble learning according to claim 1, characterized in that, The selection process for the base learner combination includes: Multiple prediction algorithms are selected in advance; The sample data was used to train a variety of pre-selected prediction algorithms individually, and the prediction error of each prediction algorithm was obtained. The Pearson correlation coefficient was used to analyze the differences between different prediction algorithms; Based on the prediction error, multiple prediction algorithms are sorted in ascending order. Then, the top m prediction algorithms that satisfy the condition that the Pearson correlation coefficient between them is less than a threshold are selected as the optimal combination of prediction algorithms, and these are used as the base learner combination.
5. The power load forecasting method based on clustering and ensemble learning according to claim 1, characterized in that, The process of building an ensemble model for each cluster includes: An integrated model framework is constructed, with the first layer built by a combination of base learners, and the second layer built by any one of the prediction algorithms in the optimal combination of prediction algorithms. The meta-learner takes the original input and the output of the combination of the first layer base learners as input. The base learner combination is retrained in each cluster. Then, the selected prediction algorithms are used as meta-learners and trained one by one. The prediction algorithm with the smallest prediction error is selected as the meta-learner of the cluster, and the ensemble model of the cluster is obtained.
6. The power load forecasting method based on clustering and ensemble learning according to claim 5, characterized in that, The process of retraining the base learner combination in each cluster includes: Let the combination of base learners be {f1, f2, …, f m }, f m This represents the m-th base learner; For each cluster C k Clustering C k The samples in the dataset are divided into training set D. train,k With test set D test,k ; Using an m-fold cross-validation strategy, D train,k Divide the data into m parts, and use one part as the validation subset and the remaining m-1 parts as the training subset to train each base learner in turn. The meta-learner selection process includes: Construct training and testing datasets for the meta-learner, and combine the original samples with the predictions of each base learner for that original sample to obtain the training samples for the meta-learner. ;in , Let be the input features and labels of the i-th original sample, respectively. Let m represent the prediction value of the m-th base learner for the i-th original sample; As input to the meta-learner, As the corresponding tag; Each of the selected prediction algorithms is used as a meta-learner and trained using the training sample dataset of the meta-learner. The meta-learner is then tested using the test sample dataset of the meta-learner. The prediction algorithm with the smallest prediction error is selected as the meta-learner for this cluster.
7. A power load forecasting system based on clustering and ensemble learning, characterized in that, include: The sample data acquisition module is used to preprocess historical power load data and acquire sample data using the sliding window method. The clustering module is used to cluster sample data using clustering algorithms, calculate the silhouette coefficient under different numbers of clusters, and select the optimal cluster. The base learner selection module is used to train a variety of pre-selected prediction algorithms, obtain the prediction error of each prediction algorithm, analyze the differences between different prediction algorithms, and select the optimal combination of prediction algorithms as the base learner combination. The ensemble model building module is used to train each selected prediction algorithm as a meta-learner in each cluster, and select the prediction algorithm with the smallest prediction error as the meta-learner for that cluster, thereby building an ensemble model for each cluster. The real-time forecasting module is used to acquire real-time power load data sequences, determine their respective clusters, and call the ensemble model of the respective clusters to perform power load forecasting.
8. The power load forecasting system based on clustering and ensemble learning according to claim 7, characterized in that, The process of preprocessing historical power load data by the sample data acquisition module includes: data cleaning and normalization of the historical power load data.
9. The power load forecasting system based on clustering and ensemble learning according to claim 7, characterized in that, The clustering module selects the optimal clustering process, which includes: Different numbers of clusters are set, and the sample data is clustered under different numbers of clusters using the K-Medoids algorithm; Calculate the silhouette coefficient for different numbers of clusters, and select the clustering result corresponding to the number of clusters with the largest silhouette coefficient as the optimal cluster.
10. The power load forecasting system based on clustering and ensemble learning according to claim 7, characterized in that, The process of selecting a combination of base learners by the base learner selection module includes: Multiple prediction algorithms are selected in advance; The sample data was used to train a variety of pre-selected prediction algorithms individually, and the prediction error of each prediction algorithm was obtained. The Pearson correlation coefficient was used to analyze the differences between different prediction algorithms; Based on the prediction error, multiple prediction algorithms are sorted in ascending order. Then, the top m prediction algorithms that satisfy the condition that the Pearson correlation coefficient between them is less than a threshold are selected as the optimal combination of prediction algorithms, and these are used as the base learner combination.
11. The power load forecasting system based on clustering and ensemble learning according to claim 7, characterized in that, The process of establishing an ensemble model for each cluster by the ensemble model building module includes: An integrated model framework is constructed, with the first layer built by a combination of base learners, and the second layer built by any one of the prediction algorithms in the optimal combination of prediction algorithms. The meta-learner takes the original input and the output of the combination of the first layer base learners as input. The base learner combination is retrained in each cluster. Then, the selected prediction algorithms are used as meta-learners and trained one by one. The prediction algorithm with the smallest prediction error is selected as the meta-learner of the cluster, and the ensemble model of the cluster is obtained.
12. The power load forecasting system based on clustering and ensemble learning according to claim 11, characterized in that, The process of retraining the base learner combination in each cluster includes: Let the combination of base learners be {f1, f2, …, f m }, f m This represents the m-th base learner; For each cluster C k Clustering C k The samples in the dataset are divided into training set D. train,k With test set D test,k ; Using an m-fold cross-validation strategy, D train,k Divide the data into m parts, and use one part as the validation subset and the remaining m-1 parts as the training subset to train each base learner in turn. The meta-learner selection process includes: Construct training and testing datasets for the meta-learner, and combine the original samples with the predictions of each base learner for that original sample to obtain the training samples for the meta-learner. ;in , Let be the input features and labels of the i-th original sample, respectively. Let m represent the prediction value of the m-th base learner for the i-th original sample; As input to the meta-learner, As the corresponding tag; Each of the selected prediction algorithms is used as a meta-learner and trained using the training sample dataset of the meta-learner. The meta-learner is then tested using the test sample dataset of the meta-learner. The prediction algorithm with the smallest prediction error is selected as the meta-learner for this cluster.
13. An electronic device, characterized in that, include: A memory on which computer programs are stored; A processor for loading and executing the computer program to implement the power load forecasting method based on clustering and ensemble learning as described in any one of claims 1 to 6.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the power load forecasting method based on clustering and ensemble learning as described in any one of claims 1 to 6.