A load forecasting method
By filtering load characteristic data from the load sequences of target users and inputting it into a machine learning model, the problem of power plants being unable to accurately predict the electricity consumption of users with small electricity consumption is solved, enabling load prediction for each user and improving prediction accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANGHAI PYLON TECH CO LTD
- Filing Date
- 2024-11-29
- Publication Date
- 2026-06-02
AI Technical Summary
In existing technologies, power plants cannot accurately predict the electricity consumption of users with small electricity consumption, resulting in inaccurate power generation forecasts and affecting the operation and management of power plants.
By filtering load feature datasets from the load sequences of target users and inputting them into a trained machine learning model for prediction, the load values at the predicted time points are obtained.
It expands the application scope of load forecasting, improves forecasting accuracy, and enables load forecasting for each user.
Smart Images

Figure CN122136790A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of power supply technology, and in particular to a load forecasting method. Background Technology
[0002] In existing technologies, electricity consumption forecasts for factories and industrial parks with high electricity consumption are made using historical data and experience, so that power plants can prepare electricity transmission accordingly in advance. However, since electricity consumption forecasts are only made for the high-consumption side, the electricity consumption of small factories, power plants, or individual users with lower electricity consumption is unknown. Moreover, the number of these smaller users is relatively large, which has a significant impact on the actual power generation of the power plant. This makes it impossible for the power plant to accurately predict power generation in advance, affecting the operation and management of the power plant. Summary of the Invention
[0003] In view of this, the purpose of this application is to provide at least one load forecasting method, which selects the load feature dataset required for predicting the electricity load at the forecast time point from the first selected load sequence of the target user, and inputs the load feature dataset into a trained machine learning model for prediction to obtain the predicted load value at the forecast time point. This solves the technical problem in the prior art that load forecasting cannot be performed for each user, and achieves the technical effect of increasing the application objects of load forecasting and improving the prediction accuracy.
[0004] This application mainly includes the following aspects:
[0005] In a first aspect, embodiments of this application provide a load forecasting method, the method comprising: acquiring a first filtered load sequence of a target user, the first filtered load sequence indicating that the target loads of the target user are sorted according to a time series and that the time points corresponding to adjacent target loads are spaced apart by a preset interval period; determining a load feature dataset for a prediction time point in the first filtered load sequence, the prediction time point indicating a time point after the latest time point corresponding to each target load in the first filtered load sequence, the load feature dataset covering multiple historical loads corresponding to different historical times; and inputting the load feature dataset for the prediction time point into a pre-trained machine learning model to obtain the predicted load value of the target user at the prediction time point.
[0006] Optionally, the load feature dataset of the target user is determined in the first filtered load sequence in the following manner: Multiple first historical loads of the target user are obtained sequentially at preset intervals before the predicted time point determined in the first filtered load sequence; a first preset number of historical dates are determined based on the time sequence before the preset date of the predicted time point, and the second historical load of the target user corresponding to each historical date at the predicted time point is determined; before the target time range of the time point preceding the predicted time point at the preset interval, a second preset number of historical time ranges of the target user and their corresponding third historical loads at the predicted time point are sequentially determined based on a preset similarity sequence, wherein the preset similarity sequence is used to indicate the sorting of the load similarity between each historical time range preceding the target time range and the target time range; the multiple first historical loads, the second historical loads corresponding to each historical date at the predicted time point, and the third historical loads corresponding to the second preset number of historical time ranges at the predicted time point are used as the load feature dataset of the target user.
[0007] Optionally, a preset similarity sequence is determined by: obtaining multiple target loads sequentially forward from the previous time point within the target time range at preset intervals, and sorting them according to the time points corresponding to each target load to obtain a target load sequence; for each historical time range prior to the target time range, collecting multiple historical loads sequentially forward from the previous time point at preset intervals within that historical time range, and sorting them according to the time points corresponding to each historical load to obtain a historical load sequence; calculating the load similarity between the historical load sequence and the target load sequence for each historical time range; and sorting the load similarity corresponding to each historical time range to obtain the preset similarity sequence.
[0008] Optionally, calculating the load similarity between the historical load sequence and the target load sequence for each historical time range includes: for each time point of the load sequence, calculating the load difference between the historical load of the historical load sequence of each historical time range at that time point and the target load of the target load sequence at that time point; and calculating the load similarity between the historical load sequence and the target load sequence for each historical time range based on the load difference corresponding to each time point of each historical load sequence.
[0009] Optionally, the second historical load of the target user corresponding to each historical date at the predicted time point is determined by the following method: determining the preset week to which the preset date belongs; taking each historical date between the preset date and the previous preset week as each second historical date, so as to determine the second historical load of the target user corresponding to each historical date at the predicted time point.
[0010] Optionally, the different second historical loads of the target user correspond to different weeks. The method further includes: when the historical load of the target user corresponding to the predicted time point is missing on any historical date between the preset date and the previous preset week, the target week corresponding to the missing historical date is determined; the historical load of the target user corresponding to the predicted time point on the previous target week is taken as the second historical load of the target user corresponding to the missing historical date.
[0011] Optionally, the first screening load sequence of the target user is obtained by: collecting the target user's electricity load at preset collection intervals to obtain the target user's electricity load sequence, wherein the time period corresponding to the preset collection interval is shorter than the time period corresponding to the preset interval period; obtaining multiple electricity loads covered in each preset interval period by sequentially spacing the preset interval period in the electricity load sequence; taking the average value of the multiple electricity loads corresponding to each preset interval period as the target load obtained by spacing each preset interval period; and sorting each target load according to the time series to obtain the first screening load sequence.
[0012] Optionally, the pre-trained machine learning model is obtained by: acquiring a second filtering load sequence corresponding to multiple historical users; filtering a set of labeled loads from the second filtering load sequences corresponding to multiple historical users, and determining the load feature dataset corresponding to each labeled load in the set of labeled loads; using the load feature dataset corresponding to each labeled load as each feature data, and using each labeled load as the label corresponding to each feature data, and training the model by inputting each feature data and its corresponding label into the machine learning model, so that the machine learning model can predict the labeled load.
[0013] Optionally, a tag load set is selected from the second filter load sequences corresponding to multiple historical users in the following way: each second filter load sequence is divided into a holiday load sequence and a first weekday load sequence excluding holidays according to the date it is on; a second weekday load sequence is obtained by filtering the first weekday load sequences corresponding to multiple historical users, and the tag load set is obtained by combining the second weekday load sequences corresponding to multiple historical users and the holiday load sequences.
[0014] Optionally, the second weekday load sequence is obtained in the following way: for each first weekday load sequence, each load in the first weekday load sequence is divided into multiple preset date ranges for each month to obtain multiple stage load sequences corresponding to the first weekday load sequence, and one stage load sequence corresponds to a load sequence within a preset date range for a month; the multiple stage load sequences corresponding to each first weekday load sequence are filtered to obtain load sequences for a preset number of days, and the load sequences filtered by each historical user are combined to obtain the second weekday load sequence corresponding to each historical user.
[0015] Optionally, a load sequence with a preset number of days is selected from each phase load sequence in the following manner: multiple first single-day load sequences belonging to weekdays and multiple second single-day load sequences belonging to weekends are determined from the phase load sequence, wherein the first single-day load sequence and the second single-day load sequence each correspond to a time range; a first number of single-day load sequences randomly selected from the multiple first single-day load sequences and a second number of single-day load sequences randomly selected from the multiple second single-day load sequences are used as the load sequence with a preset number of days selected from the phase load sequence, wherein the first number is greater than the second number.
[0016] Optionally, the machine learning model is a neural network model based on a self-attention mechanism.
[0017] This application provides a load forecasting method, comprising: acquiring a first filtered load sequence of the target user, wherein the first filtered load sequence indicates that the target loads of the target user are sorted according to a time series and the time points corresponding to adjacent target loads are spaced apart by a preset interval period; determining a load feature dataset for a prediction time point in the first filtered load sequence, wherein the prediction time point indicates a time point after the latest time point corresponding to each target load in the first filtered load sequence, the load feature dataset covering multiple historical loads corresponding to different historical times; and inputting the load feature dataset for the prediction time point into a pre-trained machine learning model to obtain the predicted load value of the target user at the prediction time point. By selecting the load feature dataset required for predicting the electricity load at the prediction time point from the first filtered load sequence of the target user, and inputting the load feature dataset into a trained machine learning model for prediction, the predicted load value at the prediction time point is obtained, thus solving the technical problem in the prior art that load forecasting cannot be performed for each user, achieving the technical effect of increasing the application scope of load forecasting and improving prediction accuracy.
[0018] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0019] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 A flowchart of a load forecasting method provided in an embodiment of this application is shown.
[0021] Figure 2 A functional block diagram of a load forecasting method provided in an embodiment of this application is shown.
[0022] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of this application is shown. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the drawings in this application are for illustrative and descriptive purposes only and are not intended to limit the scope of protection of this application. Furthermore, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in this application illustrate operations implemented according to some embodiments of this application. It should be understood that the operations in the flowcharts may not be implemented in sequence, and steps without logical contextual relationships may be reversed or implemented simultaneously. In addition, those skilled in the art, guided by the content of this application, may add one or more other operations to the flowcharts, or remove one or more operations from the flowcharts.
[0024] Furthermore, the described embodiments are merely some, not all, of the embodiments of this application. The components of the embodiments of this application described and illustrated herein can typically be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0025] In existing technologies, due to the large number of users, it is difficult to predict the current electricity load based on experience and the historical electricity load of each user. This makes it impossible for power plants to accurately predict power generation in advance, affecting the operation and management of power plants.
[0026] Based on this, this application provides a load forecasting method. By selecting a load feature dataset from a first-selection load sequence of target users to predict the electricity load at the forecast time point, and inputting the load feature dataset into a trained machine learning model for prediction, the predicted load value at the forecast time point is obtained. This solves the technical problem in the prior art that load forecasting cannot be performed for each user, achieving the technical effect of increasing the application scope of load forecasting and improving prediction accuracy. Specifically, as follows:
[0027] Please see Figure 1 , Figure 1 This is a flowchart illustrating a load forecasting method provided in an embodiment of this application. Figure 1 As shown in the embodiments of this application, the load forecasting method includes the following steps:
[0028] S101: Obtain the first screening load sequence of the target users.
[0029] Wherein, the first filtered load sequence is used to indicate that the target load of the target user is sorted according to the time sequence and the time points corresponding to adjacent target loads are spaced apart by a preset interval period, and the predicted time point is used to indicate the time point after the latest time point corresponding to each target load in the first filtered load sequence, spaced apart by a preset interval period, and the predicted time point refers to the time point when load prediction is required.
[0030] In other words, each target load in the first selected load sequence is sorted according to its corresponding time point, and the time points of adjacent target loads are separated by a preset interval period. Furthermore, the time points corresponding to each target load in the first selected load sequence are all located before the prediction time point where load forecasting is required.
[0031] Here, load can be understood as the total power consumption of a user at a point in time. Furthermore, for each target load in the first selected load sequence, the target load can be understood as the power consumption of the target user at its corresponding point in time.
[0032] For example, the target load can be the actual electricity load of the target user at various points in time, or it can be the average of the electricity load collected multiple times within a time period. Furthermore, by calculating the average value, the impact of load peaks can be eliminated, and missing data within a time period can be smoothed.
[0033] The first screening load sequence of the target user is obtained by: collecting the target user's electricity load at preset collection intervals to obtain the target user's electricity load sequence, wherein the time period corresponding to the preset collection interval is shorter than the time period corresponding to the preset interval period; obtaining multiple electricity loads covered in each preset interval period by sequentially spacing the preset interval period in the electricity load sequence; taking the average value of the multiple electricity loads corresponding to each preset interval period as the target load obtained by spacing each preset interval period; and sorting each target load according to the time series to obtain the first screening load sequence.
[0034] In other words, the electricity load of the target user is collected sequentially at preset intervals. The electricity loads are then sorted according to their collection time points to obtain an electricity load sequence. The preset intervals encompass the time periods corresponding to multiple preset collection periods. Furthermore, the electricity loads in the sequence are divided according to preset intervals, and the average value of the multiple loads corresponding to each preset interval is calculated to obtain the target load for each preset interval. The time point of the target load for each preset interval is a randomly selected preset time point within the preset interval. Therefore, the first filtered load sequence is obtained by sorting the loads according to their corresponding time points.
[0035] Furthermore, the latest time point and the predicted time point are separated by a preset interval period, that is, the preset interval period after the latest time point is the predicted time point.
[0036] For example, if the preset collection period is 5 minutes and the preset interval period is 1 hour, the electricity load of the target user is collected every 5 minutes starting from D:E on day C, month B, year A. The electricity load sequence of the target user is obtained by sorting the collection time from smallest to largest. The average value of the 12 electricity loads collected from D:E on day C, month B, year A to D+1:E on day C, month B, year A is taken as the target load at a preset time point between D:E on day C, month B, year A and D+1:E on day C, month B, year A. For example, the preset time point is E+30 minutes. The target load corresponding to E+30 minutes in each preset interval period is obtained in this way. Then, the target load at D:E+30 minutes, D+1:E+30 minutes, and D+n:E+30 minutes are taken as the first selected load sequence, and the predicted time point is D+n+1:E+30 minutes. That is, the predicted time point is separated from the latest time point in the first selected load sequence by a preset interval period.
[0037] S102: Determine the load feature dataset for the prediction time point from the first filtered load sequence.
[0038] The load feature dataset includes multiple historical loads corresponding to different historical times. In other words, each historical load in the load feature dataset should be a historical load prior to the prediction time, and each historical load corresponds to a different historical time, so as to predict the load at the prediction time by using multiple historical loads.
[0039] Specifically, the load feature dataset of the target user is determined in the first filtered load sequence in the following manner: Multiple first historical loads of the target user are obtained sequentially at preset intervals before the predicted time point in the first filtered load sequence; before the preset date of the predicted time point, a first preset number of historical dates are determined according to the time sequence, and the second historical load of the target user corresponding to each historical date at the predicted time point is determined; before the target time range of the time point preceding the predicted time point at the preset interval, a second preset number of historical time ranges of the target user and their corresponding third historical loads at the predicted time point are sequentially determined according to a preset similarity sequence, wherein the preset similarity sequence is used to indicate the sorting of the load similarity between each historical time range preceding the target time range and the target time range; the multiple first historical loads, the second historical loads corresponding to each historical date at the predicted time point, and the third historical loads corresponding to the second preset number of historical time ranges at the predicted time point are used as the load feature dataset of the target user.
[0040] In other words, the load feature dataset includes multiple first historical loads, multiple second historical loads, and multiple third historical loads. Furthermore, the time intervals corresponding to adjacent first historical loads are different from the time intervals corresponding to adjacent second historical loads, and the multiple third historical loads reflect a high degree of similarity to the load sequences corresponding to the target time range prior to the prediction time point. Therefore, increasing the types of historical loads in the load feature dataset improves prediction accuracy.
[0041] Here, "multiple first historical loads" refers to multiple target loads selected sequentially from the target load closest to the prediction time point in the first selected load sequence, moving towards smaller time points. For example, if the prediction time point is D+n+1 hours E+30 minutes, then the multiple first historical loads refer to the target load corresponding to D+n hours E+30 minutes, the target load corresponding to D+n-1 hours E+30 minutes, ..., the target load corresponding to D+ni hours E+30 minutes, and the number of multiple first historical loads is i+1.
[0042] The number of first historical loads is a preset number of historical loads, which can be set to 5. Specifically, the time range between the smallest time point (or the time point farthest from the prediction time point) among the multiple first historical loads and the prediction time point should be smaller than the ideal time range. The ideal time range is generally set to 10 hours, so that the loads of each time point closest to the prediction time point are selected as the first historical loads.
[0043] For example, if the target loads selected sequentially backward from the target load closest to the prediction time point are all null values, then the target load at the next time point is selected backward. It is only necessary to ensure that the number of multiple first historical loads meets the preset number of historical loads and that the time range is less than the ideal time range. For example, if the target load corresponding to D+n-1 time E+30 is null, then D+n-1 time E+30 is skipped. Multiple first historical loads refer to the target load corresponding to D+n time E+30, the target load corresponding to D+n-2 time E+30, ..., the target load corresponding to D+ni time E+30, and the target load corresponding to D+ni-1 time E+30. The number of multiple first historical loads remains i+1.
[0044] Specifically, for multiple second historical loads, each second historical load corresponds to a predicted time point for each historical date. That is, the time point corresponding to each second historical load is a predicted time point for a historical date prior to the predicted time point. For example, if the predicted time point is a predicted time point at D+n+1 hour E+30 on a predicted date of year A, month B, day C, and the first predetermined number of multiple second historical loads is j, then the multiple second historical loads refer to the target load corresponding to D+n+1 hour E+30 on year A, month B, day C-1, the target load corresponding to D+n+1 hour E+30 on year A, month B, day C-2, ..., the target load corresponding to D+n+1 hour E+30 on year A, month B, day Cj.
[0045] For example, the first preset number of multiple second historical loads is typically set to 7 so that multiple second historical loads can cover one week.
[0046] Specifically, the second historical load of the target user corresponding to each historical date at the predicted time point is determined by the following method: determining the preset week to which the preset date belongs; taking each historical date between the preset date and the previous preset week as each second historical date, so as to determine the second historical load of the target user corresponding to each historical date at the predicted time point.
[0047] In other words, the earliest and latest dates among the multiple second historical loads cover one week. For example, if the predicted time is D+n+1 hour E+30 minutes of the preset date A year B month C day, and the preset date A year B month C day is a Monday, and the first preset number of multiple second historical loads is 7, then the multiple second historical loads refer to the target load corresponding to D+n+1 hour E+30 minutes of A year B month C-1 day (Sunday), the target load corresponding to D+n+1 hour E+30 minutes of A year B month C-2 day (Saturday), ..., the target load corresponding to D+n+1 hour E+30 minutes of A year B month Cj day (Monday).
[0048] The different second historical loads of the target user correspond to different weeks. The method further includes: when the historical load of the target user corresponding to the predicted time point is missing on any historical date between the preset date and the previous preset week, the target week corresponding to the missing historical date is determined; the historical load of the target user corresponding to the predicted time point on the previous target week is taken as the second historical load of the target user corresponding to the missing historical date.
[0049] In other words, when determining the historical load corresponding to the prediction time point for each day preceding the preset date, if the historical load for that day at the prediction time point is missing, the historical load for the previous target week at the prediction time point is used to supplement it as the historical load for that day at the prediction time point. That is, the target load corresponding to the prediction time point of a historical date that is within the same week as the missing historical date is used to replace the target load corresponding to the missing historical date at the prediction time point.
[0050] For example, if the predicted time point is D+n+1 hour E+30 minutes of a preset date A year B month C day, and the preset date A year B month C day is a Monday, and the first preset number of multiple second historical loads is 7, then the multiple second historical loads ideally refer to the target load corresponding to D+n+1 hour E+30 minutes of A year B month C-1 day (Sunday), the target load corresponding to D+n+1 hour E+30 minutes of A year B month C-2 day (Saturday), ..., the target load corresponding to D+n+1 hour E+30 minutes of A year B month Cj day (Monday). If the target load corresponding to D+n+1 hour E+30 minutes of A year B month C-1 day (Sunday) is missing, then the target load corresponding to D+n+1 hour E+30 minutes of A year B month C-8 day (Sunday) will be used as the target load corresponding to D+n+1 hour E+30 minutes of A year B month C-1 day (Sunday).
[0051] Specifically, starting from the time point preceding the preset interval period of the predicted time point, the target time range of the previous time point is determined, and multiple historical time ranges are obtained by sequentially skipping the target time range forward. The load similarity between the multiple historical time ranges and the target time range is calculated by using the target loads of each target load in the target time range and the target loads corresponding to the multiple historical time ranges. The multiple historical time ranges are sorted according to the load similarity, and the most similar second preset number of historical time ranges are selected from the sorting results. The target loads of the selected historical time ranges at the predicted time point are used as multiple third historical loads.
[0052] The preset similarity sequence is determined as follows: Multiple target loads are obtained sequentially forward from the previous time point within the target time range at preset intervals, and sorted according to the time points corresponding to each target load to obtain a target load sequence; for each historical time range preceding the target time range, multiple historical loads are collected sequentially forward from the previous time point at preset intervals within that historical time range, and sorted according to the time points corresponding to each historical load to obtain a historical load sequence; the load similarity between the historical load sequence and the target load sequence for each historical time range is calculated; and the load similarity corresponding to each historical time range is sorted to obtain the preset similarity sequence.
[0053] The target time range and the historical time range both correspond to the same time period. In other words, both the target time range and the historical time range cover the target load that is sequentially spaced at preset intervals within the same time range.
[0054] For example, both the target time range and the historical time range correspond to 24 hours. That is, if the predicted time point is D+n+1 hour E+30 minutes of a preset date A year B month C day, then the time point before the preset interval between the predicted time points is D+n hour E+30 minutes of A year B month C day. The period from D+n hour E+30 minutes of A year B month C day to D+n hour E+30 minutes of A year B month C-1 day is taken as the target time range. Furthermore, 24 target loads are obtained by sequentially spacing them by 1 hour between D+n hour E+30 minutes of A year B month C day to D+n hour E+30 minutes of A year B month C-1 day. The 24 target loads are then sorted by time to obtain the target load sequence. Furthermore, 24 target loads are obtained by sequentially spacing them 1 hour between D+n hour E+30 on year B month C-1 and D+n hour E+30 on year B month C-2, forming multiple historical loads for a historical time range. These historical loads are then sorted by time to obtain a historical load sequence for a historical time range. This process is repeated to obtain historical load sequences corresponding to multiple historical time ranges.
[0055] Therefore, since it is necessary to select each historical load from the first selected load sequence, the time range between the earliest and latest time points in the first selected load sequence should at least cover the time points of the historical loads required in the load feature dataset. That is, it should at least cover the earliest time point of a second preset number of historical time ranges that are preceding the target time range corresponding to the time point preceding the prediction time point.
[0056] The calculation of the load similarity between the historical load sequence and the target load sequence for each historical time range includes: for each time point of the load sequence, calculating the load difference between the historical load of the historical load sequence of each historical time range at that time point and the target load of the target load sequence at that time point; and calculating the load similarity between the historical load sequence and the target load sequence for each historical time range based on the load difference corresponding to each time point of each historical load sequence.
[0057] For example, for each time point corresponding to the target load in the target load sequence, the load difference between the target load at that time point and the historical load of the historical load sequence in each historical time range at that time point is calculated; for each historical load sequence in each historical time range, the sum of the squares of the load differences corresponding to each time point in the historical time range is compared with the number of historical loads in a historical time range, and the ratio is used as the load similarity between the historical load sequence in each historical time range and the target load sequence.
[0058] The load similarity between the historical load sequence and the target load sequence for each historical time range is calculated using the following formula:
[0059]
[0060] In formula (1), dis a,b This refers to the load similarity between the target load sequence a and the historical load sequences within the b-th historical time range. a (k) refers to the historical load at the k-th time point in the target load sequence. b (k) refers to the historical load at the k-th time point in the historical load sequence of the b-th historical time range.
[0061] Furthermore, by sorting the load similarity corresponding to the historical load sequence of each historical time range from small to large, a preset similarity sequence with high to low similarity is obtained. Then, the first two preset number of historical time ranges in the preset similarity sequence are taken as the historical time range where the third historical load is located, thereby determining the historical time range most similar to the target time range, and thus determining multiple third historical loads.
[0062] S103: Input the load feature dataset of the predicted time point into the pre-trained machine learning model to obtain the predicted load value of the target user at the predicted time point.
[0063] In other words, by using each historical load in the load feature dataset as input data for the model, the predicted load value corresponding to the predicted time point output by the model is obtained.
[0064] The pre-trained machine learning model is obtained by: acquiring a second-filtered load sequence corresponding to multiple historical users; filtering a set of labeled loads from the second-filtered load sequences corresponding to multiple historical users, and determining the load feature dataset corresponding to each labeled load in the set of labeled loads; using the load feature dataset corresponding to each labeled load as each feature data, and using each labeled load as the label corresponding to each feature data, and training the model by inputting each feature data and its corresponding label into the machine learning model, so that the machine learning model can predict the labeled load.
[0065] In other words, from the second-selection load sequences corresponding to multiple historical users, firstly, multiple labeled loads are selected as labels for model training. Then, the load feature dataset corresponding to each labeled load is determined. This load feature dataset corresponding to each labeled load is used as the feature data for training the model, and each labeled load is used as the corresponding label. The training model then predicts the labeled load by inputting the load feature dataset corresponding to the labeled load. Furthermore, the method for determining the load feature dataset corresponding to the labeled load is the same as that for the load feature dataset corresponding to the prediction time point mentioned earlier, and will not be repeated here.
[0066] For example, the machine learning model is a neural network model (Transformer) based on a self-attention mechanism. First, the model is initialized, and hyperparameters are set, such as a learning rate of 0.01 and a step size for each parameter update. A smaller learning rate increases the stability of the training process. Both the encoder and decoder are set to 3 layers, and the number of attention heads is 12. The payload feature dataset corresponding to each label payload is divided into a training set, a validation set, and a test set in a 6:2:2 ratio. For the training set, the payload feature dataset is input into the model, encoded by the encoder, and the decoder outputs the predicted payload based on the encoder's output data and its own input data. The model parameters are updated by comparing the predicted payload and the label payload to train the model. For the validation set, the predicted payload is obtained by inputting the validation set's payload feature dataset into the model. The predicted payload is then combined with the label payload to verify whether the model can make predictions. For the test set, the predicted load is obtained by inputting the load feature dataset of the test set into the model, and the mean absolute percentage error (Mape) between the predicted load and the labeled load in the test set is calculated. When Mape is less than 0.2, it means that the model's prediction is relatively accurate, and a pre-trained machine learning model is obtained.
[0067] The mean absolute percentage error is calculated using the following formula:
[0068]
[0069] In formula (2), Mape refers to the mean absolute percentage error, R refers to the total number of load feature datasets in the test set, and y pre (r) refers to the predicted load predicted by the model on the r-th load feature dataset in the input test set, y true (r) refers to the label load corresponding to the r-th load feature dataset in the test set.
[0070] The tag load set is obtained by filtering the second filter load sequences corresponding to multiple historical users in the following way: each second filter load sequence is divided into a holiday load sequence and a first weekday load sequence excluding holidays according to the date it is located; the first weekday load sequence corresponding to multiple historical users is filtered to obtain the second weekday load sequence, and the tag load set is obtained by combining the second weekday load sequence corresponding to multiple historical users and the holiday load sequence.
[0071] The second selected load sequence is obtained in the same way as the first selected load sequence. For example, for each historical user, the electricity load of the historical user is collected at 5-minute intervals and sorted in ascending order of time to obtain the electricity load sequence of the historical user. The time span of the electricity load sequence of the historical user is relatively large, generally covering several years of electricity load data. Then, starting from the first electricity load, the average value of the electricity load covered in each hour of the electricity load sequence of the historical user is calculated. The average value is used as the target load at a preset time point within that hour, thus obtaining the second selected load sequence of each target load of the historical user sorted by time.
[0072] Specifically, for each historical user's second-filtered load sequence, it is determined whether the target load quantity for each date in the second-filtered load sequence for that historical user is 24. If the target load quantity for that date is 24, no processing is performed. If the target load quantity for that date is greater than or equal to 16 and less than 24, the average of the nearest previous target data and the nearest next target data for that date is taken as the missing target load, so that the target load quantity for that date is 24. If the target load quantity for that date is less than 16, all target loads for that date are deleted, so that the target load for each day in the second-filtered load sequence is complete, thereby increasing the completeness of the data and facilitating subsequent processing.
[0073] Furthermore, the second-filtered load sequences corresponding to multiple historical users are divided into holiday load sequences (dates falling on public holidays) and weekday load sequences (dates excluding public holidays) based on the date of each target load in the sequence. Both holiday sequences and weekday sequences are sorted chronologically. Then, the weekday load sequences corresponding to multiple historical users are further filtered to obtain second-weekday load sequences, reducing data volume. The holiday load sequence and the second-weekday load sequence corresponding to each historical user are used as a tagged load set.
[0074] The second weekday load sequence is obtained as follows: For each first weekday load sequence, each load in the first weekday load sequence is divided into multiple preset date ranges for each month to obtain multiple stage load sequences corresponding to the first weekday load sequence. Each stage load sequence corresponds to a load sequence within a preset date range for a month. The multiple stage load sequences corresponding to each first weekday load sequence are then filtered to obtain load sequences with a preset number of days. The load sequences with a preset number of days filtered by each historical user are then combined to obtain the second weekday load sequence corresponding to each historical user.
[0075] The multiple preset date ranges for each month include the beginning date range (1st to 10th), the middle date range (11th to 20th), and the end date range (dates from the 21st to the last day of the month). Furthermore, for each historical user's corresponding first weekday load sequence, based on the month in which each target load falls within this first weekday load sequence, the first weekday load sequence is first divided into monthly load sequences. Then, for each monthly load sequence, a first-stage load sequence belonging to the beginning date range, a second-stage load sequence belonging to the middle date range, and a third-stage load sequence belonging to the end date range are determined. Finally, the first-stage load sequence, second-stage load sequence, and third-stage load sequence for each month covered by a first weekday load sequence are considered as multiple stage load sequences corresponding to a first weekday load sequence. In other words, a first-stage load sequence corresponds to the target load of the beginning date range of a month in a year covered by the first weekday load sequence, a second-stage load sequence corresponds to the target load of the middle date range of a month in a year covered by the first weekday load sequence, and a third-stage load sequence corresponds to the target load of the end date range of a month in a year covered by the first weekday load sequence.
[0076] In other words, for each historical user, a load sequence with a preset number of days is selected from the first phase load sequence of each month corresponding to the first weekday load sequence of that historical user, a load sequence with a preset number of days is selected from the second phase load sequence of each month, and a load sequence with a preset number of days is selected from the third phase load sequence of each month. This achieves the goal of selecting a load sequence with a preset number of days for each phase load sequence of that historical user, and then combining the load sequences with the preset number of days selected for that historical user as the second weekday load sequence corresponding to that historical user.
[0077] The load sequence for a preset number of days is selected from the load sequence of each stage in the following manner: multiple first single-day load sequences belonging to weekdays and multiple second single-day load sequences belonging to weekends are determined from the load sequence of the stage, wherein the first single-day load sequence and the second single-day load sequence each correspond to a time range; a first number of single-day load sequences randomly selected from the multiple first single-day load sequences and a second number of single-day load sequences randomly selected from the multiple second single-day load sequences are used as the load sequence for the preset number of days selected from the load sequence of the stage, wherein the first number is greater than the second number.
[0078] Here, the time range refers to one day, with the first quantity being 2 and the second quantity being 1. That is, for each stage load sequence in each first weekday load sequence, the date of each target load in that stage load sequence is divided into multiple first single-day load sequences belonging to weekdays and multiple second single-day load sequences belonging to weekends. From the multiple first single-day load sequences, two first single-day load sequences are selected, that is, the target load of any two days is selected and sorted by time to obtain the first single-day load sequence corresponding to each day. And from the multiple second single-day load sequences, one first single-day load sequence is selected, that is, the target load of any day is selected and sorted by time to obtain the first single-day load sequence corresponding to that day. Then, from the stage load sequence, the single-day load sequences corresponding to the target loads of the three days are selected respectively.
[0079] In other words, if the target sequence for a month is from the first day to the last day of that month, then the daily load sequence covering three days of target load is selected from the first phase load sequence for that month; the daily load sequence covering three days of target load is selected from the second phase load sequence for that month; the daily load sequence covering three days of target load is selected from the third phase load sequence for that month; and so on, for a month, daily load sequences covering nine days of target load are selected. If a month is incomplete, the selection is also performed in this manner. Thus, for each historical user, the first weekday load sequence for that historical user is selected according to the month and date of the target load, and the load sequences for a preset number of days selected from each phase load sequence in each month are combined to obtain the second weekday load sequence for that historical user.
[0080] Furthermore, the second weekday load sequence and holiday load sequence corresponding to each historical user are combined into a labeled load set, and each target load in the labeled load set is used as a labeled load. For each labeled load, the load feature dataset corresponding to that labeled load is selected from the second filtered load sequence corresponding to the historical user to which that labeled load belongs. Moreover, when determining the third historical load in the second filtered load sequence, if a second preset number of historical time ranges preceding the labeled load cannot be found, other historical users most similar to the target historical user corresponding to that labeled load are identified, and the third historical load of that labeled load is determined from the second filtered load sequences of these other historical users.
[0081] For example, the user similarity between two historical users can be calculated using the following formula:
[0082]
[0083] In formula (3), dis c,d This refers to the user similarity between the c-th historical user and the d-th historical user, load c (q) refers to the target load of the c-th historical user at the q-th time point. d (q) refers to the target load of the d-th historical user at the q-th time point, and Q refers to the number of target loads at the same time point between the c-th historical user and the d-th historical user.
[0084] For example, this application also requires normalizing each label load and its corresponding load feature dataset used for training the input model, and performing inverse normalization on the data output from model training. Specifically, for each label load, the minimum value in the label load set is subtracted from the label load to obtain a first difference, and the minimum value in the label load set is subtracted from the maximum value in the label load set to obtain a second difference. The ratio of the first difference to the second difference is used as the normalized value of the label load. Furthermore, when obtaining the predicted value output by the model, inverse normalization can be performed using the maximum and minimum values of the label load set to obtain a predicted value that conforms to the actual data volume.
[0085] Therefore, during model training, each feature in the load feature dataset for each labeled load is processed in the same way. That is, for each feature data in the load feature dataset, the time interval between that feature data and its corresponding labeled load is determined, and the maximum and minimum values of the feature data within the same time interval are determined across multiple load feature datasets. Then, for each feature data in the load feature dataset, a normalized value is determined based on that feature data and its corresponding maximum and minimum values. Thus, both the labeled load and load feature datasets used for model training are normalized data, which improves model training speed.
[0086] For example, if the predicted time point is D+n+1 hours E+30 minutes, then the multiple first historical loads refer to the target load corresponding to D+n hours E+30 minutes (the first historical load H1 located 1 hour before the predicted time point), the target load corresponding to D+n-1 hours E+30 minutes (the first historical load H2 located 2 hours before the predicted time point), ..., the target load corresponding to D+ni hours E+30 minutes (the first historical load H1 located i+1 hours before the predicted time point). 1+1 The number of first historical loads is i+1. Furthermore, when normalizing the data in the load feature dataset, firstly, the maximum and minimum values of the first historical load closest to the time point of that label load are determined in the load feature dataset of each label load in the label load set. That is, the maximum and minimum values of the first historical load H1 in the load feature dataset of each label load are determined. Then, the difference between the target load corresponding to D+n time E+30 minutes and the minimum value of the first historical load H1 is taken as the third difference, the difference between the maximum value and the minimum value of the first historical load H1 is taken as the fourth difference, and the ratio of the third difference to the fourth difference is taken as the normalized value of the target load corresponding to D+n time E+30 minutes.
[0087] In other words, whether it is model training or actual load forecasting for target users at the predicted time points, it is necessary to normalize the data input to the model and to reverse normalize the data output by the model.
[0088] Based on the same application concept, this application also provides a load forecasting device corresponding to the load forecasting method provided in the above embodiments. Since the principle of the device in this application is similar to the load forecasting method in the above embodiments of this application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.
[0089] like Figure 2 As shown, Figure 2 This is a functional block diagram of a load forecasting device provided in an embodiment of this application. The load forecasting device 10 includes: an acquisition module 101, which acquires a first filtered load sequence of the target user, wherein the first filtered load sequence indicates that the target loads of the target user are sorted according to a time series and the time points corresponding to adjacent target loads are spaced apart by a preset interval period; a determination module 102, which determines a load feature dataset for a prediction time point in the first filtered load sequence, wherein the prediction time point indicates a time point after the latest time point corresponding to each target load in the first filtered load sequence, with an interval period of the preset interval period, and the load feature dataset covers multiple historical loads corresponding to different historical times; and a prediction module 103, which inputs the load feature dataset for the prediction time point into a pre-trained machine learning model to obtain the predicted load value of the target user at the prediction time point.
[0090] Based on the same application concept, see [link / reference] Figure 3 The diagram shown is a structural schematic of an electronic device provided in an embodiment of this application. The electronic device 20 includes a processor 201, a memory 202, and a bus 203. The memory 202 stores machine-readable instructions executable by the processor 201. When the electronic device 20 is running, the processor 201 and the memory 202 communicate through the bus 203. The machine-readable instructions are executed by the processor 201 to perform the steps of any of the load forecasting methods described in the above embodiments.
[0091] Specifically, when the machine-readable instructions are executed by the processor 201, they can perform the following processing: obtaining a first filtered load sequence of the target user, wherein the first filtered load sequence is used to indicate that the target load of the target user is sorted according to the time sequence and the time points corresponding to adjacent target loads are spaced apart by a preset interval period; determining a load feature dataset for a predicted time point in the first filtered load sequence, wherein the predicted time point is used to indicate the time point after the latest time point corresponding to each target load in the first filtered load sequence, with an interval period of the preset interval period, and the load feature dataset covers multiple historical loads corresponding to different historical times; and inputting the load feature dataset for the predicted time point into a pre-trained machine learning model to obtain the predicted load value of the target user at the predicted time point.
[0092] Based on the same concept, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the load forecasting method provided in the above embodiments.
[0093] Specifically, the storage medium can be a general-purpose storage medium, such as a portable disk or hard disk. When the computer program on the storage medium is run, it can execute the above-mentioned load forecasting method. By selecting the load feature dataset required to predict the electricity load at the prediction time point from the first filtered load sequence of the target users, and inputting the load feature dataset into the trained machine learning model for prediction, the predicted load value at the prediction time point is obtained. This solves the technical problem in the prior art that load forecasting cannot be performed for each user, and achieves the technical effect of increasing the application objects of load forecasting and improving the accuracy of prediction.
[0094] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems and devices described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division; in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection may be through some communication interfaces; the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms.
[0095] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0096] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0097] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0098] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A load forecasting method, characterized in that, The method includes: Obtain a first filtered load sequence of the target user. The first filtered load sequence is used to indicate that the target load of the target user is sorted according to the time series and the time points corresponding to adjacent target loads are spaced apart by a preset interval period. In the first selected load sequence, a load feature dataset for the predicted time point is determined. The predicted time point is used to indicate the time point after the latest time point corresponding to each target load in the first selected load sequence, with a preset interval period. The load feature dataset covers multiple historical loads corresponding to different historical times. The load feature dataset at the predicted time point is input into a pre-trained machine learning model to obtain the predicted load value of the target user at the predicted time point.
2. The method according to claim 1, characterized in that, The target user's load characteristic dataset is determined from the first filtered load sequence using the following method: Before determining the predicted time point in the first filtered load sequence, multiple first historical loads of the target user are obtained by sequentially intervening at preset intervals; Before the preset date at the predicted time point, a first preset number of historical dates are determined based on the time series, and the second historical load of the target user corresponding to each historical date at the predicted time point is determined; Before the target time range where the predicted time point is located at the time point preceding the preset interval period, the second preset number of historical time ranges of the target users and their corresponding third historical loads at the predicted time point are determined sequentially according to a preset similarity sequence. The preset similarity sequence is used to indicate the sorting of the load similarity between each historical time range before the target time range and the target time range. The multiple first historical loads, the second historical loads corresponding to each historical date at the predicted time point, and the third historical load corresponding to the second preset number of historical time ranges at the predicted time point are used as the load feature dataset of the target user.
3. The method according to claim 2, characterized in that, Preset similar sequences are determined using the following method: Within the target time range, multiple target loads are obtained by sequentially moving forward from the previous time point at preset intervals, and the target load sequence is obtained by sorting the time points corresponding to each target load. For each historical time range prior to the target time range, multiple historical loads are collected sequentially from the previous time point forward at preset intervals within that historical time range, and sorted according to the time points corresponding to each historical load to obtain a historical load sequence. Calculate the load similarity between the historical load sequence and the target load sequence for each historical time range; The preset similarity sequence is obtained by sorting the load similarity corresponding to each historical time range.
4. The method according to claim 3, characterized in that, The calculation of the load similarity between the historical load sequence and the target load sequence for each historical time range includes: For each time point in the load sequence, calculate the load difference between the historical load of the historical load sequence at that time point and the target load of the target load sequence at that time point for each historical time range; Based on the load difference corresponding to each historical load sequence at each time point, the load similarity between the historical load sequence and the target load sequence for each historical time range is calculated.
5. The method according to claim 2, characterized in that, The second historical load of the target user corresponding to each historical date at the predicted time point is determined by the following methods: Determine the preset weekday to which the preset date belongs; Each historical date between the preset date and the previous preset week is used as a second historical date to determine the second historical load of the target user corresponding to each historical date at the predicted time point.
6. The method according to claim 5, characterized in that, The different second historical loads of the target user correspond to different weeks, and the method further includes: If the target user's historical load corresponding to the predicted time point is missing on any historical date between the preset date and the previous preset week, then the target week corresponding to the missing historical date is determined. The historical load of the target user corresponding to the previous target week at the predicted time point is taken as the second historical load of the target user corresponding to the missing historical date.
7. The method according to claim 1, characterized in that, The first screening load sequence of the target user is obtained through the following method: The electricity load sequence of the target user is obtained by collecting the electricity load of the target user at preset collection intervals, wherein the time period corresponding to the preset collection period is shorter than the time period corresponding to the preset interval period; In the power load sequence, multiple power loads covered within each preset interval period are obtained by sequentially spacing the preset interval periods. The average value of multiple electrical loads corresponding to each preset interval period is used as the target load obtained at intervals of each preset interval period; The first selected load sequence is obtained by sorting each target load according to the time series.
8. The method according to claim 1, characterized in that, The pre-trained machine learning model can be obtained in the following ways: Obtain the second-filtered load sequences corresponding to multiple historical users; A set of labeled loads is selected from the second filtered load sequences corresponding to multiple historical users, and the load feature dataset corresponding to each labeled load in the set of labeled loads is determined. Each labeled load is used as a feature data set corresponding to a load feature, and each labeled load is used as a label corresponding to each feature data. Each feature data and its corresponding label are input into a machine learning model for model training, so that the machine learning model can predict the labeled load.
9. The method according to claim 8, characterized in that, The tag load sets are selected from the second filter load sequences corresponding to multiple historical users using the following method: Each second-screened load sequence is divided into a holiday load sequence and a first weekday load sequence excluding holidays, according to the date it is on. The first weekday load sequence corresponding to multiple historical users is filtered to obtain the second weekday load sequence, and the second weekday load sequence corresponding to multiple historical users and the holiday load sequence are combined to obtain the tag load set.
10. The method according to claim 9, characterized in that, The second weekday load sequence was obtained in the following manner: For each first weekday load sequence, each load in the first weekday load sequence is divided into multiple preset date ranges for each month to obtain multiple stage load sequences corresponding to the first weekday load sequence. One stage load sequence corresponds to a load sequence within a preset date range for a month. For each first weekday load sequence, select load sequences for a preset number of days from multiple stage load sequences, and combine the selected load sequences for each historical user to obtain the second weekday load sequence for each historical user.
11. The method according to claim 10, characterized in that, The load sequence with a preset number of days is selected from the load sequence of each stage using the following method: In this phase of the load sequence, multiple first-day load sequences belonging to weekdays and multiple second-day load sequences belonging to weekends are identified. Each first-day load sequence and each second-day load sequence corresponds to a time range. A first number of daily load sequences randomly selected from multiple first daily load sequences and a second number of daily load sequences randomly selected from multiple second daily load sequences are used as the load sequences for a preset number of days selected in the load sequences of this stage, wherein the first number is greater than the second number.
12. The method according to any one of claims 1 to 11, characterized in that, The machine learning model is a neural network model based on the self-attention mechanism.