Load prediction method, system, device and storage medium based on shape loss function

By using the LSTM plus KAN method based on the shape loss function in power load prediction, the problems of poor prediction ability, prediction lag and long-term accuracy are solved, and higher prediction accuracy and stability are achieved.

CN119740713AInactive Publication Date: 2025-04-01LUCULENT SMART TECHNOLOGIES CO LTD

Patent Information

Application Number
CN202510251813.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-05
Publication Date
2025-04-01
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The prior art has problems such as poor prediction ability of fluctuation trends, lag in prediction and long-term prediction accuracy in power system load prediction.

Method used

The LSTM plus KAN power load prediction method based on the shape loss function is adopted. By collecting and preprocessing the load characteristic data, the loss function is constructed and the model is trained to improve the prediction accuracy.

Benefits of technology

This method can more accurately capture the shape characteristics of load data, reduce the prediction hysteresis and cumulative errors, and improve the accuracy of long-term prediction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119740713A_ABST
    Figure CN119740713A_ABST
Patent Text Reader

Abstract

The present invention discloses a load prediction method and system based on a shape loss function, and relates to the technical field of load prediction of power systems, including collecting a load feature data set within a prediction area, and mapping, cleaning and normalizing the collected data, and calculating the correlation coefficient of an indicator for the power load through the Pearson correlation formula and analyzing the loss function based on the DTW algorithm, constructing an LSTM plus KAN power load prediction algorithm model based on the shape loss function, and using the loss function to train the power load prediction algorithm model, using the optimal model after training, predicting power load data, and using test set data to evaluate the power load prediction model, and using hyperparameter optimization to adjust the model. The present invention is superior to traditional methods in both accuracy and stability, can better adapt to complex and changeable load prediction scenarios, and has broad application prospects and significant practical value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of power system load forecasting, and in particular to a shape loss function-based load forecasting method, system, device and storage medium. Background Art

[0002] Traditional load forecasting methods are mainly based on statistical models or simple machine learning algorithms. These methods have low prediction accuracy when processing complex power system data. With the application of deep learning algorithms in power systems, the accuracy of load forecasting has been improved, but current research still has the following three problems: poor ability to predict load fluctuation trends, such as low prediction accuracy for load peaks and valleys; load forecasting has a certain lag and cannot accurately reflect the specific time of load changes; long-term forecasts have large cumulative errors, resulting in a serious reduction in accuracy.

[0003] The Kolmogorov-Arnold network is a new type of neural network architecture. KAN uses the Kolmogorov-Arnold representation theorem to process multi-dimensional input data through several one-dimensional neural networks, modifies the underlying linear model of the neural network, and uses spline functions as activation functions. It performs better when processing complex nonlinear time series data and can better capture the fluctuation characteristics in load data.

[0004] With the large-scale access of electric vehicles and distributed energy and the accelerated construction of new power systems, the requirements for load forecasting accuracy are becoming increasingly higher. In order to overcome the shortcomings of existing technologies, it is necessary to develop a new load forecasting method that can improve forecasting accuracy and better adapt to the complex characteristics and changing trends of power systems. Summary of the invention

[0005] In view of the above-mentioned existing problems, the present invention provides a load prediction method, system, device and storage medium based on shape loss function, so as to solve the problems in the prior art of poor prediction ability of load fluctuation trend, certain lag in load prediction and large cumulative error in long-term prediction resulting in seriously reduced accuracy.

[0006] In order to solve the above technical problems, a load prediction method based on shape loss function is proposed, including: The load characteristic data set in the prediction area is collected, and the collected data is mapped, cleaned and normalized. The correlation coefficient of the indicator for the power load is calculated and analyzed through the Pearson correlation formula, and the preprocessed data set is divided into training set, validation set and test set; the loss function is constructed based on the DTW algorithm, and the LSTM plus KAN power load prediction algorithm model based on the shape loss function is constructed, and the power load prediction algorithm model is trained using the loss function; the power load data is predicted using the optimal model after training, and the power load prediction model is evaluated using the test set data to evaluate the accuracy of the prediction, the fitting effect of the model is evaluated using the validation set data, and the model is adjusted using hyperparameter optimization.

