A power timing prediction method, device, apparatus and medium
By introducing regularization constraints and gradient update range limits into the power forecasting model, the problem of the weakening capability of general time series forecasting models during power data migration is solved, thereby improving the accuracy and stability of power time series forecasting.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGZHOU POWER SUPPLY BUREAU GUANGDONG POWER GRID CO LTD
- Filing Date
- 2026-04-13
- Publication Date
- 2026-07-10
AI Technical Summary
In existing technologies, general time series forecasting models based on machine learning or deep learning are prone to having their general time series modeling capabilities weakened during the migration of power data, thus affecting the accuracy and stability of power time series forecasting.
By introducing regularization constraints and gradient update range limits into the pre-trained time series prediction model, and using historical data from general scenarios to perform gradient calculations on the model, a power prediction model is constructed. Iterative training is then performed using power scenario data, retaining the original general time series modeling capabilities while adapting to the characteristics of power scenarios.
It improves the accuracy and stability of power time series forecasting, avoids excessive parameter updates during model migration, and enhances the model's adaptability to complex and dynamically changing environments.
Smart Images

Figure CN122371090A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of power system forecasting, and in particular to a power time-series forecasting method, apparatus, equipment and medium. Background Technology
[0002] With the continuous expansion of the power system and the integration of various types of loads such as new energy sources and electric vehicles, the power grid operation status exhibits significant temporal and complex characteristics. Accurate time-series forecasting of key indicators such as power load and power grid operation status is of great significance for power system dispatch optimization, supply and demand balance, and safe and stable operation.
[0003] In existing technologies, general time-series forecasting models based on machine learning or deep learning are typically used to model power data. These models are then fine-tuned using power scenario data to migrate from general time-series forecasting to power time-series forecasting. However, due to the distinct domain characteristics of power data, directly using power scenario data to train or fine-tune the model can easily weaken or even eliminate its original general time-series modeling capabilities. This reduces the model's ability to capture long-term time-series dependencies and complex dynamic patterns, thus affecting the accuracy of power time-series forecasting. Summary of the Invention
[0004] This application provides a method, apparatus, device, and medium for power time series prediction, which can solve the problem of low accuracy in power time series prediction in the prior art.
[0005] Some embodiments of this application provide a power time-series prediction method, including: Obtain a pre-trained time series prediction model corresponding to a general scenario, and construct a regularization constraint term for each general training parameter in the time series prediction model using preset historical data of the general scenario; The first output layer of the time series prediction model is connected to the first input layer of the pre-built power prediction head module to obtain the initial power prediction model for the power business scenario, and the loss function of the initial power prediction model is constructed according to each of the regularization constraint terms; wherein, the power training parameters in the initial power prediction model include: the general training parameters and the model parameters in the power prediction head module; The gradient calculation of the initial power prediction model is performed using the historical data of the general scenario to obtain the gradient calculation result, and the gradient update range corresponding to each of the power training parameters is determined based on the gradient calculation result. Acquire historical data of the power scenario, and iteratively train the initial power prediction model based on the historical data of the power scenario, the loss function, and the update range of each gradient to obtain the target power prediction model; Receive power time-series data and input the power time-series data into the target power prediction model to perform power time-series prediction.
[0006] Compared to existing technologies, the above embodiments have the following beneficial effects: This application introduces a regularization constraint term based on historical data from general scenarios on the basis of a pre-trained time series prediction model, and combines a gradient update range limitation mechanism during model training. This allows the model to effectively constrain the updates of key parameters when training using historical power scenario data, thereby adapting to the characteristics of power scenario data while retaining the original general time series modeling capabilities. Furthermore, by first calculating gradients based on non-power scenario data to determine the parameter update range, and then combining iterative training with power scenario data, the problem of excessive parameter updates during model transfer can be avoided, thereby improving the model's ability to characterize long-term time series dependencies and complex dynamic changes. Ultimately, this enables the power prediction model to effectively improve the accuracy and stability of power time series prediction while balancing generality and domain adaptability.
[0007] Furthermore, the step of constructing regularization constraint terms for each general training parameter in the time-series prediction model using preset general scenario historical data includes: Gradient calculation is performed on the time series prediction model using the historical data of the general scenario to obtain the first gradient of the log-likelihood function corresponding to each of the general training parameters; Based on each of the first gradients, calculate the weight coefficient corresponding to each of the general training parameters; Based on the preset parameter values of each of the general training parameters and the corresponding weight coefficients, the regularization constraint terms of each of the general training parameters are constructed.
[0008] Compared with existing technologies, the above embodiments have the following beneficial effects: by using historical data of general scenarios to perform gradient calculation on the time series prediction model, and determining the weight coefficients of each parameter based on the gradient of the log-likelihood function, the corresponding regularization constraint terms are constructed, enabling the model to impose stronger constraints on parameters that are of high importance in general time series tasks. This effectively suppresses drastic changes in key parameters during subsequent power scenario training, avoids the loss of general time series modeling capabilities, and improves the stability and generalization ability of the model during cross-scenario transfer.
[0009] Further, the step of calculating the weight coefficient corresponding to each of the first gradients includes: Squaring each of the first gradients yields the squared gradient values corresponding to each of the general training parameters. Based on the historical data of the general scenario, the expected value of each gradient squared value is statistically calculated to obtain the gradient statistical value corresponding to each of the general training parameters. Based on the gradient statistics, determine the weight coefficients corresponding to each of the general training parameters.
[0010] Compared with the prior art, the above embodiments have the following beneficial effects: by squaring each first gradient and statistically calculating the expectation based on historical data of general scenarios, gradient statistics reflecting the importance of parameters are obtained, and weight coefficients are determined accordingly. This enables the constructed weight coefficients to more accurately characterize the contribution of each parameter to the historical task, thereby improving the rationality and refinement of the regularization constraint terms, further enhancing the protection effect on key parameters, and improving the model's resistance to forgetting during transfer training.
[0011] Further, the step of constructing the loss function of the initial power prediction model based on each of the regularization constraints includes: Based on the prediction results output by the initial power prediction model, a power prediction loss term is constructed. A non-electricity prediction loss term is constructed by weighted summation of the regularization constraint terms corresponding to each of the general training parameters. The loss function of the power prediction model is constructed by weighting and fusing the power prediction loss term with the non-power prediction loss term.
[0012] Compared with existing technologies, the above embodiments have the following beneficial effects: by weighted fusion of the power prediction loss term and the non-power prediction loss term constructed based on regularization constraints, the model can simultaneously take into account the fitting requirements of power scenario tasks and the maintenance requirements of general time series knowledge during the training process. This improves the ability to fit power data while avoiding excessive destruction of the original knowledge structure, thereby improving the accuracy and stability of power time series prediction results.
[0013] Further, the step of performing gradient calculation on the initial power prediction model using the historical data of the general scenario to obtain the gradient calculation result, and determining the gradient update range corresponding to each of the power training parameters based on the gradient calculation result, includes: Gradient calculation is performed on the initial power prediction model using the historical data of the general scenario to obtain the second gradient corresponding to each power training parameter, and the gradient magnitude of each power training parameter is determined based on each second gradient. The gradient magnitude of each of the power training parameters is compared with a preset gradient threshold, and the upper limit and lower limit of gradient update for each power training parameter are determined based on the comparison result. Based on the upper and lower limits of the gradient update, the gradient update range for each of the power training parameters is determined.
[0014] Compared with the prior art, the above embodiments have the following beneficial effects: by performing gradient calculation on the model based on historical data of general scenarios, and determining the upper and lower limits of gradient update for each parameter according to the gradient magnitude and preset gradient threshold, the update range of parameters is limited, so that the model can avoid excessive parameter updates during training, reduce the risk of performance degradation caused by drastic parameter changes, effectively improve the stability of the model training process, and further enhance the prediction accuracy of the model in power scenarios.
[0015] Furthermore, the power prediction head module also includes: a single-neuron regression layer or a multi-dimensional classification layer; the step of inputting the power time-series data into the target power prediction model for power time-series prediction includes: The power time-series data is input into the time-series prediction model for feature extraction, and the time-series feature representation is output through the first output layer. When it is necessary to predict the power load, the time-series feature representation is input into the single neuron regression layer to obtain the power load prediction result; When it is necessary to predict the power grid operating status, the time-series feature representation is input into the multidimensional classification layer to obtain the power grid operating status prediction result.
[0016] Compared with existing technologies, the above embodiments have the following beneficial effects: by setting a single neuron regression layer or a multidimensional classification layer in the power prediction head module, and selecting the corresponding output method according to different prediction task types, the model can flexibly adapt to different application scenarios such as power load prediction or power grid operation status prediction, thereby improving the model's versatility and applicability, ensuring the matching of prediction results with actual task requirements, and improving the overall prediction effect.
[0017] Furthermore, after receiving the power timing data, the method further includes: Statistical feature extraction is performed on the power time-series data to obtain the current data distribution characteristics; The difference between the current data distribution characteristics and the preset benchmark distribution characteristics is calculated to obtain the difference calculation result. Based on the difference calculation result, it is determined whether data distribution drift has occurred. When data distribution drift occurs, the target power prediction model is locally updated based on the power time series data.
[0018] Compared with the prior art, the above embodiments have the following beneficial effects: by extracting statistical features from the input power time series data and calculating the difference between it and the baseline distribution features, it is possible to determine whether data distribution drift has occurred. When distribution drift is detected, the local parameters of the model are updated, so that the model can adaptively adjust according to the dynamic changes of power data, thereby improving the model's adaptability and prediction accuracy in complex and changing environments, and avoiding the decline in prediction performance caused by changes in data distribution.
[0019] Another embodiment of this application provides a power time series prediction device, including: a first construction module, a second construction module, a gradient calculation module, a training module, and a prediction module; The first construction module is used to obtain a pre-trained time series prediction model corresponding to a general scenario, and to construct a regularization constraint term for each general training parameter in the time series prediction model through preset historical data of the general scenario. The second construction module is used to connect the first output layer of the time series prediction model to the first input layer of the pre-built power prediction head module to obtain an initial power prediction model for the power business scenario, and to construct the loss function of the initial power prediction model according to each of the regularization constraint terms; wherein, the power training parameters in the initial power prediction model include: the general training parameters and the model parameters in the power prediction head module; The gradient calculation module is used to perform gradient calculation on the initial power prediction model using the historical data of the general scenario, obtain the gradient calculation result, and determine the gradient update range corresponding to each of the power training parameters based on the gradient calculation result. The training module is used to acquire historical data of the power scenario, and iteratively train the initial power prediction model based on the historical data of the power scenario, the loss function, and the update range of each gradient to obtain the target power prediction model. The prediction module is used to receive power time-series data and input the power time-series data into the target power prediction model to perform power time-series prediction.
[0020] Another embodiment of this application also provides a terminal device, including: a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, it implements the steps of the power timing prediction method of this application.
[0021] Another embodiment of this application also provides a computer-readable storage medium item, including: a stored computer program, which, when the computer program is running, controls the device where the computer-readable storage medium is located to perform the steps of the power timing prediction method of this application. Attached Figure Description
[0022] To more clearly illustrate the technical solution of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0023] Figure 1 This is a flowchart illustrating a power time-series prediction method provided in some embodiments of this application; Figure 2 This is a schematic diagram of the structure of a power timing prediction device provided in some embodiments of this application. Detailed Implementation
[0024] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0025] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the application; the terms “comprising” and “having”, and any variations thereof, in the specification, claims, and foregoing description of the drawings are intended to cover non-exclusive inclusion.
[0026] In the description of the embodiments of this application, technical terms such as "first" and "second" are used only to distinguish different objects and should not be construed as indicating or implying relative importance or implicitly specifying the number, specific order, or primary and secondary relationship of the indicated technical features. In the description of the embodiments of this application, "multiple" means two or more, unless otherwise explicitly defined.
[0027] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0028] In the description of the embodiments in this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship.
[0029] In the description of the embodiments of this application, the term "multiple" refers to two or more (including two), similarly, "multiple sets" refers to two or more (including two sets), and "multiple pieces" refers to two or more (including two pieces).
[0030] In the description of the embodiments of this application, unless otherwise expressly specified and limited, technical terms such as "installation," "connection," "joining," and "fixing" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. For those skilled in the art, the specific meaning of the above terms in the embodiments of this application can be understood according to the specific circumstances.
[0031] In existing technologies, general time-series forecasting models based on machine learning or deep learning are typically used to model power data. These models are then fine-tuned using power scenario data to migrate from general time-series forecasting to power time-series forecasting. However, due to the distinct domain characteristics of power data, directly using power scenario data to train or fine-tune the model can easily weaken or even eliminate its original general time-series modeling capabilities. This reduces the model's ability to capture long-term time-series dependencies and complex dynamic patterns, thus affecting the accuracy of power time-series forecasting.
[0032] Please refer to Figure 1 To address the problem of low accuracy in existing power time-series forecasting, this application provides a power time-series forecasting method, comprising the following steps S101 to S105: S101: Obtain the pre-trained time series prediction model corresponding to the general scenario, and construct the regularization constraint term of each general training parameter in the time series prediction model through the preset historical data of the general scenario.
[0033] Preferably, in some embodiments of this application, the pre-trained time series prediction model is a sequence modeling network based on the Transformer architecture, which includes multiple encoder layers, each layer is configured with multiple attention heads, the hidden layer dimension is a preset value, and has been pre-trained on time series datasets (i.e., general scenario historical data) covering multiple fields such as meteorology, transportation, and finance.
[0034] Preferably, in some embodiments of this application, the pre-trained time series prediction model includes 24 encoder layers, each configured with 16 attention heads, and a hidden layer dimension of 1024. It has been pre-trained on time series datasets covering multiple domains such as meteorology, transportation, and finance. The pre-training process employs a joint objective function of Masked Language Modeling (MLM) and Temporal Span Prediction (TSP), performing end-to-end training on over 50TB of cross-domain time series data, with a cumulative training step count of 2×10^6. 6 Step, the learning rate adopts a cosine annealing strategy starting from 1×10 -4 Attenuation to 1×10 -6 After completing the model parameter training, copy all model parameters to local storage and verify the SHA-256 hash value to ensure parameter consistency.
[0035] Furthermore, in some embodiments of this application, the step of constructing the regularization constraint term for each general training parameter in the time-series prediction model using preset general scenario historical data includes: S1011: The gradient of the time series prediction model is calculated using the historical data of the general scenario to obtain the first gradient of the log-likelihood function corresponding to each of the general training parameters.
[0036] Preferably, in some embodiments of this application, the general training parameters are the parameters of the last 12 encoder layers in a 24-layer encoder layer. By freezing the parameters of the first 12 encoder layers, the parameter training of the bottom feature extraction layer is avoided, thereby improving the model training efficiency.
[0037] S1012: Calculate the weight coefficient corresponding to each of the first gradients for each of the general training parameters.
[0038] Furthermore, in some embodiments of this application, the step of calculating the weight coefficient corresponding to each of the general training parameters based on each of the first gradients includes: Squaring each of the first gradients yields the squared gradient values corresponding to each of the general training parameters. Based on the historical data of the general scenario, the expected value of each gradient squared value is statistically calculated to obtain the gradient statistical value corresponding to each of the general training parameters. Based on the gradient statistics, determine the weight coefficients corresponding to each of the general training parameters.
[0039] Preferably, in some embodiments of this application, the formula for calculating the weight coefficients of the general training parameters is as follows: ; in, The weight coefficients of the i-th general training parameter; Let i be the i-th general training parameter; In historical datasets Above all samples The expected average value; For the model to data points The log-likelihood; For the model to data points The log-likelihood of the parameter The first gradient.
[0040] This application obtains gradient statistics reflecting the importance of parameters by squaring each first gradient and calculating the expectation based on historical data of general scenarios. The weight coefficients are then determined accordingly, enabling the constructed weight coefficients to more accurately characterize the contribution of each parameter to the historical task. This improves the rationality and refinement of the regularization constraint terms, further enhances the protection of key parameters, and improves the model's resistance to forgetting during transfer training.
[0041] S1013 Constructs the regularization constraint term for each of the general training parameters based on the preset parameter values of each of the general training parameters and the corresponding weight coefficients.
[0042] Preferably, in some embodiments of this application, the calculation formula for the regularization constraint term is: ,in Let be the original value of the i-th general training parameter. This represents the parameter value of the current i-th general training parameter.
[0043] Preferably, in some embodiments of this application, when constructing the regularization constraint term, the general scenario historical data used in the pre-training stage is first selected as the historical task dataset. This historical data covers time series samples from multiple fields such as meteorology, transportation, and finance, and is used to characterize the general time series modeling capability. Based on this, for each general training parameter participating in fine-tuning in the time series prediction model, forward and backward propagation calculations are performed based on the general scenario historical data, and the derivative of the model's log-likelihood function is calculated to obtain the first gradient of the log-likelihood function corresponding to each general training parameter. Further, based on the first gradient, it is squared and its expectation is taken on the historical dataset. The expectation is approximated using Monte Carlo sampling to obtain the information content corresponding to each general training parameter, and this information content is used as a weight coefficient representing the importance of the parameter to the historical task. Since this weight coefficient reflects the contribution of each parameter to general time series modeling in non-power scenarios, the larger its value, the more critical the corresponding parameter is in the historical knowledge structure, and the stronger the constraint should be applied in the subsequent fine-tuning process. After obtaining the weight coefficients of each general training parameter, the parameter values of the general training parameters after pre-training are used as preset parameter values. Using these preset parameter values as a reference center, a secondary penalty term based on the elastic weight consolidation idea is introduced to constrain the offset between the current parameter and the preset parameter value. Simultaneously, the corresponding weight coefficients are used as adjustment factors for the penalty intensity, thus constructing the regularization constraint term for each general training parameter. This regularization constraint term essentially applies a greater pull-back effect to important parameters, ensuring that they only undergo limited-amplitude updates during fine-tuning in the power scenario, while allowing less important parameters to adapt more fully to new task data. This effectively preserves the general time-series representation capability learned from historical data of the general scenario while maintaining the model's ability to fit power data.
[0044] This application utilizes historical data from general scenarios to calculate the gradient of a time-series prediction model and determines the weight coefficients of each parameter based on the gradient of the log-likelihood function. This allows the model to construct corresponding regularization constraints, enabling it to impose stronger constraints on parameters that are of high importance in general time-series tasks. This effectively suppresses drastic changes in key parameters during subsequent power scenario training, avoids the loss of general time-series modeling capabilities, and improves the stability and generalization ability of the model during cross-scenario transfer.
[0045] S102: Connect the first output layer of the time series prediction model to the first input layer of the pre-built power prediction head module to obtain the initial power prediction model for the power business scenario, and construct the loss function of the initial power prediction model according to each of the regularization constraints; wherein, the power training parameters in the initial power prediction model include: the general training parameters and the model parameters in the power prediction head module.
[0046] Furthermore, in some embodiments of this application, the step of constructing the loss function of the initial power prediction model based on each of the regularization constraints includes the following steps S1021 to S1023: S1021: Based on the prediction results output by the initial power prediction model, construct the power prediction loss term.
[0047] Preferably, in some embodiments of this application, when fine-tuning the power prediction model, the model is first forward-inferenced based on power-specific data to obtain the prediction results for the corresponding time series. The prediction results are then compared with the actual observations at the same time scale. A corresponding error metric is selected to construct the power prediction loss term based on the specific task type. Specifically, when performing continuous power load prediction, the mean squared error is used as the loss metric. The power prediction loss term is obtained by calculating the squared difference between the predicted load value and the actual load value and averaging it over a batch of samples. When performing a power grid operation status classification task, the cross-entropy loss function is used, and the power prediction loss term is determined based on the difference between the class probability distribution output by the model and the true label.
[0048] S1022: Construct a non-electricity prediction loss term by weighted summation of the regularization constraint terms corresponding to each of the general training parameters.
[0049] Preferably, in some embodiments of this application, for each general training parameter involved in fine-tuning, the regularization constraint terms constructed based on historical data of general scenarios are uniformly processed according to the parameter level, and the constraint terms corresponding to each parameter are summed to obtain the overall non-electricity prediction loss term; wherein, the weight coefficients corresponding to each first training parameter obtained in the above embodiments are introduced into each constraint term, so that the parameters that contribute more to the historical task occupy a larger proportion in the summing process, thereby reflecting the strength of protection of historical knowledge in the overall loss.
[0050] S1023: By weighting and fusing the power prediction loss term with the non-power prediction loss term, the loss function of the power prediction model is constructed.
[0051] Preferably, in some embodiments of this application, based on S1021 to S1022, this application introduces a global balance coefficient to weight and fuse the power prediction loss term and the non-power prediction loss term to construct the final total loss function used for model optimization. In actual implementation, this balance coefficient is preset to a fixed value (e.g., 0.8) to adjust the trade-off between the fitting ability of the new task and the preservation of historical knowledge. In this way, the model minimizes the power prediction error while being simultaneously constrained by important parameters based on the historical task. Thus, during the gradient backpropagation process, the key parameters are pulled back, limiting their deviation from the optimal value range of the pre-training stage. Non-key parameters are allowed to be fully updated to adapt to the power scenario data distribution, ultimately achieving the optimization goal of balancing prediction accuracy and loss of general time series prediction ability.
[0052] Preferably, in some embodiments of this application, the loss function is: ; in, This represents the total loss value. This represents the predicted power loss value. This is the global balance coefficient.
[0053] This application weights and fuses the power prediction loss term with the non-power prediction loss term constructed based on regularization constraints. This allows the model to simultaneously meet the fitting requirements of power scenario tasks and the requirements of preserving general time series knowledge during training. This improves the ability to fit power data while avoiding excessive destruction of the original knowledge structure, thereby improving the accuracy and stability of power time series prediction results.
[0054] S103: Perform gradient calculation on the initial power prediction model using the historical data of the general scenario to obtain the gradient calculation result, and determine the gradient update range corresponding to each of the power training parameters based on the gradient calculation result.
[0055] Furthermore, in some embodiments of this application, the step of performing gradient calculation on the initial power prediction model using the general scenario historical data to obtain gradient calculation results, and determining the gradient update range corresponding to each of the power training parameters based on the gradient calculation results, includes the following S1031 to S1033: S1031: Perform gradient calculation on the initial power prediction model using the historical data of the general scenario to obtain the second gradient corresponding to each of the power training parameters, and determine the gradient magnitude of each of the power training parameters based on each second gradient.
[0056] Preferably, in some embodiments of this application, before the model enters the power scenario fine-tuning, the general scenario historical data (including time series data from multiple fields such as meteorology, transportation, and finance) corresponding to the pre-training stage is first selected as a reference dataset, and a complete forward and backward propagation process is performed only for the power training parameters that are allowed to be updated (i.e., the encoder layer parameters and prediction head parameters that are not frozen), thereby obtaining the second gradient corresponding to each power training parameter; on this basis, statistical processing is performed on each second gradient, such as calculating its absolute mean or expected value in the sample dimension, which is used as the gradient magnitude of the corresponding parameter to characterize the sensitivity and contribution of the parameter in the historical task.
[0057] S1032: Compare the gradient magnitude of each of the power training parameters with a preset gradient threshold, and determine the upper limit and lower limit of gradient update for each of the power training parameters based on the comparison result.
[0058] Preferably, in some embodiments of this application, the gradient magnitude of each of the power training parameters is compared with a preset gradient threshold, wherein the threshold can be set empirically (e.g., on the order of 0.01). When the gradient magnitude of a parameter is greater than or equal to the preset gradient threshold, the parameter is determined to be a key parameter in the historical task; otherwise, it is determined to be a non-key parameter. For the different determination results, corresponding upper and lower limits for gradient updates are set: for key parameters, their gradient update range is strictly limited, and their gradients are truncated or compressed to a preset small interval (e.g., limited to a symmetrical small range) to avoid drastic shifts during subsequent power data fine-tuning; while for non-key parameters, a more relaxed gradient update interval is given, allowing their gradients to vary within a larger range to enhance the model's adaptability to power scenario data.
[0059] S1033: Determine the gradient update range for each of the power training parameters based on the upper and lower limits of the gradient update.
[0060] Preferably, in some embodiments of this application, a corresponding gradient update range is constructed for each power training parameter based on the upper and lower bounds of the gradient update. During subsequent training based on power scenario data, the real-time gradient obtained through backpropagation is pruned or scaled to ensure it always falls within the predetermined update range. In this way, the importance information of parameters in historical tasks is transformed into explicit constraints on their gradient update magnitude. This allows the model to prioritize the stability of key parameters when learning new tasks, while simultaneously making sufficient adjustments to non-key parameters. This achieves effective preservation of general temporal knowledge and rapid adaptation to power scenario characteristics.
[0061] This application calculates the gradient of the model based on historical data of general scenarios, and determines the upper and lower limits of the gradient update of each parameter according to the gradient magnitude and the preset gradient threshold, thereby limiting the update range of the parameters. This allows the model to avoid excessive parameter updates during training, reduces the risk of performance degradation caused by drastic parameter changes, effectively improves the stability of the model training process, and further enhances the prediction accuracy of the model in power scenarios.
[0062] S104: Obtain historical power scenario data, and iteratively train the initial power prediction model based on the historical power scenario data, the loss function, and the update range of each gradient to obtain the target power prediction model.
[0063] Preferably, in some embodiments of this application, when training the power prediction model, the parameters of the first 12 encoder layers in the time series prediction model are kept unchanged, while gradient updates are allowed for the subsequent 12 encoder layers. However, the update magnitude is controlled by the learning rate decay factor, and the initial learning rate is 5×10. -5 The training time is reduced to 0.9 times the original value every 1000 training steps. The historical power scenario data used for training comes from the historical SCADA system records of the provincial power grid dispatch center, spanning the past 3 years. After anonymization, it contains more than 100 million load-weather-event triplet samples with a 15-minute granularity. The training adopts a distributed data parallel strategy, which is carried out on 8 servers equipped with A100 GPUs. The batch size is set to 256, the maximum number of training rounds is 50, and an early stop mechanism monitors the loss of the validation set. If there is no improvement for 5 consecutive rounds, the training is terminated.
[0064] S105: Receive power time-series data and input the power time-series data into the target power prediction model to perform power time-series prediction.
[0065] Furthermore, in some embodiments of this application, the power prediction head module further includes: a single-neuron regression layer or a multi-dimensional classification layer; the step of inputting the power time-series data into the target power prediction model for power time-series prediction includes: The power time-series data is input into the time-series prediction model for feature extraction, and the time-series feature representation is output through the first output layer. When it is necessary to predict the power load, the time-series feature representation is input into the single neuron regression layer to obtain the power load prediction result; When it is necessary to predict the power grid operating status, the time-series feature representation is input into the multidimensional classification layer to obtain the power grid operating status prediction result.
[0066] Preferably, in some embodiments of this application, the time series prediction model is preferably a sequence modeling network based on the Transformer architecture, containing a multi-layer encoder structure. In actual implementation, a structure with 24 encoder layers, multiple attention heads per layer, and a fixed hidden dimension (e.g., 1024 dimensions) can be used to perform deep feature modeling on the input multi-dimensional power time series data. When performing power time series prediction, the preprocessed power time series data, after time alignment, missing value imputation, and anomaly correction, is first input into the time series prediction model. This input data is typically represented in the form of a three-dimensional tensor (batch size × time step × feature dimension), which includes multi-source features such as historical load, temperature, humidity, holiday markers, and equipment status. Subsequently, the data extracts time-related features layer by layer in each encoder layer through a self-attention mechanism and a feedforward network. Finally, the first output layer of the model outputs a time series feature representation with a unified dimension. Furthermore, when performing power load forecasting, the time-series feature representation is input into a single-neuron regression layer. This regression layer outputs continuous real values, and the power load forecast result within the future target time or time interval is directly obtained through linear mapping. When performing grid operation state forecasting, the time-series feature representation is input into the multi-dimensional classification layer. The output dimension of this classification layer is a preset number of state categories (e.g., corresponding to multiple operating states such as "normal, light load, heavy load, overload, and fault"). The output is normalized using the Softmax function to obtain the probability distribution of each state, and the category corresponding to the highest probability is then used as the grid operation state forecast result. Through this structural design, the same time-series forecasting model, while sharing the underlying time-series feature extraction capability, achieves unified support for two types of power application scenarios—continuous value forecasting and discrete state discrimination—through different forms of forecasting head modules, thereby improving the model's applicability and deployment flexibility in actual power systems.
[0067] This application sets up a single-neuron regression layer or a multi-dimensional classification layer in the power prediction head module, and selects the corresponding output method according to different prediction task types. This enables the model to flexibly adapt to different application scenarios such as power load prediction or power grid operation status prediction, thereby improving the model's versatility and applicability, ensuring the matching of prediction results with actual task requirements, and improving the overall prediction effect.
[0068] Furthermore, in some embodiments of this application, after receiving the power timing data, the method further includes the following steps S1051 to S1053: S1051: Statistical feature extraction is performed on the power time series data to obtain the current data distribution characteristics.
[0069] Preferably, in some embodiments of this application, after the power prediction model is deployed and running, power time-series data from the dispatching system or data acquisition system is continuously received. After receiving the data, statistical feature extraction processing is first performed on it to characterize the current data distribution state. Specifically, a sliding window mechanism is used to model continuous data over a recent period. In a preferred implementation, the window length can be set to the time-series data of the most recent 7 days, and updated according to a fixed time granularity (e.g., 15 minutes). Within each window, statistical features are extracted for key variables of the power system, including core dimensions such as load, temperature, and humidity. Their mean, variance, and lag 1 autocorrelation coefficient are calculated respectively to form a multi-dimensional statistical feature vector as the current data distribution feature. At the same time, during the initial training and deployment phase of the model, the statistical features corresponding to the training dataset (also including the above-mentioned mean, variance, and autocorrelation coefficient) are statistically analyzed and stored as preset baseline distribution features.
[0070] S1052: Calculate the difference between the current data distribution characteristics and the preset benchmark distribution characteristics to obtain the difference calculation result, and determine whether data distribution drift has occurred based on the difference calculation result.
[0071] Preferably, in some embodiments of this application, after obtaining the current data distribution characteristics, the difference between them and the baseline distribution characteristics is calculated to determine whether the data distribution has changed. Specifically, each feature dimension can be approximated as a Gaussian distribution, and the KL divergence between the current window distribution and the baseline distribution is calculated based on this assumption, obtaining a difference index for each feature dimension. Furthermore, the difference of each dimension is monitored; when the KL divergence of any feature dimension exceeds a preset gradient threshold within multiple consecutive sliding windows, it is determined that a data distribution drift has occurred, thereby obtaining the difference calculation result and the drift judgment conclusion.
[0072] The formula for calculating the KL divergence is: ; in, For the first KL divergence of dimensional features; For the first Standard deviation of dimensional features; For the first The mean of the dimensional features; For the first The standard normal distribution of the 3D features; For the first The preset mean of the dimensional feature.
[0073] S1053: When data distribution drift occurs, the target power prediction model is locally updated based on the power time series data.
[0074] Preferably, in some embodiments of this application, after detecting data distribution drift, a local parameter update process of the model is automatically triggered to achieve adaptation to the new environment. Specifically, an incremental learning strategy is adopted, updating only some parameters of the model to balance computational efficiency and knowledge retention; for example, only the parameters of a few encoder layers and the power prediction head module are updated, thereby keeping the parameters of the front-end low-level feature extraction layer unchanged, thus avoiding damage to the general time-series feature representation capability. During the update process, newly acquired power time-series data after the drift occurs are used as training samples, and several rounds of iterative training are performed using the mini-batch stochastic gradient descent optimization method. Combined with the aforementioned loss function and gradient update anti-spoofing, the parameter update magnitude is controlled to prevent excessive forgetting of historical knowledge. Furthermore, after completing the local update, the model can be backtested and evaluated using a historical validation set. When the performance degradation of the model on the original general task is detected to exceed a preset gradient threshold, the model is rolled back and the regularization strength is adjusted, thereby ensuring that the model maintains the stability of overall prediction performance while adapting to the new data distribution. Through the above process, dynamic perception of changes in the distribution of power time-series data and adaptive updating of model parameters are achieved, enabling the model to maintain high prediction accuracy and robustness in complex environments where load patterns change over time.
[0075] Preferably, in some embodiments of this application, after each local parameter update, the power prediction model is backtested using a historical validation set. If the accuracy of the general time series task decreases by more than a preset percentage threshold, the system rolls back to the previous version and adjusts the regularization strength. This mechanism maintains a historical validation set containing 100,000 cross-domain time series samples, covering three general tasks: weather temperature prediction, urban traffic flow prediction, and stock index fluctuation prediction. After each incremental learning iteration, the system automatically performs forward inference on this validation set to calculate the mean absolute error (MAE) or accuracy of each task. If the performance metric of any task decreases by more than 3% compared to before the update, a rollback operation is triggered: a snapshot of the model parameters from the previous version is loaded, and the regularization coefficient λ is increased by 20% (e.g., from 0.8 to 0.96), followed by re-execution of the incremental learning process. This backtracking evaluation process runs in an isolated test container and takes no more than 10 minutes, ensuring that it does not affect the availability of the main service.
[0076] This application extracts statistical features from the input power time-series data and calculates the difference between the data and the baseline distribution features to determine whether data distribution drift has occurred. When distribution drift is detected, the local parameters of the model are updated, enabling the model to adaptively adjust according to the dynamic changes in power data. This improves the model's adaptability and prediction accuracy in complex and changing environments and avoids the decline in prediction performance caused by changes in data distribution.
[0077] Preferably, in some embodiments of this application, after the power prediction model has been trained and undergone multiple rounds of incremental learning, the power prediction model is solidified and deployed to the power dispatching system for medium- and long-term power load prediction or grid operation status prediction tasks. Specifically, the power prediction model solidification process includes quantizing and compressing all parameters, converting 32-bit floating-point numbers (FP32) into 8-bit integer representations (INT8), employing a symmetric linear quantization strategy, and dynamically determining the scaling factor through a minimum-maximum value on a calibration set. After quantization, the model generates a lightweight inference engine, which is built on TensorRT 8.6, enabling layer fusion, automatic kernel tuning, and memory reuse optimization. It is deployed on the edge computing nodes of the provincial dispatching center (hardware platform is NVIDIA Jetson AGX Orin), with a single prediction response time of less than or equal to 50 milliseconds, meeting the time constraints of real-time power system dispatching. The deployed model provides services through a RESTful API, with input being a JSON-formatted time-series feature array and output being the predicted load value or state probability distribution. The interface protocol follows the IEC 61850 standard extension specification.
[0078] Preferably, in some embodiments of this application, when performing power time-series forecasting using a deployed power forecasting model, the process further includes time alignment, missing value imputation, and outlier correction of the real-time collected raw load data, weather forecast data, and equipment maintenance plan data to form a unified input tensor with a time granularity of 15 minutes and a feature dimension of 32. This process first receives raw streams from three heterogeneous data sources: load data originates from smart meters and substation RTUs, with a sampling frequency of 15 minutes / time and an accuracy of ±0.5%; weather forecast data comes from the provincial meteorological bureau's API, containing hourly forecasts for the next 72 hours, upsampling to a 15-minute granularity through cubic spline interpolation; and equipment maintenance plan data is a structured database table recording the planned outage periods for each main transformer and line within the next 30 days. Time alignment is performed using the UTC+8 time zone as a reference, uniformly mapping all data to a fixed timestamp grid. Missing value imputation employs Multiple Imputation by Chained Equations (MICE), based on joint inference from historical patterns and spatially neighboring site data. Outlier correction uses the Isolation Forest algorithm to identify outliers, and for detected anomalous load values, the median value within a sliding window is used for replacement. The resulting unified input tensor is then input into the power forecasting model for prediction.
[0079] To further illustrate the application effect of the power time-series forecasting method provided in this application embodiment, the following application scenario example is constructed: A provincial power grid dispatch center deploys the power forecasting model described in this application for regional load forecasting for the next 7 days. In the initial stage, the system loads a large Transformer model (24 layers, 1024 dimensions) pre-trained on meteorological, traffic, and financial data, and connects a power forecasting head module with two forecasting heads (512→1), forming the basic framework of the power forecasting model. Subsequently, the parameters are fine-tuned using the province's load-meteorological data from the past 3 years: the first 12 layers of encoders are frozen, and the regularization constraint (setting λ=0.8) and parameter gradient update range (τ=0.01) described in this application embodiment are applied to the last 12 layers. After 50 training rounds, the average absolute error of the validation set is reduced to 1.8%. After the model is deployed, it enters a self-updating monitoring state. In mid-July 2024, affected by continuous high temperatures, the load pattern drifted significantly: the monitoring module detected that the load mean KL divergence exceeded 0.15 for three consecutive windows (the actual value reached 0.22), automatically triggering incremental learning. The system used 12,000 newly collected samples from July 10th to 17th, updating only the last 6 layers of the encoder and prediction head, and completed adaptation after 20 rounds of training. Backtracking evaluation showed that the mean absolute error for the general task increased by only 0.4%, without triggering a rollback. The updated model's mean absolute error for predictions from July 18th to 24th was 2.1%, while the unupdated model's error reached 4.7% during the same period. The model was deployed to edge nodes after INT8 quantization, with a single 7-day prediction taking 42 milliseconds, and memory usage decreasing from 4.2GB to 1.1GB, meeting the scheduling system's ≤50ms response time requirement.
[0080] To further illustrate the application effect of the power time series prediction method provided in this application embodiment, another application scenario example is constructed as follows: The pre-trained general time series large model adopts the same architecture as the above application example, but the power prediction head module is configured with 5-dimensional classification output, corresponding to five states: "normal", "light load", "heavy load", "overload", and "fault". Furthermore, when obtaining the regularization constraint term, SCADA and PMU data from a certain city's distribution network over the past two years are used, totaling 80 million 1-minute granular samples; the first 10 encoder layers are frozen (due to the high-frequency characteristics of the distribution network time series, more underlying details need to be retained), the global balance coefficient λ is set to 0.75, and the preset gradient threshold τ=0.008. During incremental updates, the monitoring window is shortened to 24 hours (T_window=1440), and voltage amplitude and harmonic distortion rate are added to the monitoring features to form a 15-dimensional statistical vector; the KL divergence threshold δ is set to 0.12, and an update is triggered when two consecutive windows exceed the limit. Finally, the quantization employs an INT7 asymmetric strategy to preserve small-signal sensitivity, deployed at the distribution automation terminal (FTU), with a response time requirement of ≤30ms. During a large-scale equipment overhaul in the spring of 2024, the system detected a sudden change in the distribution of equipment status codes (KL divergence reached 0.18), triggering incremental learning. After updating the model with new data from the overhaul period, the F1-score for status classification remained above 0.93, while the static model dropped to 0.76. A retrospective evaluation mechanism validates the financial time series forecasting task after each update, ensuring that the general capabilities do not degrade.
[0081] To further illustrate the application effect of the power time-series forecasting method provided in this application, another application scenario is constructed as follows: In a cross-regional power grid collaborative forecasting scenario, this application is used to construct a provincial L1 model federated learning system. Each provincial node independently executes the power time-series forecasting method of this application, sharing the same pre-trained general-purpose model and self-updating logic. The power time-series data used to train the power forecasting model is specific to the province, but the weight coefficients required to generate the regularization constraint terms for each general training parameter are uploaded to the central server via a secure aggregation protocol for global importance weight calculation. The baseline distribution features for subsequent incremental learning are also distributed by the central server. These baseline distribution features are generated based on national historical data statistics to ensure a unified drift detection standard. When a province triggers a self-update, its incrementally learned high-level parameters are uploaded to the central server after differential privacy perturbation (ε=1.0). The central server aggregates these parameters to generate a new version of the general-purpose time-series model for other provinces to reference. Under this architecture, a province in East China successfully adapted to the sudden load drop mode during the typhoon season. Its update experience, after being aggregated, helped provinces in South China adjust their models in advance, improving the overall regional prediction stability by 18%. The model solidification stage adopted hybrid quantization: INT8 encoder layer and FP16 prediction head, balancing accuracy and efficiency. It was deployed on a provincial cloud-edge collaborative platform to meet the wide-area prediction latency requirement of ≤100ms.
[0082] In summary, the power time-series forecasting method provided in this application has the following advantages compared to existing technologies: This application introduces a regularization constraint term based on historical data from general scenarios on top of a pre-trained time-series forecasting model. Furthermore, it incorporates a gradient update range limitation mechanism during model training. This allows the model to effectively constrain the updates of key parameters when training with historical power scenario data, thereby adapting to the characteristics of power scenario data while retaining its original general time-series modeling capabilities. Further, by first calculating gradients based on non-power scenario data to determine the parameter update range, and then iteratively training with power scenario data, the problem of excessive parameter updates during model migration can be avoided, thereby improving the model's ability to characterize long-term time-series dependencies and complex dynamic changes. Ultimately, this enables the power forecasting model to effectively improve the accuracy and stability of power time-series forecasting while balancing generality and domain adaptability.
[0083] like Figure 2 As shown, based on the above method embodiments, an embodiment of this application provides a power time series prediction device, including: a first construction module 201, a second construction module 202, a gradient calculation module 203, a training module 204, and a prediction module 205; The first construction module 201 is used to obtain a pre-trained time series prediction model corresponding to a general scenario, and to construct a regularization constraint term for each general training parameter in the time series prediction model through preset historical data of the general scenario. The second construction module 202 is used to connect the first output layer of the time series prediction model to the first input layer of the pre-built power prediction head module to obtain an initial power prediction model for the power business scenario, and to construct the loss function of the initial power prediction model according to each of the regularization constraint terms; wherein, the power training parameters in the initial power prediction model include: the general training parameters and the model parameters in the power prediction head module; The gradient calculation module 203 is used to perform gradient calculation on the initial power prediction model using the historical data of the general scenario, obtain the gradient calculation result, and determine the gradient update range corresponding to each of the power training parameters based on the gradient calculation result. The training module 204 is used to acquire historical data of power scenarios, and iteratively train the initial power prediction model based on the historical data of power scenarios, the loss function and the update range of each gradient to obtain the target power prediction model. The prediction module 205 is used to receive power time-series data and input the power time-series data into the target power prediction model to perform power time-series prediction.
[0084] Further, in some embodiments of this application, the first construction module 201 includes: a first computing unit, a second computing unit, and a third computing unit; the first construction module 201 is used to construct a regularization constraint term for each general training parameter in the time series prediction model using preset general scenario historical data, including: The first computing unit is used to perform gradient calculation on the time series prediction model using the general scenario historical data to obtain the first gradient of the log-likelihood function corresponding to each of the general training parameters; The second calculation unit is used to calculate the weight coefficient corresponding to each of the first gradients for each of the general training parameters. The third calculation unit is used to construct the regularization constraint term for each of the general training parameters based on the preset parameter values of each of the general training parameters and the corresponding weight coefficients.
[0085] Furthermore, in some embodiments of this application, the second calculation unit is configured to calculate the weight coefficient corresponding to each of the general training parameters based on each of the first gradients, including: Squaring each of the first gradients yields the squared gradient values corresponding to each of the general training parameters. Based on the historical data of the general scenario, the expected value of each gradient squared value is statistically calculated to obtain the gradient statistical value corresponding to each of the general training parameters. Based on the gradient statistics, determine the weight coefficients corresponding to each of the general training parameters.
[0086] Further, in some embodiments of this application, the second construction module 202 includes: a fourth calculation unit, a first weighting unit, and a second weighting unit; the second construction module 202 is used to construct the loss function of the initial power prediction model according to each of the regularization constraint terms, including: The fourth calculation unit is used to construct a power prediction loss term based on the prediction results output by the initial power prediction model. The first weighting unit is used to construct a non-electricity prediction loss term by weighted summation of the regularization constraint terms corresponding to each of the general training parameters; The second weighting unit is used to construct the loss function of the power prediction model by weighting and fusing the power prediction loss term with the non-power prediction loss term.
[0087] Further, in some embodiments of this application, the gradient calculation module 203 includes: a fifth calculation unit, a comparison unit, and a generation unit; the gradient calculation module 203 is used to perform gradient calculation on the initial power prediction model using the general scenario historical data, obtain gradient calculation results, and determine the gradient update range corresponding to each of the power training parameters based on the gradient calculation results, including: The fifth calculation unit is used to perform gradient calculation on the initial power prediction model using the general scenario historical data, to obtain the second gradient corresponding to each power training parameter, and to determine the gradient magnitude of each power training parameter based on each second gradient. The comparison unit is used to compare the gradient magnitude of each of the power training parameters with a preset gradient threshold, and determine the upper limit and lower limit of gradient update for each of the power training parameters based on the comparison result. The generation unit is used to determine the gradient update range for each of the power training parameters based on the upper and lower limits of the gradient update.
[0088] Furthermore, in some embodiments of this application, the power prediction head module further includes: a single-neuron regression layer or a multidimensional classification layer; the prediction module 205 includes: a first extraction unit, a first prediction unit, and a second prediction unit; the prediction module 205 is used to input the power time series data into the target power prediction model to perform power time series prediction, including: The first extraction unit is used to input the power time series data into the time series prediction model for feature extraction, and output the time series feature representation through the first output layer; The first prediction unit is used to input the time-series feature representation into the single-neuron regression layer when it is necessary to predict the power load, so as to obtain the power load prediction result; The second prediction unit is used to input the time-series feature representation into the multidimensional classification layer to obtain the power grid operation state prediction result when it is necessary to predict the power grid operation state.
[0089] Furthermore, in some embodiments of this application, the prediction module 205 further includes: a second extraction unit, a sixth calculation unit, and an update unit; the prediction module 205, after receiving power time-series data, further includes: The second extraction unit is used to extract statistical features from the power time-series data to obtain the current data distribution features; The sixth calculation unit is used to calculate the difference between the current data distribution characteristics and the preset benchmark distribution characteristics, obtain the difference calculation result, and determine whether data distribution drift has occurred based on the difference calculation result. The update unit is used to update the local parameters of the target power prediction model based on the power time series data when data distribution drift occurs.
[0090] It is understood that the above-described device embodiments correspond to the method embodiments of this application, and can implement the power timing prediction method provided by any of the above-described method embodiments of this application.
[0091] It should be noted that the device embodiments described above are merely illustrative, and some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the device embodiments provided in this application, the connection relationships between modules indicate that they have communication connections, which can specifically be implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without any creative effort.
[0092] Based on the above embodiments of the power timing prediction method, another embodiment of this application provides a terminal device, which includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the power timing prediction method of any embodiment of this application.
[0093] For example, in this embodiment, the computer program can be divided into one or more modules, which are stored in the memory and executed by the processor to complete this application. The one or more module units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the terminal device.
[0094] The terminal device may be a desktop computer, laptop, handheld computer, or cloud server, etc. The terminal device may include, but is not limited to, a processor and a memory.
[0095] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the terminal device, connecting all parts of the terminal device via various interfaces and lines.
[0096] Based on the above-described method embodiments, another embodiment of this application provides a computer-readable storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to execute the power timing prediction method described in any of the above-described method embodiments of this application.
[0097] The modules / units integrated in the device / terminal equipment, if implemented as software functional units and sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.
Claims
1. A method for predicting electricity time series, characterized in that, include: Obtain a pre-trained time series prediction model corresponding to a general scenario, and construct a regularization constraint term for each general training parameter in the time series prediction model using preset historical data of the general scenario; The first output layer of the time series prediction model is connected to the first input layer of the pre-built power prediction head module to obtain the initial power prediction model for the power business scenario, and the loss function of the initial power prediction model is constructed according to each of the regularization constraint terms; wherein, the power training parameters in the initial power prediction model include: the general training parameters and the model parameters in the power prediction head module; The gradient calculation of the initial power prediction model is performed using the historical data of the general scenario to obtain the gradient calculation result, and the gradient update range corresponding to each of the power training parameters is determined based on the gradient calculation result. Acquire historical data of the power scenario, and iteratively train the initial power prediction model based on the historical data of the power scenario, the loss function, and the update range of each gradient to obtain the target power prediction model; Receive power time-series data and input the power time-series data into the target power prediction model to perform power time-series prediction.
2. The power time-series prediction method as described in claim 1, characterized in that, The regularization constraint term for each general training parameter in the time series prediction model, constructed using preset general scenario historical data, includes: Gradient calculation is performed on the time series prediction model using the historical data of the general scenario to obtain the first gradient of the log-likelihood function corresponding to each of the general training parameters; Based on each of the first gradients, calculate the weight coefficient corresponding to each of the general training parameters; Based on the preset parameter values of each of the general training parameters and the corresponding weight coefficients, the regularization constraint terms of each of the general training parameters are constructed.
3. The power time-series prediction method as described in claim 2, characterized in that, The step of calculating the weight coefficient corresponding to each of the first gradients includes: Squaring each of the first gradients yields the squared gradient values corresponding to each of the general training parameters. Based on the historical data of the general scenario, the expected value of each gradient squared value is statistically calculated to obtain the gradient statistical value corresponding to each of the general training parameters. Based on the gradient statistics, determine the weight coefficients corresponding to each of the general training parameters.
4. The power time series prediction method as described in claim 1, characterized in that, The loss function for constructing the initial power prediction model based on each of the regularization constraints includes: Based on the prediction results output by the initial power prediction model, a power prediction loss term is constructed. A non-electricity prediction loss term is constructed by weighted summation of the regularization constraint terms corresponding to each of the general training parameters. The loss function of the power prediction model is constructed by weighting and fusing the power prediction loss term with the non-power prediction loss term.
5. The power time-series prediction method as described in claim 1, characterized in that, The step of performing gradient calculation on the initial power prediction model using the historical data of the general scenario to obtain the gradient calculation result, and determining the gradient update range for each of the power training parameters based on the gradient calculation result, includes: Gradient calculation is performed on the initial power prediction model using the historical data of the general scenario to obtain the second gradient corresponding to each power training parameter, and the gradient magnitude of each power training parameter is determined based on each second gradient. The gradient magnitude of each of the power training parameters is compared with a preset gradient threshold, and the upper limit and lower limit of gradient update for each power training parameter are determined based on the comparison result. Based on the upper and lower limits of the gradient update, the gradient update range for each of the power training parameters is determined.
6. The power time-series prediction method as described in claim 1, characterized in that, The power prediction head module further includes: a single-neuron regression layer or a multi-dimensional classification layer; the step of inputting the power time-series data into the target power prediction model for power time-series prediction includes: The power time-series data is input into the time-series prediction model for feature extraction, and the time-series feature representation is output through the first output layer. When it is necessary to predict the power load, the time-series feature representation is input into the single neuron regression layer to obtain the power load prediction result; When it is necessary to predict the power grid operating status, the time-series feature representation is input into the multidimensional classification layer to obtain the power grid operating status prediction result.
7. The power time-series prediction method as described in claim 1, characterized in that, After receiving the power timing data, the method further includes: Statistical feature extraction is performed on the power time-series data to obtain the current data distribution characteristics; The difference between the current data distribution characteristics and the preset benchmark distribution characteristics is calculated to obtain the difference calculation result. Based on the difference calculation result, it is determined whether data distribution drift has occurred. When data distribution drift occurs, the target power prediction model is locally updated based on the power time series data.
8. A power time-series prediction device, characterized in that, include: The module consists of a first construction module, a second construction module, a gradient calculation module, a training module, and a prediction module. The first construction module is used to obtain a pre-trained time series prediction model corresponding to a general scenario, and to construct a regularization constraint term for each general training parameter in the time series prediction model through preset historical data of the general scenario. The second construction module is used to connect the first output layer of the time series prediction model to the first input layer of the pre-built power prediction head module to obtain an initial power prediction model for the power business scenario, and to construct the loss function of the initial power prediction model according to each of the regularization constraint terms; wherein, the power training parameters in the initial power prediction model include: the general training parameters and the model parameters in the power prediction head module; The gradient calculation module is used to perform gradient calculation on the initial power prediction model using the historical data of the general scenario, obtain the gradient calculation result, and determine the gradient update range corresponding to each of the power training parameters based on the gradient calculation result. The training module is used to acquire historical data of the power scenario, and iteratively train the initial power prediction model based on the historical data of the power scenario, the loss function, and the update range of each gradient to obtain the target power prediction model. The prediction module is used to receive power time-series data and input the power time-series data into the target power prediction model to perform power time-series prediction.
9. A terminal device, characterized in that, The device includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor, when executing the computer program, implements a power timing prediction method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored computer program, wherein, when the computer program is executed, it controls the device on which the computer-readable storage medium is located to perform a power timing prediction method as described in any one of claims 1 to 7.