Festival and holiday short-term bus load prediction method, system and equipment and storage medium
Through clustering and feature selection, a bus load prediction model combining gated residual network and attention mechanism solves the problem that traditional methods are difficult to capture holiday load characteristics, and achieves more efficient and accurate bus load prediction.
Patent Information
- Application Number
- CN202411597149.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-11
- Publication Date
- 2025-03-25
AI Technical Summary
Traditional statistical methods are difficult to capture the complex characteristics of the bus load during holidays, resulting in insufficient accuracy in load prediction.
By clustering the preprocessed bus load data, selecting input features determined by correlation analysis and feature importance analysis, establishing a bus load prediction model containing a gated residual network and attention mechanism, and freezing some neurons during the fine-tuning process to reduce computing resource requirements.
It improves the efficiency and accuracy of bus load prediction, can better capture abnormal load patterns during holidays, reduces calculation needs, and facilitates the prediction model update recently.
Smart Images

Figure CN119691482A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a bus load prediction method, system, device and storage medium, and in particular to a holiday short-term bus load prediction method, system, device and storage medium, belonging to the technical field of power grid dispatching. Background Art
[0002] Grid forecasting problems can be divided into two main categories: generation forecasting and load forecasting. In particular, accurate bus load forecasting provides key input for unit commitment and economic dispatch, ensuring the safety and economic efficiency of regional power grid operation. During holidays, electricity consumption behavior changes significantly, resulting in bus load fluctuations that deviate significantly from traditional trends. These complex changes often pose unique challenges to load forecasting models. Factors such as weather conditions, special public events, and population mobility interact to produce bus load profiles with high uncertainty. Traditional statistical methods often fail to capture these complex holiday load characteristics.
[0003] Therefore, there is an urgent need to develop advanced holiday bus load forecasting techniques to adapt to its inherent complexity and improve forecasting accuracy. Summary of the invention
[0004] Purpose of the invention: The purpose of the present invention is to provide a method, system, device and storage medium for predicting short-term bus load during holidays that can improve prediction accuracy.
[0005] Technical solution: A method for predicting short-term bus load during holidays described in the present invention comprises:
[0006] (1) Clustering the preprocessed bus load data to distinguish bus loads with different means and degrees of variation;
[0007] (2) Select the input features of the bus load forecasting model based on correlation analysis and feature importance analysis;
[0008] (3) Establish a bus load forecasting model that includes a gated residual network and an attention mechanism;
[0009] (4) Use a pre-trained architecture for bus loads with different means and degrees of variation, and freeze some neurons during the fine-tuning process to reduce the demand for computing resources during the training process, complete the training of the bus load prediction model, and use the trained bus load prediction model.
[0010] Furthermore, the method also includes collecting historical bus load data and performing preprocessing to remove abnormal values in the bus load data, and the specific method is:
[0011] Get historical bus load data {x1,...,xN}, x i is the i-th data, N is the total number of data, calculate the mean μ and standard deviation σ of the data;
[0012]
[0013]
[0014] Determine the confidence level for Chebyshev's inequality:
[0015]
[0016] Among them, P represents probability, k is any positive integer greater than 1;
[0017] Select the k value to define the range of outliers, and combine it with formula (3) to determine the proportion of data that falls within the range of k standard deviations of the mean;
[0018] Compute a lower bound on outliers:
[0019] μ-kσ(4)
[0020] Compute an upper bound on outliers:
[0021] μ+kσ(5)
[0022] Remove all data points from the data set that fall outside the upper and lower bounds;
[0023] If the change in the mean or standard deviation of the data exceeds the preset threshold after removing the outliers, recalculate the mean and standard deviation, and repeatedly calculate the upper and lower bounds of the outliers and remove all data points that exceed the upper and lower bounds from the data set, and enter this step again for judgment.
[0024] Furthermore, the step (1) comprises:
[0025] (11) Select the number of clusters K;
[0026] (12) Randomly select K data points as the initial cluster centers;
[0027] (13) For each data point, calculate its distance from the center of each cluster using the Euclidean distance formula:
[0028]
[0029] Where p and q are two data points, and n is the dimension of the data point;
[0030] (14) Assign each data point to the cluster represented by the nearest cluster center point;
[0031] (15) Calculate the average value of all data points in each cluster and use it as the new cluster center. The new cluster center η j The formula is:
[0032]
[0033] Among them, η j is the center point of the jth cluster, C j are all the data points in the jth cluster, |C j | is the number of data points in the jth cluster;
[0034] (16) Repeat steps (13) to (15) until the change in the cluster center point is less than a preset threshold or reaches a preset number of iterations; output the clustering results of the bus load data points and the center point of each cluster.
[0035] Furthermore, the step (2) comprises:
[0036] (21) selecting bus load and weather characteristics for a number of time periods based on correlation analysis and feature importance ranking; wherein the time characteristics are selected to capture periodic patterns in the bus load data, and the time characteristics include holidays, months, days, hours, and minutes;
[0037] The input characteristics of the bus load forecasting model at time t are expressed as;
[0038] x t =[L t-96 , L t-97 , ..., L t-95-s , W t , O t ] (8)
[0039] Among them, L t-t′ , t′∈96,97,...,95+s represents the historical bus load at time tt′, s represents the number of bus load data points of enhanced input, W t represents the weather forecast data at time t, including temperature, light intensity, humidity and wind speed; t Indicates the features taken into consideration, including month, day, and forecast time;
[0040] (22) Encode the month, day, and holiday type features to capture nonlinear relationships and avoid assuming ordinal relationships; including the following steps:
[0041] Assume there are m different categories in the data set;
[0042] Create a matrix of size r×m, where r is the number of data points to be encoded and m is the number of categories; each row of the matrix corresponds to a data point and each column corresponds to a category;
[0043] For each data point, set the column where its corresponding category is located to 1, and the remaining columns to 0; the formula is as follows:
[0044]
[0045] Among them, x i is the ith data point, c j is the jth category; and retains the numerical form of hour and minute features.
[0046] Furthermore, the step (3) comprises:
[0047] (31) A gated residual network module is used to generate a context vector for fusion into the decoder to enhance the model's ability to understand the input sequence. In this module, an exponential linear unit is used as an activation function to achieve nonlinear mapping of negative input values while maintaining the invariance of positive input values. The exponential linear unit ELU is defined as follows:
[0048]
[0049] Where a represents the input of the exponential linear unit, and the hyperparameter α is used to control the slope of the negative region;
[0050] (32) Use sequence-to-sequence models to handle the difference in the number of past and future inputs and use LSTM as an alternative to positional encoding;
[0051] Specifically, the data from time tk to time t As the input of the encoder, the data at the future time As the input of the decoder, a set of unified temporal features φ(t,u)∈φ(t,−k),...,φ(t,τ max ), where u is the position index;
[0052] The LSTM structure is used as the position encoding method for the encoder and decoder, and the skip connection technology is used to alleviate the gradient disappearance or gradient explosion problems that occur during training.
[0053] (33) The long-range temporal dependency of bus load and weather data at different time steps is captured by the self-attention mechanism module. The attention mechanism scales the value according to the relationship between keys and queries, expressed as:
[0054]
[0055] in is a sequence of values, is the key sequence, is the query sequence, represents the real number domain, M represents the number of elements in the sequence, and d V is the dimension of the value sequence, d attn is the dimension of the query sequence;
[0056] Use multiple independent attention heads to capture different temporal representation subspaces and share value weights between all heads. Linearly combine the concatenated temporal outputs from all heads, expressed as:
[0057]
[0058]
[0059]
[0060] in are the header-specific weight matrices for query, key, and value, respectively, and d model are the dimensions of the model input and output, is the value weight shared among all heads, is the linear mapping matrix, m H is the number of different attention heads in the model that process the input in parallel, and H represents the linear combination of the concatenated temporal outputs from all heads;
[0061] (34) The model feedforward layer is designed based on the gated residual network (GRN); by applying additional nonlinear processing to the output of the self-attention layer, the weights of the GRN are shared throughout the layer.
[0062] Furthermore, the step (4) comprises:
[0063] (41) performing pre-training on each bus load cluster obtained by clustering in step (1);
[0064] (42) During the fine-tuning process, the frozen neuron mechanism is implemented to train each bus load separately; let θ represent the hyperparameter set of all trainable parameters in the original model, and divide θ into frozen parameters θ f and trainable parameters θ t , and make θ=θ f ∪θ t ; During fine-tuning, only the t The gradient of
[0065] Let the target variable y t Corresponding to the bus load at time t, the goal is to learn the mapping function f to minimize the predicted bus load Actual bus load y t The loss function given between It is expressed as:
[0066]
[0067] The bus load prediction results are evaluated by the root mean square error RMSE, which is expressed as:
[0068]
[0069] Among them, Z represents the total number of prediction points, y act (z) represents the actual load value at the zth point, y pred (z) represents the predicted load value at the zth point.
[0070] Furthermore, the step (41) comprises:
[0071] Extracting the input features described in step (2) for each bus load cluster;
[0072] Initialize the pre-trained model for each bus load cluster, set the network structure, learning rate and optimizer parameters;
[0073] The data of each bus load cluster is trained separately, and the model parameters are iteratively optimized until the predetermined number of training rounds is reached or the loss function converges.
[0074] Based on the same inventive concept, the present invention also provides a holiday short-term bus load forecasting system, comprising:
[0075] A clustering module is used to cluster the preprocessed bus load data and distinguish bus loads with different means and degrees of variation;
[0076] A feature selection module is used to select input features of the bus load forecasting model based on correlation analysis and feature importance analysis;
[0077] Model building module, used to build a bus load forecasting model including gated residual network and attention mechanism;
[0078] The prediction module is used to use the pre-trained architecture for bus loads with different means and degrees of variation, and freeze some neurons during the fine-tuning process to reduce the demand for computing resources during the training process, complete the training of the bus load prediction model, and use the trained bus load prediction model.
[0079] Based on the same inventive concept, the present invention also provides a computing device, comprising: one or more processors, one or more memories and one or more programs, wherein the programs are stored in the memories and configured to be executed by the processors, and when the programs are loaded into the processors, the steps of the holiday short-term bus load forecasting method according to any one of the above items are implemented.
[0080] Based on the same inventive concept, the present invention also provides a storage medium, which stores a computer program, and the computer program includes program instructions. When the program instructions are executed by a processor, the processor executes the steps of the holiday short-term bus load forecasting method described in any one of the above items.
[0081] Beneficial effects: Compared with the prior art, the present invention encodes the month, date and holiday type, and can capture abnormal load patterns during holidays; the present invention selects the input features of the bus load prediction model according to correlation analysis and feature importance analysis, and the computational complexity is significantly reduced; the present invention clusters the bus loads, and the bus load prediction model trains bus loads with different statistical characteristics separately, thereby improving the efficiency and accuracy of bus load prediction; the present invention introduces a frozen neuron strategy that greatly reduces the computing requirements and facilitates the updating of the day-ahead prediction model, making the proposed solution extremely competitive in bus load prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0082] Figure 1 is a flow chart of a method according to an embodiment of the present invention;
[0083] Figure 2 is a structural diagram of a gated residual network according to an embodiment of the present invention;
[0084] Figure 3 The figure is an algorithm architecture diagram including a gated residual network and an attention mechanism according to an embodiment of the present invention. DETAILED DESCRIPTION
[0085] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0086] As attached Figure 1 As shown, the holiday short-term bus load forecasting method of this embodiment includes:
[0087] (1) Collect historical bus load data and perform preprocessing to remove abnormal values in the bus load data;
[0088] (2) Clustering the preprocessed bus load data to distinguish bus loads with different means and degrees of variation;
[0089] (3) Select the input features of the bus load forecasting model based on correlation analysis and feature importance analysis;
[0090] (4) Establish a bus load forecasting model that includes a gated residual network and an attention mechanism;
[0091] (5) Use a pre-trained architecture for bus loads with different means and degrees of variation, and freeze some neurons during the fine-tuning process to reduce the demand for computing resources during the training process, complete the training of the bus load prediction model, and use the trained bus load prediction model.
[0092] Specifically, in step (1), in the data preprocessing stage, identifying abnormal values in the bus load historical data includes the following steps:
[0093] 11) Obtain historical bus load data {x1,...,x N}, x i is the i-th data, N is the total number of data, calculate the mean μ and standard deviation σ of the data;
[0094]
[0095]
[0096] 12) Determine the confidence level of Chebyshev's inequality;
[0097]
[0098] Among them, P represents probability, k is any positive integer greater than 1;
[0099] 13) Choose a k value to define the range of outliers. A common choice of k value is 3, which means that at least 88.9% of the data are within 3 standard deviations of the mean;
[0100] 14) Calculate the outlier limits according to the outlier lower and upper limit calculation formulas;
[0101] Compute a lower bound on outliers:
[0102] μ-kσ(4)
[0103] Compute an upper bound on outliers:
[0104] μ+kσ(5)
[0105] 15) Eliminate outliers. Remove all data points that are outside the upper and lower limits from the data set;
[0106] 16) Re-evaluate. If the distribution of the data changes significantly after removing the outliers, you may need to recalculate the mean and standard deviation and repeat steps 14) and 15).
[0107] In step (2), clustering the bus load data includes the following steps:
[0108] 21) Select the number of clusters K. Determine how many clusters the data points are to be divided into. The value of K is usually determined based on business needs or through experiments. For example, the division can be based on the size of the bus load mean and standard deviation;
[0109] 22) Initialize the center point. Randomly select K data points as the initial cluster center points;
[0110] 23) Calculate the distance. For each data point, calculate its distance from the center of each cluster. Usually the Euclidean distance formula is used;
[0111]
[0112] Where p and q are two data points, and n is the dimension of the data point;
[0113] 24) Assign data points. Assign each data point to the cluster represented by the nearest cluster center point;
[0114] 25) Calculate the average value of all data points in each cluster and use it as the new cluster center point;
[0115]
[0116] Among them, η j is the center point of the jth cluster, C j are all the data points in the jth cluster, |C j | is the number of data points in the jth cluster;
[0117] 26) Repeat steps 23) to 25) until the stop condition is met. The stop condition can be that the change of the cluster center point is less than a certain threshold, or reaches a preset number of iterations. Output the clustering results of the bus load data points and the center point of each cluster.
[0118] The bus loads are clustered according to their mean and degree of variation. The clustering results are shown in Table 1.
[0119] Table 1 Bus load clustering results
[0120]
[0121]
[0122] In step (3), the prediction model input features are selected, including the following steps:
[0123] 31) Based on correlation analysis and feature importance ranking (such as through Pearson correlation coefficient, heat map or xgboost algorithm feature importance output), select bus load and weather features such as temperature and humidity in the last week. Based on domain knowledge, select holiday information and time features such as month, day, hour and minute to capture periodic patterns in bus load data. Highly correlated features, such as different types of solar radiation data, are removed to mitigate multicollinearity, while less important features, such as sunrise and sunset times, are discarded based on feature importance ranking to reduce noise and improve model simplicity;
[0124] The input characteristics of the bus load forecasting model at time t can be expressed as;
[0125] x t =[L t-96 , L t-97 , ..., L t-95-s , W t , O t ] (8)
[0126] Among them, L t-t′ ,t′∈96,97,...,95+s represents the historical bus load at time tt′, s represents the number of bus load data points of enhanced input, this method is used for day-ahead prediction, and the sampling accuracy is 15 minutes. W t Represents the weather forecast data at time t, including temperature, light intensity, humidity and wind speed. t Indicates other features that may be taken into consideration, including month, day, and time of day for prediction.
[0127] 32) Put the month, date, and holiday type features into a form that is easy for machine learning algorithms to use, capture nonlinear relationships, and avoid assuming ordinal relationships. The following steps are included:
[0128] Determine the number of categories. Suppose there are m different categories in the data set;
[0129] Create the encoding matrix. Create a matrix of size r×m, where r is the number of data points and m is the number of categories. Each row of the matrix corresponds to a data point and each column corresponds to a category;
[0130] Fill the encoding matrix. For each data point, set the column corresponding to the category to 1 and the rest of the columns to 0.
[0131]
[0132] Among them, x i is the ith data point, c j is the jth category; and retains the numerical form of hour and minute features.
[0133] Numerical form is retained for hour and minute features to effectively learn and incorporate time-of-day dependencies.
[0134] In step (4), an algorithm architecture including a gated residual network and an attention mechanism is established, including the following steps:
[0135] 41) The gated residual network module generates different context vectors, which are then connected to various positions in the decoder. The exponential linear unit as an activation function maps negative inputs to the negative region through exponential and linear transformations while retaining positive inputs; the exponential linear unit ELU is defined as follows:
[0136]
[0137] Among them, a represents the input of the exponential linear unit, and the hyperparameter α is used to control the slope of the negative region; the gated residual network structure is as follows Figure 2 shown.
[0138] 42) Use sequence-to-sequence models to handle the difference in the number of past and future inputs, and use LSTM as an alternative to positional encoding;
[0139] Specifically, the data from time tk to time t As the input of the encoder, the data at the future time This process generates a set of unified temporal features φ(t,u)∈φ(t,−k),...,φ(t,τ max ), where u is the position index; these temporal features themselves serve as input to the decoder.
[0140] The LSTM structure is used as the position encoding method for the encoder and decoder, and the skip connection technology is used to alleviate the gradient disappearance or gradient explosion problems that occur during training.
[0141] 43) Use the self-attention mechanism to capture the long-range temporal dependencies of bus load and weather data at different time steps. The attention mechanism scales the value according to the relationship between keys and queries, expressed as:
[0142]
[0143] in is a sequence of values, is the key sequence, is the query sequence, represents the real number domain, M represents the number of elements in the sequence, and d V is the dimension of the value sequence, d attnis the dimension of the query sequence;
[0144] Use multiple independent attention heads to capture different temporal representation subspaces, share value weights between all heads, and linearly combine the concatenated temporal outputs from all heads; expressed as:
[0145]
[0146]
[0147]
[0148] in are the header-specific weight matrices for query, key, and value, respectively, and d model are the dimensions of the model input and output, is the value weight shared among all heads, is the linear mapping matrix, m H is the number of different attention heads in the model that process the input in parallel, and H represents the linear combination of the concatenated temporal outputs from all heads;
[0149] 44) The model feed-forward layer is designed based on the gated residual network (GRN). The weights of the GRN are shared across the entire layer by applying additional nonlinear processing to the output of the self-attention layer.
[0150] The algorithm architecture including the gated residual network and the attention mechanism is as follows Figure 3 shown.
[0151] In step (5), the pre-trained architecture is used and some neurons are frozen during fine-tuning, including the following steps:
[0152] 51) Each bus load cluster obtained by clustering in step 2 is pre-trained separately, the steps are as follows:
[0153] Extract the features described in step 3 for each cluster;
[0154] Initialize the pre-trained model for each cluster and set appropriate network structure, learning rate, optimizer and other parameters;
[0155] Train the data of each cluster separately and iteratively optimize the model parameters until the predetermined number of training rounds is reached or the loss function converges;
[0156] 52) During the fine-tuning process, the frozen neuron mechanism is implemented to train each bus load separately. All trainable parameters in the original model are divided into frozen parameters and trainable parameters. During the fine-tuning process, only the gradients with respect to the trainable parameters are calculated, thereby effectively freezing the weights of the frozen parameters.
[0157] The goal is to learn the mapping function f to minimize a given loss function between the predicted bus load and the actual bus load so that the root mean square error (RMSE) can be used to evaluate the bus load prediction results.
[0158] Let θ denote the hyperparameter set of all trainable parameters in the original model, and divide θ into frozen parameters θ f and trainable parameters θ t , and make θ=θ f ∪θ t ; During fine-tuning, only the t The gradient of
[0159] Let the target variable y t Corresponding to the bus load at time t, the goal is to learn the mapping function f to minimize the predicted bus load Actual bus load y t The loss function given between It is expressed as:
[0160]
[0161] The bus load prediction results are evaluated by the root mean square error RMSE, which is expressed as:
[0162]
[0163] Among them, Z represents the total number of prediction points, y act (z) represents the actual load value at the zth point, y pred (z) represents the predicted load value at the zth point.
[0164] The prediction effect of the holiday short-term bus load forecasting method on the regular day bus load is shown in Table 2.
[0165] Table 2 Normal day bus load prediction effect table
[0166]
[0167] The prediction effect of holiday bus load using the holiday short-term bus load prediction method is shown in Table 3.
[0168] Table 3 Holiday bus load prediction effect table
[0169]
[0170] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0171] Based on the same inventive concept, this embodiment also provides a holiday short-term bus load forecasting system, including:
[0172] A preprocessing module is used to collect historical bus load data and perform preprocessing to remove abnormal values in the bus load data;
[0173] A clustering module is used to cluster the preprocessed bus load data and distinguish bus loads with different means and degrees of variation;
[0174] A feature selection module is used to select input features of the bus load forecasting model based on correlation analysis and feature importance analysis;
[0175] Model building module, used to build a bus load forecasting model including gated residual network and attention mechanism;
[0176] The prediction module is used to use the pre-trained architecture for bus loads with different means and degrees of variation, and freeze some neurons during the fine-tuning process to reduce the demand for computing resources during the training process, complete the training of the bus load prediction model, and use the trained bus load prediction model.
[0177] Based on the same inventive concept, this embodiment also provides a computing device, including: one or more processors, one or more memories and one or more programs, wherein the programs are stored in the memories and configured to be executed by the processors, and when the programs are loaded into the processors, the steps of the holiday short-term bus load forecasting method according to any one of the above items are implemented.
[0178] Based on the same inventive concept, this embodiment also provides a storage medium, which stores a computer program, and the computer program includes program instructions. When the program instructions are executed by a processor, the processor executes the steps of the holiday short-term bus load forecasting method described in any one of the above items.
[0179] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0180] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0181] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0182] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A method for predicting short-term bus load during holidays, characterized in that: include: (1) Clustering the preprocessed bus load data to distinguish bus loads with different means and degrees of variation; (2) Select the input features of the bus load forecasting model based on correlation analysis and feature importance analysis; (3) Establish a bus load forecasting model that includes a gated residual network and an attention mechanism; (4) Use a pre-trained architecture for bus loads with different means and degrees of variation, and freeze some neurons during the fine-tuning process to reduce the demand for computing resources during the training process, complete the training of the bus load prediction model, and use the trained bus load prediction model.
2. The method for predicting short-term bus load during holidays according to claim 1, characterized in that: The method further includes collecting historical bus load data and performing preprocessing to remove abnormal values in the bus load data, and the specific method is: Get historical bus load data {x1,...,x N }, x i is the i-th data, N is the total number of data, calculate the mean μ and standard deviation σ of the data; Determine the confidence level for Chebyshev's inequality: Among them, P represents probability, k is any positive integer greater than 1; Select the k value to define the range of outliers, and combine it with formula (3) to determine the proportion of data that falls within the range of k standard deviations of the mean; Compute a lower bound on outliers: μ-kσ (4) Compute an upper bound on outliers: μ+kσ (5) Remove all data points that exceed the upper and lower limits from the data set; If the change in the mean or standard deviation of the data exceeds the preset threshold after removing the outliers, recalculate the mean and standard deviation, and repeatedly calculate the upper and lower bounds of the outliers and remove all data points that exceed the upper and lower bounds from the data set, and enter this step again for judgment.
3. The method for predicting short-term bus load during holidays according to claim 1, characterized in that: The step (1) comprises: (11) Select the number of clusters K; (12) Randomly select K data points as the initial cluster centers; (13) For each data point, calculate its distance from the center of each cluster using the Euclidean distance formula: Where p and q are two data points, and n is the dimension of the data point; (14) Assign each data point to the cluster represented by the nearest cluster center point; (15) Calculate the average value of all data points in each cluster and use it as the new cluster center. The new cluster center η j The formula is: Among them, η j is the center point of the jth cluster, C j are all the data points in the jth cluster, |C j | is the number of data points in the jth cluster; (16) Repeat steps (13) to (15) until the change in the cluster center point is less than a preset threshold or reaches a preset number of iterations; output the clustering results of the bus load data points and the center point of each cluster.
4. The method for predicting short-term bus load during holidays according to claim 1, characterized in that: The step (2) comprises: (21) selecting bus load and weather characteristics for a number of time periods based on correlation analysis and feature importance ranking; wherein the time characteristics are selected to capture periodic patterns in the bus load data, and the time characteristics include holidays, months, days, hours, and minutes; The input characteristics of the bus load forecasting model at time t are expressed as; x t =[L t-96 ,L t-97 ,...,L t-95-s, W t ,O t ] (8) Among them, L t-t′ , t′∈96,97,...,95+s represents the historical bus load at time tt′, s represents the number of bus load data points of enhanced input, W t represents the weather forecast data at time t, including temperature, light intensity, humidity and wind speed; t Indicates the features taken into consideration, including month, day, and forecast time; (22) Encode the month, day, and holiday type features to capture nonlinear relationships and avoid assuming ordinal relationships; including the following steps: Assume there are m different categories in the data set; Create a matrix of size r×m, where r is the number of data points to be encoded and m is the number of categories; each row of the matrix corresponds to a data point and each column corresponds to a category; For each data point, set the column where its corresponding category is located to 1, and the remaining columns to 0; the formula is as follows: Among them, x i is the ith data point, c j is the jth category; and retains the numerical form of hour and minute features.
5. The method for predicting short-term bus load during holidays according to claim 1, characterized in that: The step (3) comprises: (31) A gated residual network module is used to generate a context vector for fusion into the decoder to enhance the model's ability to understand the input sequence. An exponential linear unit is used as an activation function in the gated residual network module to achieve nonlinear mapping of negative input values while maintaining the invariance of positive input values. The exponential linear unit ELU is defined as follows: Where a represents the input of the exponential linear unit, and the hyperparameter α is used to control the slope of the negative region; (32) Use sequence-to-sequence models to handle the difference in the number of past and future inputs and use LSTM as an alternative to positional encoding; Specifically, the data from time tk to time t As the input of the encoder, the data at the future time As the input of the decoder, a set of unified temporal features φ(t,u)∈φ(t,−k),...,φ(t,τ max ), where u is the position index; The LSTM structure is used as the position encoding method for the encoder and decoder, and the skip connection technology is used to alleviate the gradient disappearance or gradient explosion problems that occur during training. (33) The long-range temporal dependency of bus load and weather data at different time steps is captured by the self-attention mechanism module. The attention mechanism scales the value according to the relationship between keys and queries, expressed as: in is a sequence of values, is the key sequence, is the query sequence, represents the real number domain, M represents the number of elements in the sequence, and d V is the dimension of the value sequence, d attn is the dimension of the query sequence; Use multiple independent attention heads to capture different temporal representation subspaces and share value weights between all heads. Linearly combine the concatenated temporal outputs from all heads, expressed as: in are the header-specific weight matrices for query, key, and value, respectively, and d model are the dimensions of the model input and output, is the value weight shared among all heads, is the linear mapping matrix, m H is the number of different attention heads in the model that process the input in parallel, and H represents the linear combination of the concatenated temporal outputs from all heads; (34) The model feedforward layer is designed based on the gated residual network (GRN); by applying additional nonlinear processing to the output of the self-attention layer, the weights of the GRN are shared throughout the layer.
6. The method for predicting short-term bus load during holidays according to claim 1, characterized in that: The step (4) comprises: (41) performing pre-training on each bus load cluster obtained by clustering in step (1); (42) During the fine-tuning process, the frozen neuron mechanism is implemented to train each bus load separately; let θ represent the hyperparameter set of all trainable parameters in the original model, and divide θ into frozen parameters θ f and trainable parameters θ t , and make θ=θ f ∪θ t ; During fine-tuning, only the t The gradient of Let the target variable y t Corresponding to the bus load at time t, the goal is to learn the mapping function f to minimize the predicted bus load Actual bus load y t The loss function given between It is expressed as: The bus load prediction results are evaluated by the root mean square error RMSE, which is expressed as: Among them, Z represents the total number of prediction points, y act (z) represents the actual load value at the zth point, y pred (z) represents the predicted load value at the zth point.
7. The method for predicting short-term bus load during holidays according to claim 6, characterized in that: The step (41) comprises: Extracting the input features described in step (2) for each bus load cluster; Initialize the pre-trained model for each bus load cluster, set the network structure, learning rate and optimizer parameters; The data of each bus load cluster is trained separately, and the model parameters are iteratively optimized until the predetermined number of training rounds is reached or the loss function converges.
8. A short-term bus load forecasting system for holidays, characterized in that: include: A clustering module is used to cluster the preprocessed bus load data and distinguish bus loads with different means and degrees of variation; A feature selection module is used to select input features of the bus load forecasting model based on correlation analysis and feature importance analysis; Model building module, used to build a bus load forecasting model including gated residual network and attention mechanism; The prediction module is used to use the pre-trained architecture for bus loads with different means and degrees of variation, and freeze some neurons during the fine-tuning process to reduce the demand for computing resources during the training process, complete the training of the bus load prediction model, and use the trained bus load prediction model.
9. A computing device, characterized in that include: One or more processors, one or more memories and one or more programs, wherein the programs are stored in the memories and configured to be executed by the processors, and when the programs are loaded into the processors, the steps of the holiday short-term bus load forecasting method according to any one of claims 1 to 7 are implemented.
10. A storage medium storing a computer program, characterized in that: The computer program includes program instructions, which, when executed by a processor, enable the processor to perform the steps of the holiday short-term bus load forecasting method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Time sequence prediction method and system based on gating self-attention mechanism
CN117852577A
Interpretable bus load prediction method based on attention mechanism
CN117933451A
User electrical load prediction system and method
CN118585783A
Multi-energy integrated short-term load forecasting method and system
US20240146057A1
A bus bar load forecasting method
WO2018045642A1