[0007] As a preferred solution of the load forecasting method based on shape loss function described in the present invention, wherein: the load characteristic data set in the forecasting area includes date type, holiday name, historical load data, historical weather data, and forecast weather data.

[0008] Among them, the date type and holiday name need to be predicted in advance, and data from the past year to the next fifteen days are taken. The historical load and weather data take data from the past year, and the predicted weather data takes data from the next fifteen days; the weather data includes temperature, precipitation, wind speed, and light intensity.

[0009] The mapping includes mapping two types of character information, namely date type and holiday name, into numerical information and inputting them into the network for data training; the cleaning includes filling in the missing data by forward and backward filling and linear filling; outlier detection is performed by machine learning methods, and abnormal data is processed by deleting and replacing outliers.

[0010] The normalization includes scaling the feature data to a range of 0 to 1 using a normalization formula, thereby eliminating the impact of differences in magnitude and dimensions of different features on model training.

[0011] The normalization formula is: , in, is the original data, is the normalized data, is the minimum value of the original data set, is the maximum value of the original data set.

[0012] As a preferred solution of the load prediction method based on shape loss function described in the present invention, wherein: the correlation coefficient of the calculated index for the power load includes analyzing the correlation coefficient of the index for the power load using the Pearson correlation analysis method, and the analysis shows that the future load data has the greatest correlation with the historical load data and the least correlation with precipitation, and the precipitation is removed from the feature input.

[0013] The Pearson correlation formula is: , in, represents the Pearson correlation coefficient, and are the mth data points of variables X and Y respectively, and are the means of variables X and Y respectively, and Σ represents the sum of all data points.

[0014] As a preferred solution of the load forecasting method based on shape loss function described in the present invention, wherein: the construction of the LSTM plus KAN power load forecasting algorithm model based on shape loss function includes setting the daily 96-point load data as a group of input data, generating an input sequence for model training with 80% of the total data for one year, defining the model structure and setting the model parameters, setting the parameters of each layer of the LSTM model according to the dimensions of the input data and the output prediction data to match the dimensions of each data, constructing an LSTM model for load forecasting based on the Pytorch neural network module, setting the number of LSTM hidden layers to 2, and setting the number of hidden nodes to 48.

[0015] The model structure definition includes a single-layer LSTM and a single-layer KAN layer; the setting of model parameters includes the number of LSTM units, sequence time compensation, input feature dimension, activation function, and selecting the best loss function to minimize the loss.

[0016] The model training includes forward propagation, outputting the predicted load value, and using the loss function to calculate the error between the predicted value and the true value, calculating the gradient through the back-propagation algorithm, and using the Adam optimizer to update the model parameters according to the calculated gradient; the forward propagation includes passing the input data to the model, and the model enters the KAN layer after being processed by the LSTM layer with parameter settings.

[0017] As a preferred solution of the load prediction method based on shape loss function described in the present invention, wherein: the construction of the LSTM plus KAN power load prediction algorithm model based on shape loss function also includes defining the number of input features and output features of the KAN module, the grid size is 5, the order of the piecewise polynomial is 3, the scaling factor of the noise adjustment is 0.1, the scaling factor of the basic weight is 1, the scaling factor of the piecewise polynomial weight is 1, the basic activation function is a Sigmoid linear unit, the grid adjustment parameter is 0.02, the grid range is [-1,1], each weight parameter is uniformly initialized using Kaiming, the B-spline basis function and the interpolation of the multi-segment polynomial are calculated according to the input data, the nonlinear transformation of the data is performed, and different activation functions are used in different data regions to map the nonlinear relationship, and the activation term and entropy term containing L1 regularization are calculated to eliminate overfitting.

