TST and LightGBM fusion model-based electricity price prediction method and related equipment
Through the integration of TST and LightGBM models, the weights are dynamically adjusted to integrate time series and multivariate characteristics, and the problem of long-term dependence and multivariate correlation between electricity price prediction is solved, achieving higher accuracy and robust electricity price prediction.
Patent Information
- Application Number
- CN202510377878.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-28
- Publication Date
- 2025-07-01
AI Technical Summary
Existing electricity price prediction methods are difficult to effectively integrate the long-term dependence of time series with multivariate characteristics, especially the nonlinear correlation between meteorological and economic indicators, and the existing models are not robust in processing anomalies, resulting in limited prediction accuracy and generalization capabilities.
Time Series Transformer (TST) model is used to extract time series eigenvectors, multivariate eigenvectors are extracted in combination with LightGBM model, and predictive models are formed through dynamic weighting fusion, dynamically adjusting weights to adapt to different situations, and optimizing the generalization ability and robustness of the model.
It significantly improves the accuracy and scenario adaptability of electricity price prediction, can accurately capture the global dependence of electricity price sequence and the complex interactions of external variables, and adapt to demand fluctuations and external changes in the power market.
Smart Images

Figure CN120235645A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of power systems and relates to a method for predicting electricity prices based on a fusion model of TST and LightGBM and related devices. Background Art
[0002] With the continuous advancement of electricity market liberalization, electricity price prediction has gradually become a core technology in power system operation, energy trading, and risk management. Accurate electricity price prediction not only helps power generation enterprises optimize their power generation plans, but also enables users to formulate scientific electricity consumption strategies and provides strong bidding decision-making basis for market participants. However, the fluctuations of electricity market prices are affected by various complex factors, including supply and demand relationships, the volatility of renewable energy, meteorological conditions (such as temperature and wind speed), economic indicators (such as industrial electricity consumption), and policy factors, etc.
[0003] Traditional electricity price prediction methods mainly rely on statistical models and classical machine learning algorithms. For example, the autoregressive integrated moving average model (ARIMA) is often used to capture the short-term time series characteristics of electricity prices, but these models are difficult to effectively handle non-linear relationships and the coupled effects between multiple variables. Machine learning methods such as support vector machines (SVM) and random forests (Random Forest) improve the prediction performance by introducing external variables such as meteorology. However, these methods have certain limitations when dealing with long-term time dependencies. In recent years, deep learning technologies such as long short-term memory networks (LSTM) and gated recurrent units (GRU), with their special memory unit designs, can better model the dependencies of time series data. However, when facing sudden changes in electricity price sequences (such as fluctuations caused by extreme weather), they often have problems of lagging predictions. At the same time, the Transformer model shows powerful capabilities in capturing long-term dependencies through its self-attention mechanism, but the computational complexity of this model is relatively high, and it lacks flexibility in dealing with multi-variable feature fusion.
[0004] The main challenges of the existing technologies lie in how to more effectively utilize features, especially how to integrate the long-term dependencies of time series with the non-linear associations between multi-variable features (such as meteorology and economic indicators), and avoid information fragmentation. There are often some abnormal fluctuations in electricity price data, such as sharp changes caused by market emergencies. However, some existing methods usually only deal with these abnormal data by simple elimination or mean filling, which not only destroys the continuity of time series data but also affects the robustness of the model.
[0005] In addition, existing prediction methods often rely on a single model (such as a time series model or a tree model). This limitation makes it difficult for them to take into account both the global dependencies of time series data and the interactions of complex features, thus affecting the prediction accuracy. Moreover, most existing fusion methods use fixed weights to combine the outputs of different models and cannot be adaptively adjusted according to changes in data distribution, which to a certain extent limits the generalization ability of the model. Summary of the Invention
[0006] To solve the problems in the prior art, the present invention provides a method for predicting electricity prices based on a fusion model of TST and LightGBM and related devices to achieve accurate prediction of electricity prices.
[0007] To achieve the above object, the present invention adopts the following technical solutions: In a first aspect, the present invention provides a method for predicting electricity prices based on a fusion model of TST and LightGBM, including the following steps: Clean and construct features for the historical data of the electricity market to form a data set containing time series features and multivariate features; Based on the TST model, extract features from the data with time series features in the data set to obtain a time series feature vector representing long-term dependencies; Input the data with multivariate features in the data set into the LightGBM model to obtain a multivariate feature vector; Dynamically weight and fuse the time series feature vector and the multivariate feature vector to obtain a prediction model; collect real-time data of the electricity market and input it into the prediction model to obtain the final electricity price prediction value.
[0008] Preferably, the historical data of the electricity market includes historical electricity prices, time and cycle features, and external influencing factors; among them, the external influencing factors include meteorological data and economic indicators, the meteorological data includes at least temperature, humidity and wind speed, and the economic indicators include at least the electricity supply and demand index and industrial electricity consumption.
[0009] Preferably, the specific method for cleaning the historical data of the electricity market is: using the isolation forest algorithm to detect abnormal fluctuation values in the historical electricity prices and replacing them with interpolation of the mean value of adjacent periods; performing target encoding on the time and cycle features and external influencing factors to generate an embedding representation associated with the electricity price prediction target.
[0010] Preferably, the method for dynamic weighted fusion is: selecting some data in the historical data of the electricity market as a validation set, calculating the prediction error of the prediction model based on the validation set; adjusting the weight coefficients of the time series feature vector and the multivariate feature vector according to the prediction error.
[0011] Preferably, it further includes: comparing the predicted final electricity price value with the future actual electricity price value, and iteratively optimizing the weight coefficient by using the gradient descent method based on the comparison result.
[0012] Preferably, the specific method for extracting features from the data with time series features in the dataset based on the TST model to obtain a time series feature vector representing long-term dependence is as follows: adding positional encoding to the input data with time series features based on the TST model to retain the time series position information; calculating the global dependence between different time steps through the multi-head self-attention mechanism; outputting a time series feature vector containing long-term dependence.
[0013] Preferably, before the data with multi-variable features is input into the LightGBM model, feature selection is performed on the data with multi-variable features, and features with importance lower than the preset threshold are removed according to the feature importance ranking.
[0014] In a second aspect, the present invention provides an electricity price prediction system based on a TST and LightGBM fusion model, including: A data preprocessing module: used for cleaning and feature construction of the historical electricity market data to form a dataset containing time series features and multi-variable features; A time series feature extraction module: used for extracting features from the data with time series features in the dataset based on the TST model to obtain a time series feature vector representing long-term dependence; A multi-variable feature extraction module: used for inputting the data with multi-variable features in the dataset into the LightGBM model to obtain a multi-variable feature vector; A fusion prediction module: used for dynamically weighted fusion of the time series feature vector and the multi-variable feature vector to obtain a prediction model; collecting real-time electricity market data and inputting it into the prediction model to obtain the predicted final electricity price value.
[0015] In a third aspect, the present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that when the processor executes the computer program, the steps of the above method are implemented.
[0016] In a fourth aspect, the present invention provides a computer-readable storage medium, the computer-readable storage medium stores a computer program, characterized in that when the computer program is executed by a processor, the steps of the above method are implemented.
[0017] Compared with the prior art, the present invention has the following beneficial effects: Precisely capture the global dependencies across time periods in the electricity price series through the TST model; precisely capture the complex interactions between external variables and electricity prices through the LightGBM model; through the synergistic effect of the TST model and the LightGBM model, achieve the precise coupling of long-term time series dependencies and multi-variable external influences in electricity price forecasting, significantly improving the forecasting accuracy and scenario adaptability; secondly, make more accurate adjustments to electricity price forecasting in different scenarios through dynamic weighting, further optimizing the generalization ability and robustness of the forecasting model to adapt to the demand fluctuations and external changes in different electricity markets. Description of the Drawings
[0018] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.
[0019] Figure 1 It is a flowchart of the method of the present invention. Detailed Embodiments
[0020] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. Usually, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0021] Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed present invention, but merely represents the selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present invention.
[0022] It should be noted that similar reference numerals and letters indicate similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings.
[0023] In the description of the embodiments of the present invention, it should be noted that if terms such as "upper", "lower", "horizontal", "inner", etc. are used to indicate the orientation or positional relationship, it is based on the orientation or positional relationship shown in the drawings, or the orientation or positional relationship in which the invention product is usually placed during use. This is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation. Therefore, it should not be construed as a limitation to the present invention. In addition, terms such as "first", "second", etc. are only used for distinguishing descriptions and cannot be construed as indicating or implying relative importance.
[0024] In addition, if the term "horizontal" appears, it does not mean that the component is required to be absolutely horizontal, but it can be slightly inclined. For example, "horizontal" only means that its direction is more horizontal relative to "vertical", and does not mean that the structure must be completely horizontal, but it can be slightly inclined.
[0025] In the description of the embodiments of the present invention, it should also be noted that unless otherwise clearly specified and limited, if terms such as "set", "installed", "connected", "connected" are used, they should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected, or indirectly connected through an intermediate medium, and it can be the communication inside two components. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific situations.
[0026] The following further describes the present invention in detail with reference to the drawings: The present invention provides a method for predicting electricity prices based on a fusion model of TST and LightGBM, as Figure 1 shown, including the following steps: Clean and construct features for the historical data of the electricity market to form a dataset containing time series features and multi-variable features; Based on the Time Series Transformer (TST) model, extract features from the data with time series features in the dataset to obtain a time series feature vector representing long-term dependence relationships; Input the data with multi-variable features in the dataset into the Light Gradient Boosting Machine (LightGBM) model to obtain a multi-variable feature vector; Dynamically weight and fuse the time series feature vector and the multi-variable feature vector to obtain a prediction model; collect real-time data of the electricity market and input it into the prediction model to obtain the final electricity price prediction value.
[0027] The present invention combines the advantages of the TST model and the LightGBM model. The TST model can capture the long-term dependencies in the historical data of the electricity market, extract valuable time-series features, and make the prediction of future electricity price changes more accurate. The LightGBM model, on the other hand, can handle multi-variable data containing various influencing factors (such as temperature, demand, etc.), further improving the comprehensiveness and accuracy of the prediction. Since the electricity price is affected by multiple factors, having both the periodic and trend characteristics of the time series and the influence of external variables such as weather and policies. By combining the time-series feature vectors extracted by the TST model with the multi-variable feature vectors extracted by the LightGBM model, the present invention can comprehensively consider these factors in different dimensions, thereby effectively improving the prediction performance. At the same time, the present invention can dynamically adjust the weights according to the influence degree of different data features, make more accurate adjustments to the electricity price prediction in different scenarios, further optimize the generalization ability and robustness of the model, and adapt to the demand fluctuations and external changes of different electricity markets.
[0028] The historical data of the electricity market includes historical electricity prices, time and cycle features, and external influencing factors; among them, the external influencing factors include meteorological data and economic indicators, the meteorological data at least includes temperature, humidity, and wind speed, and the economic indicators at least include the electricity supply and demand index and industrial electricity consumption. The present invention constructs a multi-dimensional feature system through historical electricity prices, time-series features (such as periodic fluctuations), meteorological data (temperature, humidity, wind speed), and economic indicators (supply and demand index, industrial electricity consumption). Comprehensively considering the influence of multi-dimensional factors on future electricity prices, for example: temperature changes directly affect electricity demand, and industrial electricity consumption reflects the intensity of macroeconomic activities. The fusion of multi-dimensional data can accurately capture the driving mechanism of electricity price formation and improve the completeness of feature engineering.
[0029] The specific method for cleaning the historical data of the electricity market is as follows: The isolation forest algorithm is used to detect the abnormal fluctuation values in the historical electricity prices, and the interpolation replacement is performed with the average value of adjacent time periods, which can effectively eliminate the noise interference caused by market manipulation or system failures (such as abnormal points with a 100% sudden increase in electricity prices); target encoding is performed on the time and cycle features and external influencing factors to generate an embedding representation associated with the electricity price prediction target, enhancing the non-linear modeling ability for categorical features.
[0030] The method of dynamic weighted fusion is as follows: Select part of the data in the historical data of the power market as the validation set, and calculate the prediction error of the prediction model based on the validation set; adjust the weight coefficients of the time series feature vector and the multi-variable feature vector according to the prediction error. Secondly, the present invention compares the final electricity price prediction value with the future actual electricity price value, and iteratively optimizes the weight coefficients by using the gradient descent method based on the comparison result. By dynamically adjusting the vector weights through the validation set, the contribution degrees of the TST model and the LightGBM model are adaptively adjusted. For example, during the stable electricity price period (such as the late-night low-load period), the time series feature vector obtains a higher weight due to the long-term dependence advantage; while in extreme weather events, the multi-variable feature vector has its weight increased due to the external variable response ability, further improving the accuracy of electricity price prediction. In addition, by iteratively optimizing the fusion weights in real time through the gradient descent method and dynamically calibrating the model in combination with the future actual electricity price feedback, the sensitivity and adaptability to environmental changes are always maintained. For example, when a new energy subsidy policy is introduced into the power market, the model can complete the weight adjustment within 3-5 training cycles to ensure the continuous effectiveness of the model in a dynamic market environment.
[0031] The specific method for extracting features of the data with time series features in the dataset based on the TST model to obtain a time series feature vector representing long-term dependence is as follows: Add positional encoding to the input data with time series features based on the TST model to retain the time series position information; calculate the global dependence between different time steps through the multi-head self-attention mechanism; output a time series feature vector containing long-term dependence. The output of the TST model is processed by a multi-layer perceptron, which can realize the prediction of the electricity price for the next 24 hours, and at the same time supports multi-step prediction, providing an in-depth analysis of the electricity price fluctuations at multiple future time points.
[0032] Before the data with multi-variable features is input into the LightGBM model, feature selection is performed on the data with multi-variable features, and features with importance lower than the preset threshold are removed according to the feature importance ranking. By removing unimportant features, the feature dimension can be reduced, the model complexity can be lowered, and the risk of overfitting can be reduced, thereby improving the generalization ability of the model. Secondly, removing redundant features can make the model focus more on the features that actually contribute to the prediction and optimize the prediction accuracy.
[0033] In one embodiment of the present invention, a power price prediction system based on a TST and LightGBM fusion model is provided, including: A data preprocessing module: used for cleaning and feature construction of the historical data of the power market to form a dataset containing time series features and multi-variable features; A time series feature extraction module: used for extracting features of the data with time series features in the dataset based on the TST model to obtain a time series feature vector representing long-term dependence; Multivariate Feature Extraction Module: It is used to input the data with multivariate features in the dataset into the LightGBM model to obtain multivariate feature vectors; Fusion Prediction Module: It is used to dynamically weight and fuse the time series feature vectors and multivariate feature vectors to obtain a prediction model; collect real-time power market data and input it into the prediction model to obtain the final electricity price prediction value.
[0034] The TST model can break through the local perception limitation of traditional time series models (such as LSTM) and accurately capture the global dependencies across time periods in the electricity price sequence (such as the daily cycle correlation separated by 24 hours, the intermittent fluctuations between weeks); the LightGBM model can accurately capture the complex interaction between external variables and electricity prices through feature crossing and decision tree splitting. Through the collaborative architecture that fuses the TST model and the LightGBM model, the present invention realizes the accurate coupling of long-term time series dependencies and multivariate external influences in electricity price prediction, significantly improving the prediction accuracy and scenario adaptability.
[0035] In one embodiment of the present invention, a computer device is provided. The computer device includes a processor and a memory. The memory is used to store a computer program. The computer program includes program instructions. The processor is used to execute the program instructions stored in the computer storage medium. The processor may be a Central Processing Unit (CPU), or may also be 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. It is the computing core and control core of the terminal, and is suitable for implementing one or more instructions. Specifically, it is suitable for loading and executing one or more instructions in the computer storage medium to implement the corresponding method flow or corresponding function; the processor described in the embodiment of the present invention can be used for the operation of the electricity price prediction method based on the TST and LightGBM fusion model.
[0036] The present invention also provides a storage medium, specifically a computer-readable storage medium (Memory). The computer-readable storage medium is a memory device in a computer device, used to store programs and data. It can be understood that the computer-readable storage medium here can include both the built-in storage medium in the computer device and, of course, the extended storage medium supported by the computer device. The computer-readable storage medium provides a storage space, and the operating system of the terminal is stored in this storage space. Moreover, one or more instructions suitable for being loaded and executed by the processor are stored in this storage space. These instructions can be one or more computer programs (including program codes). It should be noted that the computer-readable storage medium here can be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory. One or more instructions stored in the computer-readable storage medium can be loaded and executed by the processor to implement the corresponding steps of the electricity price prediction method based on the TST and LightGBM fusion model in the above embodiments.
[0037] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer-usable program codes.
[0038] The present invention is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each flow and / or block in the flowchart and / or block diagram, as well as the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0039] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device, and the instruction device implements the functions in Figure 1 one flow or multiple flows and / or blocksFigure 1 The functions specified in one or more boxes.
[0040] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process. Thus, the instructions executed on the computer or other programmable device provide for implementing the steps of the functions specified in one or more processes and / or boxes Figure 1 One process or more processes and / or boxes Figure 1 The steps of the functions specified in one or more boxes.
[0041] Finally, 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 them. Although the present invention has been described in detail with reference to the above embodiments, those of ordinary skill in the art should understand that: the specific implementation manners of the present invention can still be modified or equivalently replaced, and any modification or equivalent replacement that does not depart from the spirit and scope of the present invention shall be covered by the protection scope of the claims of the present invention.
Claims
1. A method for predicting electricity prices based on the TST and LightGBM fusion model, characterized in that: The following steps are involved: Clean and construct features of historical power market data to form a data set containing time series features and multivariate features; Based on the TST model, feature extraction is performed on the data with time series features in the dataset to obtain the time series feature vector that represents the long-term dependency relationship; Input the data with multivariate features in the dataset into the LightGBM model to obtain the multivariate feature vector; The time series feature vector and the multivariate feature vector are dynamically weighted and fused to obtain a prediction model; real-time data from the power market is collected and input into the prediction model to obtain the final electricity price prediction value.
2. According to claim 1, a method for predicting electricity prices based on the TST and LightGBM fusion model is characterized in that: The electricity market historical data includes historical electricity prices, time and cycle characteristics and external influencing factors; wherein the external influencing factors include meteorological data and economic indicators, the meteorological data at least includes temperature, humidity and wind speed, and the economic indicators at least include electricity supply and demand index and industrial electricity consumption.
3. According to claim 2, a method for predicting electricity prices based on the TST and LightGBM fusion model is characterized in that: The specific method for cleaning the historical data of the electricity market is as follows: using the isolation forest algorithm to detect abnormal fluctuation values in historical electricity prices, and interpolating and replacing them with the average values of adjacent time periods; target encoding time and cycle characteristics and external influencing factors to generate an embedded representation associated with the electricity price prediction target.
4. According to claim 1, a method for predicting electricity prices based on the TST and LightGBM fusion model is characterized in that: The dynamic weighted fusion method is: select part of the historical data of the power market as a verification set, calculate the prediction error of the prediction model based on the verification set; and adjust the weight coefficients of the time series feature vector and the multivariate feature vector according to the prediction error.
5. According to claim 4, a method for predicting electricity prices based on the TST and LightGBM fusion model is characterized in that: Also includes: The final electricity price forecast value is compared with the actual future electricity value, and the weight coefficient is iteratively optimized using the gradient descent method based on the comparison result.
6. The electricity price prediction method based on the TST and LightGBM fusion model according to claim 1 is characterized in that: The specific method of extracting features from the data with time series features in the data set based on the TST model to obtain a time series feature vector representing long-term dependencies is as follows: adding position encoding to the input data with time series features based on the TST model to retain the time series position information; calculating the global dependencies between different time steps through a multi-head self-attention mechanism; and outputting a time series feature vector containing long-term dependencies.
7. The electricity price prediction method based on the TST and LightGBM fusion model according to claim 1 is characterized in that: Before the data with multivariate features are input into the LightGBM model, feature selection is performed on the data with multivariate features, and features with importance lower than a preset threshold are eliminated according to feature importance sorting.
8. An electricity price prediction system based on TST and LightGBM fusion model, characterized in that: include: Data preprocessing module: used to clean and construct features of historical data of the power market to form a data set containing time series features and multivariate features; Time series feature extraction module: used to extract features of the data with time series features in the data set based on the TST model, and obtain the time series feature vector that represents the long-term dependency relationship; Multivariate feature extraction module: used to input the data with multivariate features in the dataset into the LightGBM model to obtain the multivariate feature vector; Fusion prediction module: used to dynamically weight and fuse the time series feature vector with the multivariate feature vector to obtain a prediction model; collect real-time data from the power market and input it into the prediction model to obtain the final electricity price prediction value.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Meteorological large model and lightweight AI collaborative multi-source forest fire dynamic early warning method
CN120833649A