[0018] The B-spline basis function interpolation coefficient calculation formula is: , , in, is the knot vector, k is the order of the spline which is 3, C is the interpolation coefficient matrix, a is the input value, B is the matrix composed of B-spline basis functions, and Y is the vector of target values.

[0019] Computing the activation term involves summing the absolute values ​​of the model parameters, expressed as: , in, is the loss function of the activation term, is the jth weight parameter for the ith input sample in the polynomial interpolation parameter, n is the number of samples, and m is the number of weights.

[0020] The formula for calculating the entropy term is: , , in, represents the loss function of the entropy term, represents the normalized weight of the i-th sample, is the jth weight parameter for the ith input sample in the polynomial interpolation parameter, n is the number of samples, and m is the number of weights.

[0021] As a preferred solution of the load prediction method based on shape loss function described in the present invention, wherein: the training of the power load prediction algorithm model includes, on the basis of L1 regularization, adding a shape loss function based on the DTW method to construct, iteratively updating the parameters during the training process, obtaining the optimal model parameters by minimizing the loss function, encapsulating the KAN neural network model, establishing a multi-layer KAN system model according to the basic model for load prediction, and adding a KAN module after the LSTM module to process the output data of the LSTM to output the final model prediction value.

[0022] The shape loss function formula includes: = + + + , in, is the model’s predicted value for the lth sample, is the true value of the model for the lth sample, L is the value of the newly constructed loss function, is the conventional loss function formula, represents the loss function of the entropy term, is the loss function of the activation term.

[0023] The conventional loss function formula is expressed as: , in, is the model’s predicted value for the lth sample, is the true value of the model for the lth sample, r is the total number of samples in the data set, is the conventional loss function.

[0024] , in, is the model’s predicted value for the lth sample, is the true value of the model for the lth sample, To adjust the parameters and control the degree of smoothness in the loss function, represents the difference matrix between the predicted value and the true value, A represents the alignment path, Represents the set of all alignment paths; represents the total distance along the alignment path A; Represents the value of the shape loss function.

[0025] As a preferred solution of the load forecasting method based on shape loss function described in the present invention, the predicted power load data includes using the trained optimal model to predict the power load data for the next day and the next week, using different indicators and using the data in the test set to evaluate the power load forecasting model to evaluate the accuracy of the prediction.

[0026] The calculation formula of the indicator is: , , , Among them, MAE represents the mean absolute error, RMSE represents the root mean square error, MAPE represents the mean absolute percentage error, and s represents the number of samples of the predicted value and the true value. is the model’s predicted value for the lth sample, is the true value of the model for the lth sample; MAPE less than 5% indicates accurate prediction.

[0027] The use of hyperparameter optimization to adjust the model includes optimizing the window length, number of hidden layers, number of hidden layer nodes, and learning rate of the input training data. The window length is selected to be 96, the number of hidden layers is 2, the number of nodes is 96, and the learning rate is 0.001. The model has the best prediction effect on the test set.

[0028] Another object of the present invention is to provide a load forecasting system based on shape loss function. The system of the present invention utilizes the shape loss function method to improve the prediction accuracy of multi-step prediction, and better predicts the volatility of the load by adding a KAN module on the basis of the LSTM model. By introducing the shape loss function, the shape characteristics of the load data are captured to make the prediction results more accurate.

[0029] As a preferred solution of the load prediction system based on shape loss function described in the present invention, it is characterized by comprising: The data collection module is used to obtain weather data, historical load data and date type data.

[0030] The data preprocessing module is used to map the date type, weather data and historical load data string information to numerical values, clean the collected data, remove noise and outliers, and normalize the data.

[0031] The power load forecasting model training module is used to import various data sources into power load data and perform data cleaning, normalization, feature selection and engineering processing, define and construct the loss function of power load forecasting, use KAN to further learn the time series data after LSTM processing and output the predicted value, optimize the model performance through parameter adjustment and visualization technology, and provide a visual display of the prediction results and model performance.

[0032] The power load forecasting model prediction module is used to use the trained model to predict the load of actual data. The system evaluates and analyzes the prediction results and provides accurate load forecast results. To support decision-making, the prediction results and performance indicators are presented in intuitive numerical and graphical forms.

[0033] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and is characterized in that when the processor executes the computer program, the steps of the method described in the shape loss function-based load prediction are implemented.

[0034] A computer-readable storage medium having a computer program stored thereon, characterized in that when the computer program is executed by a processor, the steps of the method described in the shape loss function-based load prediction are implemented.

[0035] The beneficial effects of the present invention are as follows: the shape loss function of the present invention can better capture the shape characteristics of the load data, and the KAN network uses the B-spline interpolation function to replace the combination of the linear transformation and activation function of the MLP to fit the nonlinearity, which can better step the rapid fluctuation characteristics of the load, so that the prediction result is more accurate in the change trend; the shape loss function can effectively constrain the output of the model during the model training process, so that it is more consistent with the change trend of the actual load; in this way, even when the root mean square error is the same, the prediction result of the method can better reflect the change trend of the actual value, and provide more valuable reference information for decision makers; through the constraint of shape characteristics, the sensitivity of the model to outliers is reduced, the prediction results are more stable and reliable, and the cumulative error in long-term prediction is smaller. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work, among which:

[0037] Figure 1 An overall flow chart of a load prediction method based on shape loss function provided for one embodiment of the present invention.

[0038] Figure 2 A model structure diagram of a load prediction method based on a shape loss function provided in one embodiment of the present invention.

[0039] Figure 3 A system solution flow chart of a shape loss function-based load forecasting system provided for one embodiment of the present invention. DETAILED DESCRIPTION

[0040] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.

[0041] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.

[0042] Example 1, reference Figure 1-Figure 2 , which is the first embodiment of the present invention, provides a load prediction method based on shape loss function, comprising: S1: Collect the load characteristic data set in the prediction area, map, clean and normalize the collected data, calculate the correlation coefficient of the indicator for the power load through the Pearson correlation formula and analyze it, and divide the preprocessed data set into training set, validation set and test set.

[0043] It should be noted that the load characteristic data set in the forecast area includes date type, holiday name, historical load data, historical weather data, and forecast weather data.

[0044] Among them, the date type and holiday name need to be predicted in advance, and data from the past year to the next fifteen days are taken. The historical load and weather data take data from the past year, and the predicted weather data takes data from the next fifteen days; the weather data includes temperature, precipitation, wind speed, and light intensity.

[0045] The mapping includes mapping the two character information of date type and holiday name into numerical information and inputting them into the network for data training; the cleaning includes filling the missing data by forward and backward filling and linear filling to ensure the integrity and continuity of the data. Outlier detection is performed through machine learning methods, and abnormal data is processed by deleting and replacing outliers to improve data quality.

[0046] The normalization includes scaling the feature data to a range of 0 to 1 using a normalization formula, eliminating the impact of differences in the order of magnitude and dimensions of different features on model training, thereby improving the model prediction accuracy.

[0047] The normalization formula is: , in, is the original data, is the normalized data, is the minimum value of the original data set, is the maximum value of the original data set.

[0048] The preprocessed data set is divided into training set, validation set and test set in the ratio of 8:1:1. The training set and validation set data are input into the model training, and the test set data is separated to prevent data leakage. The test set data is used to verify the prediction indicators of the model.

[0049] Furthermore, the calculation of the correlation coefficient of the indicator for the power load includes analyzing the correlation coefficient of the indicator for the power load using the Pearson correlation analysis method, and the analysis shows that the future load data has the greatest correlation with the historical load data and the least correlation with precipitation, and the precipitation is removed from the feature input.

[0050] The Pearson correlation formula is: , in, represents the Pearson correlation coefficient, and are the mth data points of variables X and Y respectively, and are the means of variables X and Y respectively, and Σ represents the sum of all data points.

[0051] S2: Construct a loss function based on the DTW algorithm, build an LSTM plus KAN power load forecasting algorithm model based on the shape loss function, and use the loss function to train the power load forecasting algorithm model.

[0052] Further, such as Figure 2The construction of the LSTM plus KAN power load forecasting algorithm model based on the shape loss function includes: s201: setting the daily 96-point load data as a set of input data, generating an input sequence for model training with 80% of the data for one year, defining the model structure and setting the model parameters, s202: setting the parameters of each layer of the LSTM model according to the dimensions of the input data and the output prediction data to match the dimensions of each data, building an LSTM model for load forecasting based on the Pytorch neural network module, setting the number of LSTM hidden layers to 2, and the number of hidden nodes to 48.

[0053] The model structure definition includes a single-layer LSTM and a single-layer KAN layer; s203: the setting of model parameters includes the number of LSTM units, sequence time compensation, input feature dimension, activation function, and selecting the best loss function to minimize the loss.

[0054] The model training includes forward propagation, outputting the predicted load value, and using the loss function to calculate the error between the predicted value and the true value, calculating the gradient through the back propagation algorithm, and using the Adam optimizer to update the model parameters according to the calculated gradient; s204: the forward propagation includes passing the input data to the model, and the model enters the KAN layer after being processed by the LSTM layer with parameter settings; setting the 96-point load data of the next day as the label data, corresponding to the 96-point data of the current day, as the predicted target value for the calculation optimization of the loss function.

[0055] Furthermore, the construction of the LSTM plus KAN power load prediction algorithm model based on the shape loss function also includes defining the number of input features and output features of the KAN module, the grid size is 5, the order of the piecewise polynomial is 3, the scaling factor of the noise adjustment is 0.1, the scaling factor of the basic weight is 1, the scaling factor of the piecewise polynomial weight is 1, the basic activation function is a Sigmoid linear unit, the grid adjustment parameter is 0.02, the grid range is [-1,1], each weight parameter is uniformly initialized using Kaiming, the B-spline basis function and the interpolation of the multi-segment polynomial are calculated according to the input data, the nonlinear transformation of the data is performed, the nonlinear expression ability of the model is enhanced by calculating the coefficients of the interpolation curve, and different activation functions are used in different data regions to map nonlinear relationships, and the activation term and entropy term containing L1 regularization are calculated to eliminate overfitting.

[0056] The B-spline basis function interpolation coefficient calculation formula is: , , in, is the node vector, k is the order of the spline, which is 3, C is the interpolation coefficient matrix, a is the input value, B is the matrix composed of B-spline basis functions, and Y is the vector of target values, that is, the true value of the model predicted data.

[0057] Computing the activation term involves summing the absolute values ​​of the model parameters, expressed as: , in, is the loss function of the activation term, is the jth weight parameter for the ith input sample in the polynomial interpolation parameter, n is the number of samples, and m is the number of weights.

[0058] The formula for calculating the entropy term is: , , in, represents the loss function of the entropy term, represents the normalized weight of the i-th sample, is the jth weight parameter for the ith input sample in the polynomial interpolation parameter, n is the number of samples, and m is the number of weights.

[0059] It should be noted that the forward propagation calculates the sum of the basic linear layer output and the piecewise polynomial linear layer output as the final output of the model, and dynamically updates the grid according to the distribution of the data so that the model can better adapt to the distribution characteristics of the input data and improve the model's expressiveness and generalization capabilities.

[0060] The training electric load prediction algorithm model includes: adding a shape loss function based on the DTW method on the basis of L1 regularization, iteratively updating parameters during the training process, obtaining the optimal model parameters by minimizing the loss function, encapsulating the KAN neural network model, establishing a multi-layer KAN system model according to the basic model for load prediction, and adding a KAN module after the LSTM module to process the output data of the LSTM to output the final model prediction value.

[0061] The shape loss function formula includes: = + + + , in, is the model’s predicted value for the lth sample, is the true value of the model for the lth sample, L is the value of the newly constructed loss function, is the conventional loss function formula, represents the loss function of the entropy term, is the loss function of the activation term.

[0062] The conventional loss function formula is expressed as: , in, is the model’s predicted value for the lth sample, is the true value of the model for the lth sample, r is the total number of samples in the data set, is the conventional loss function.

[0063] , in, is the model’s predicted value for the lth sample, is the true value of the model for the lth sample, To adjust the parameters and control the degree of smoothness in the loss function, represents the difference matrix between the predicted value and the true value, A represents the alignment path, Represents the set of all alignment paths, represents the total distance along the alignment path A, Represents the value of the shape loss function.

[0064] S3: Use the trained optimal model to predict power load data, and use the test set data to evaluate the power load prediction model to evaluate the accuracy of the prediction. Use the validation set data to evaluate the fitting effect of the model, and use hyperparameter optimization to adjust the model.

[0065] Furthermore, the predicted power load data includes using the trained optimal model to predict the power load data for the next day and the next week, using different indicators and using the data in the test set to evaluate the power load prediction model to evaluate the accuracy of the prediction.

[0066] The calculation formula of the indicator is: , , , Among them, MAE represents the mean absolute error, RMSE represents the root mean square error, MAPE represents the mean absolute percentage error, s represents the number of samples of the predicted value and the true value, is the model’s predicted value for the lth sample, is the true value of the model for the lth sample; among them, MAPE less than 5% is considered accurate in prediction. On the premise that MAPE meets the requirements, the smaller the MAE and RMSE, the more accurate the model prediction.

[0067] Furthermore, the fitting effect of the model was evaluated based on the validation data set, and the number of iterations was selected as 500 rounds. During the experimental training process, the loss function gradually tended to 0, and no underfitting or overfitting occurred.

[0068] It should be noted that the model adjustment based on hyperparameter optimization includes the optimization of the window length, number of hidden layers, number of hidden layer nodes, and learning rate of the input training data. The window length is selected as 96, the number of hidden layers is 2, the number of nodes is 96, and the learning rate is 0.001. At this time, the model has the best prediction effect on the test set.

[0069] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.

[0070] Example 2, reference Figure 3 , which is a second embodiment of the present invention, and provides a load prediction system based on shape loss function, comprising: The data collection module 100 is used to obtain weather data, historical load data and date type data.

[0071] The data preprocessing module 200 is used to perform numerical mapping on the date type, weather data and historical load data string information, clean the collected data, remove noise and abnormal values, and normalize the data.

[0072] The power load forecasting model training module 300 is used to import various data sources into power load data and perform data cleaning, normalization, feature selection and engineering processing, define and construct the loss function of power load forecasting, use KAN to further learn the time series data after LSTM processing and output the predicted value, optimize the model performance through parameter adjustment and visualization technology, and provide a visual display of the prediction results and model performance.

[0073] The power load forecasting model prediction module 400 is used to use the trained model to perform load forecasting on actual data. The system evaluates and analyzes the forecasting results and provides accurate load forecasting results. To support decision making, the forecasting results and performance indicators are presented in intuitive numerical and graphical forms.

[0074] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.

[0075] Embodiment 3, the third embodiment of the present invention, is different from the first two embodiments in that: If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.

[0076] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.

[0077] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.

[0078] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

Claims

1. A load prediction method based on shape loss function, characterized by: include, Collect the load characteristic data set in the prediction area, map, clean and normalize the collected data, calculate the correlation coefficient of the indicator to the power load through the Pearson correlation formula and analyze it, and divide the preprocessed data set into training set, validation set and test set; Construct a loss function based on the DTW algorithm, build an LSTM plus KAN power load forecasting algorithm model based on the shape loss function, and use the loss function to train the power load forecasting algorithm model; The optimal model after training is used to predict power load data, and the power load prediction model is evaluated using the test set data to evaluate the accuracy of the prediction. The fitting effect of the model is evaluated using the validation set data, and the model is adjusted using hyperparameter optimization.

2. The load prediction method based on shape loss function according to claim 1, characterized in that: The load characteristic data set in the forecast area includes date type, holiday name, historical load data, historical weather data, and forecast weather data; The mapping includes mapping two types of character information, date type and holiday name, into numerical information and inputting them into the network for data training; the cleaning includes filling in the missing data by forward and backward filling and linear filling; outlier detection is performed by machine learning methods, and abnormal data is processed by deleting and replacing outliers; The normalization includes scaling the feature data to a range of 0 to 1 using a normalization formula to eliminate the impact of differences in magnitude and dimension of different features on model training; The normalization formula is: , in, is the original data, is the normalized data, is the minimum value of the original data set, is the maximum value of the original data set.

3. The load prediction method based on shape loss function according to claim 2, characterized in that: The calculation of the correlation coefficient of the indicator to the power load includes analyzing the correlation coefficient of the indicator to the power load using a Pearson correlation analysis method, analyzing that the future load data has the greatest correlation with the historical load data and the least correlation with the precipitation, and removing the precipitation from the feature input; The Pearson correlation formula is: , in, represents the Pearson correlation coefficient, and are the mth data points of variables X and Y respectively, and are the means of variables X and Y respectively, and Σ represents the sum of all data points.

4. The load prediction method based on shape loss function according to claim 3, characterized in that: The construction of the LSTM plus KAN power load forecasting algorithm model based on the shape loss function includes setting the daily 96-point load data as a set of input data, generating an input sequence for model training with 80% of the data for one year, defining the model structure and setting the model parameters, setting the parameters of each layer of the LSTM model according to the dimensions of the input data and the output prediction data to match the dimensions of each data, constructing the LSTM model for load forecasting based on the Pytorch neural network module, setting the number of LSTM hidden layers to 2, and setting the number of hidden nodes to 48; The model structure definition includes a single LSTM layer and a single KAN layer; the setting of model parameters includes the number of LSTM units, sequence time compensation, input feature dimension, activation function, and selecting the best loss function to minimize the loss; The model training includes forward propagation, outputting the predicted load value, and using the loss function to calculate the error between the predicted value and the true value, calculating the gradient through the back-propagation algorithm, and using the Adam optimizer to update the model parameters according to the calculated gradient; the forward propagation includes passing the input data to the model, and the model enters the KAN layer after being processed by the LSTM layer with parameter settings.

5. The load prediction method based on shape loss function according to claim 4, characterized in that: The construction of the LSTM plus KAN power load forecasting algorithm model based on the shape loss function also includes defining the number of input features and the number of output features of the KAN module, the grid size is 5, the order of the piecewise polynomial is 3, the scaling factor of the noise adjustment is 0.1, the scaling factor of the basic weight is 1, the scaling factor of the piecewise polynomial weight is 1, the basic activation function is a Sigmoid linear unit, the grid adjustment parameter is 0.02, the grid range is [-1, 1], each weight parameter is uniformly initialized using Kaiming, the B-spline basis function and the interpolation of the multi-segment polynomial are calculated according to the input data, the nonlinear transformation of the data is performed, and different activation functions are used in different data regions to map the nonlinear relationship, and the activation term and entropy term containing L1 regularization are calculated to eliminate overfitting; The B-spline basis function interpolation coefficient calculation formula is: , , in, is the node vector, k is the order of the spline, which is 3, C is the interpolation coefficient matrix, a is the input value, B is the matrix composed of B-spline basis functions, and Y is the vector of target values; Computing the activation term involves summing the absolute values ​​of the model parameters, expressed as: , in, is the loss function of the activation term, is the jth weight parameter of the i-th input sample in the polynomial interpolation parameter, n is the number of samples, and m is the number of weights; The formula for calculating the entropy term is: , , in, represents the loss function of the entropy term, represents the normalized weight of the i-th sample, is the jth weight parameter for the ith input sample in the polynomial interpolation parameter, n is the number of samples, and m is the number of weights.

6. The load prediction method based on shape loss function according to claim 5, characterized in that: The training of the electric load prediction algorithm model includes adding a shape loss function based on the DTW method on the basis of L1 regularization, iteratively updating parameters during the training process, obtaining optimal model parameters by minimizing the loss function, encapsulating the KAN neural network model, and establishing a multi-layer KAN system model according to the basic model for load prediction, and adding a KAN module after the LSTM module to process the output data of the LSTM to output the final model prediction value; The shape loss function formula includes: = + + + , in, is the model’s predicted value for the lth sample, is the true value of the model for the lth sample, L is the value of the newly constructed loss function, is the conventional loss function formula, represents the loss function of the entropy term, is the loss function of the activation term; The conventional loss function formula is expressed as: , in, is the model’s predicted value for the lth sample, is the true value of the model for the lth sample, r is the total number of samples in the data set, is the conventional loss function; , in, is the model’s predicted value for the lth sample, is the true value of the model for the lth sample, To adjust the parameters, represents the difference matrix between the predicted value and the true value, A represents the alignment path, Represents the set of all alignment paths, represents the total distance along the alignment path A, Represents the value of the shape loss function.

7. The load prediction method based on shape loss function according to claim 6, characterized in that: The power load data prediction includes using the trained optimal model to predict the power load data for the next day and the next week, using different indicators and using the data in the test set to evaluate the power load prediction model to evaluate the accuracy of the prediction; The calculation formula of the indicator is: , , , Among them, MAE represents the mean absolute error, RMSE represents the root mean square error, MAPE represents the mean absolute percentage error, and s represents the number of samples of the predicted value and the true value. is the model’s predicted value for the lth sample, is the true value of the model for the lth sample; MAPE less than 5% indicates accurate prediction; The use of hyperparameter optimization to adjust the model includes optimizing the window length, number of hidden layers, number of hidden layer nodes, and learning rate of the input training data. The window length is selected to be 96, the number of hidden layers is 2, the number of nodes is 96, and the learning rate is 0.

001. The model has the best prediction effect on the test set.

8. A system for load prediction based on shape loss function, characterized in that: include, Data collection module, used to obtain weather data, historical load data and date type data; The data preprocessing module is used to map the date type, weather data and historical load data string information to numerical values, clean the collected data, remove noise and outliers, and normalize the data; The power load forecasting model training module is used to import various data sources into power load data and perform data cleaning, normalization, feature selection and engineering processing, define and build the loss function of power load forecasting, use KAN to further learn the time series data after LSTM processing and output the forecast value, optimize the model performance through parameter adjustment and visualization technology, and provide a visual display of the forecast results and model performance; The power load forecasting model prediction module is used to use the trained model to predict the load of actual data. The system evaluates and analyzes the prediction results and provides accurate load forecast results. To support decision-making, the prediction results and performance indicators are presented in intuitive numerical and graphical forms.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the load prediction method based on shape loss function are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the load prediction method based on shape loss function are implemented.

Citation Information

Patent Citations

  • OID handwriting recognition method

    CN117671702A

  • Method for predicting boiler full-load NOx emission through channel selection convolutional neural network

    CN117808167A

  • Wireless network load prediction method, device, equipment, medium and program product

    CN119402115A

Cited By

  • Explanatable net load power probability prediction method and system

    CN119917824A

  • Coal mining deformation real-time monitoring system and use method

    CN120445074A

  • Urban greening irrigation control system based on large model and agent decision

    CN121488810A

  • Vehicle door surface rigidity prediction method and device, electronic equipment and storage medium

    CN121682655A

  • Information processing method for integrated energy system, computer equipment and medium

    CN122286189A