A method, device and medium for predicting power consumption based on clustering algorithm
By generating and analyzing historical time characteristics indicators, multi -vitamin synthesis and cluster analysis are performed, the problem of neglecting time frequency characteristics in existing technologies has been solved, and the accuracy and availability of electrical energy consumption prediction is improved.
Patent Information
- Application Number
- CN202411311219.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2025-01-21
- Estimated Expiration
- 2044-09-20
AI Technical Summary
The prior art ignores the time frequency characteristics in power consumption prediction, resulting in the model being unable to capture the time dependence and periodicity of power consumption data, affecting the prediction accuracy.
By obtaining historical energy consumption timing data, generate historical time feature indicators and perform time frequency analysis, determine the time frequency feature data. Then, the multi -vitamin convergence was performed, and the time frequency characteristics, reference power consumption evaluation dimension data and historical energy consumption were integrated into multi -dimensional energy consumption index data. Use the preset cluster algorithm to analyze the multi -dimensional energy -consuming index data, determine the token label information, and predict the information based on this information. In the end, the predicted token label information was reversed, and the predictive energy consumption data consumption data consumed by the same data of the time -sequential data of historical energy consumption.
By paying attention to the frequency characteristics of time, the model can more accurately understand the changes in the power consumption model and improve the accuracy of prediction. The Divor Symptoms fusion and clustering analysis provides more comprehensive information, which improves the model's adaptability and recognition ability. Anti -treatment operations ensure the availability and accuracy of the prediction results.
Smart Images

Figure CN118839224B_ABST
Abstract
Description
Technical Field
[0001] The present specification relates to the field of prediction technology, and in particular to a method, device and medium for predicting power consumption based on a clustering algorithm. Background Art
[0002] Time series data is widely used in the field of energy consumption forecasting. Its core task is to predict the trend or behavior of future energy consumption based on past energy consumption data. However, the prediction of energy consumption time series data is full of challenges. First of all, energy consumption time series data usually contains complex time dependencies. The current data point depends not only on its own characteristics, but also on historical data. For example, if the energy consumption at 21:00 in the evening is predicted, the electricity consumption data from 19:00 to 20:00 in the evening is needed. 19:00 to 20:00 in the evening is usually the peak period of electricity consumption. If the data from the peak period of electricity is used for prediction, there is data lag, resulting in a high prediction result. In addition, mutation points or abnormal events may suddenly change the trend and distribution of data (for example, a certain period of time on a certain day will use high power, resulting in a sudden increase in electricity consumption), making prediction more difficult. The time series data of electricity consumption has the characteristics of nonlinear growth trend and periodic fluctuations, which cannot be accurately captured by simple linear models.
[0003] With the development of deep learning and machine learning technologies, the prediction of power consumption data through neural network time series models (such as Transformer, etc.) has stronger expressive power, and can learn nonlinear features and complex patterns in data. However, when processing energy consumption time series data, these models usually directly use the original energy consumption values, fail to fully consider the importance of time frequency information, or train different models separately for data of different time frequencies. This approach may lead to various problems such as unstable prediction results and low accuracy, and increase computing requirements.
[0004] Therefore, the existing prediction process usually only focuses on specific numerical information such as power consumption in time series data, while ignoring the key role of time and frequency characteristics, which may cause the model to be unable to capture the time dependence and periodicity of power consumption data, thereby affecting the prediction accuracy. Summary of the invention
[0005] One or more embodiments of the present specification provide a method, device and medium for predicting power consumption based on a clustering algorithm, which are used to solve the following technical problems: the existing prediction process usually only focuses on specific numerical information such as power consumption in time series data, while ignoring the key role of time and frequency characteristics, which may cause the model to be unable to capture the time dependence and periodicity of power consumption data, thereby affecting the prediction accuracy.
[0006] One or more embodiments of this specification adopt the following technical solutions:
[0007] One or more embodiments of the present specification provide an energy consumption prediction method based on a clustering algorithm, the method comprising: obtaining historical energy consumption time series data and to-be-predicted time length data within a historical collection time interval, wherein the historical energy consumption time series data comprises a plurality of historical energy consumptions and historical energy consumption time data corresponding to each of the historical energy consumptions; generating a historical time characteristic index and reference power consumption evaluation dimension data corresponding to each of the historical energy consumptions based on the historical energy consumption time data, so as to perform time-frequency analysis on the historical time characteristic index and determine the corresponding time-frequency characteristic data, wherein the reference power consumption evaluation dimension data comprises a power consumption peak dimension, a power consumption level period dimension and a power consumption valley dimension; and performing a time-frequency analysis on the historical time characteristic index and reference power consumption evaluation dimension data corresponding to each of the historical energy consumptions. The frequency characteristic data, the reference power consumption evaluation dimension data and the historical energy consumption data are used to perform multi-dimensional feature fusion to determine a plurality of multi-dimensional energy consumption indicator data corresponding to the historical energy consumption time series data; a clustering analysis is performed on the plurality of multi-dimensional energy consumption indicator data through a preset clustering algorithm to determine the token label information corresponding to each of the multi-dimensional energy consumption indicator data, so as to perform prediction based on the plurality of token label information and the time length data to be predicted to determine a plurality of predicted token label information; a reverse processing operation is performed on each of the predicted token label information to generate predicted energy consumption time series data corresponding to each of the predicted token labels, wherein the reverse processing operation is used to determine that the predicted energy consumption time series data and the historical energy consumption time series data are of the same data order.
[0008] One or more embodiments of the present specification provide an energy consumption prediction device based on a clustering algorithm, including:
[0009] at least one processor; and,
[0010] a memory communicatively connected to the at least one processor; wherein,
[0011] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the above method.
[0012] One or more embodiments of the present specification provide a non-volatile computer storage medium storing computer executable instructions, wherein the computer executable instructions are configured to execute the above method.
[0013] At least one of the above technical solutions adopted in the embodiments of this specification can achieve the following beneficial effects: through the above technical solution, by generating historical time feature indicators and performing time frequency analysis, the time dependence and periodicity in the power consumption data can be captured. The focus on time frequency features enables the model to more accurately understand the changing laws of the power consumption pattern, so that it can more accurately reflect the future power consumption trend during prediction; the time frequency features, reference power consumption evaluation dimension data (such as peak power consumption period, flat period, and valley period) and historical power consumption are multi-dimensionally integrated to form rich multi-dimensional energy consumption indicator data. The multi-dimensional data provides more comprehensive information for the model, so that it can better adapt to and identify complex power consumption patterns; the multi-dimensional energy consumption indicator data is clustered and analyzed using a preset clustering algorithm, and similar power consumption patterns can be classified into one category based on the intrinsic characteristics of the data, and corresponding token label information can be assigned. The data-driven clustering method improves the accuracy of classification and provides a more reliable basis for subsequent predictions; the predicted token label information is reversely processed to generate predicted energy consumption time series data, and it is ensured that it maintains the same data level as the historical energy consumption time series data. The usability of the prediction results in practical applications is ensured, and misunderstandings or wrong decisions caused by inconsistent magnitudes are avoided; it is not only applicable to the prediction of historical energy consumption time series data, but also can flexibly adjust the prediction range and accuracy according to the different time lengths of the data to be predicted, and is widely used in power consumption prediction tasks under different scenarios and needs. By determining the time-frequency characteristics, performing multi-dimensional feature fusion, cluster analysis, and achieving the magnitude consistency of the prediction results, the problem of ignoring the time-frequency characteristics in the existing prediction process is effectively solved, and the prediction accuracy is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] In order to more clearly illustrate the technical solutions in the embodiments of this specification or the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art description. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor. In the drawings:
[0015] Figure 1 A schematic diagram of a flow chart of a method for predicting power consumption based on a clustering algorithm provided in an embodiment of this specification;
[0016] Figure 2 An example diagram of the reasoning process of an electric energy consumption prediction device based on a clustering algorithm provided in an embodiment of this specification;
[0017] Figure 3 A schematic diagram of the structure of an electric energy consumption prediction device based on a clustering algorithm provided in an embodiment of this specification. DETAILED DESCRIPTION
[0018] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this specification.
[0019] The embodiment of this specification provides a method for predicting power consumption based on a clustering algorithm. It should be noted that the execution subject in the embodiment of this specification can be a server or any device with data processing capabilities. Figure 1 A schematic diagram of a flow chart of a method for predicting power consumption based on a clustering algorithm provided in an embodiment of this specification, such as Figure 1 As shown, it mainly includes the following steps:
[0020] Step S101, obtaining historical energy consumption time series data and to-be-predicted time length data within a historical collection time interval.
[0021] The historical energy consumption time series data includes multiple historical energy consumption amounts and historical energy consumption time data corresponding to each of the historical energy consumption amounts.
[0022] In one embodiment of the present specification, historical energy consumption time series data corresponding to the historical collection time interval is obtained. The interval length of the historical collection time interval here can be set according to the actual situation. The historical energy consumption time series data here is used to predict the energy consumption in the future time interval. For example, it can be the energy consumption time series data corresponding to two hours before the current moment, or it can be the energy consumption time series data corresponding to eight hours before the current moment. The history here refers to the state that has occurred relative to the current moment. It should be noted that the historical energy consumption time series data here includes multiple historical energy consumption and historical energy consumption time data corresponding to each historical energy consumption. The historical energy consumption refers to the specific value of energy consumption, that is, the actual electric energy consumed under historical circumstances. The historical energy consumption time data includes historical energy consumption time data and historical energy consumption date data. The historical energy consumption time data refers to the time dimension, that is, the specific time, and the historical energy consumption date data includes the date dimension of year, month and day, that is, a certain year, month and day. In addition, when predicting the electric energy consumption, it is also necessary to determine the time length to be predicted. Here, it can be set according to the needs, that is, predict the data in a certain time period in the future to determine the time length data to be predicted.
[0023] Step S102, generating historical time characteristic indicators and reference power consumption evaluation dimension data corresponding to each historical energy consumption according to the historical energy consumption time data, so as to perform time frequency analysis on the historical time characteristic indicators and determine corresponding time frequency characteristic data.
[0024] The reference power consumption evaluation dimension data includes a power consumption peak period dimension, a power consumption level period dimension and a power consumption low period dimension.
[0025] In the traditional time series prediction process, the influence of time frequency characteristics is ignored by directly using the original energy consumption numerical data. In one embodiment of the present specification, based on the historical energy consumption time data, historical time characteristic indicators and reference power consumption evaluation dimension data corresponding to each historical energy consumption are generated to perform time frequency analysis on the historical time characteristic indicators and determine the corresponding time frequency characteristic data.
[0026] According to the historical energy consumption time data, a historical time characteristic index and reference power consumption evaluation dimension data corresponding to each historical energy consumption are generated, specifically including: according to the historical energy consumption time data, matching is performed in a pre-constructed power consumption evaluation dimension mapping table to determine the reference power consumption evaluation dimension data corresponding to each historical energy consumption time data, wherein the power consumption evaluation dimension mapping table includes multiple power consumption evaluation dimensions and time information corresponding to each of the power consumption evaluation dimensions; historical energy consumption moment data and historical energy consumption date data in the historical energy consumption time data are determined; and a preset time index quantization function is used to convert the historical energy consumption moment data and the historical energy consumption date data to generate a historical time characteristic index corresponding to each historical energy consumption time data.
[0027] In one embodiment of the present specification, a power consumption evaluation dimension mapping table is pre-constructed, and the power consumption evaluation dimension mapping table includes three power consumption evaluation dimensions and the time information corresponding to each power consumption evaluation dimension. The three power consumption evaluation dimensions here include the power consumption peak period dimension, the power consumption level period dimension, and the power consumption valley period dimension. The time information corresponding to the three power consumption evaluation dimensions is matched by the power consumption situation in previous years and the power consumption range under the corresponding evaluation dimension. The time information here includes time information in addition to the moment information. According to the historical energy consumption time data, matching is performed in the power consumption evaluation dimension mapping table to determine the reference power consumption evaluation dimension data corresponding to each historical energy consumption time data, that is, the power consumption evaluation dimension under the corresponding historical energy consumption time, and each power consumption evaluation dimension is identified by setting a numerical identifier, for example, setting 0, 0.5, and 1 respectively to indicate that the power consumption evaluation dimension corresponding to the current time belongs to the power consumption peak period dimension, the power consumption level period dimension, and the power consumption valley period dimension.
[0028] Determine the historical energy consumption moment data in the historical energy consumption time data, such as 14:00, and determine the historical energy consumption date data, such as August 21, 2024. In order to add event frequency features in the time series prediction process, it is necessary to process the historical energy consumption time and convert the historical energy consumption time data into time feature indicators. Through the preset time indicator quantization function, the historical energy consumption moment data and the historical energy consumption date data are converted to generate the historical time feature indicators corresponding to each historical energy consumption time data.
[0029] Through a preset time indicator quantification function, the historical energy consumption moment data and the historical energy consumption date data are transformed to generate a historical time characteristic indicator corresponding to each of the historical energy consumption time data, specifically including: splitting the historical energy consumption date data according to preset dimensions to determine the attribution month data corresponding to the month dimension and the attribution date data corresponding to the date dimension; determining the cumulative day indicator corresponding to the current annual cycle through the attribution month data and the attribution date data, and converting the cumulative day indicator into the hour dimension to generate a cumulative hour indicator; superimposing the cumulative hour indicator and the historical energy consumption moment data to determine the historical time characteristic indicator corresponding to the historical energy consumption time data.
[0030] When determining the historical time characteristic index, two implementation methods are provided, one is to consider only the historical energy consumption time data, and the other is to consider the historical energy consumption time data and the historical energy consumption date data. When only the historical energy consumption time data is considered, the time characteristic index is determined according to the specific value of the historical energy consumption time. The value range of the time characteristic index is 0-23. For example, the time characteristic index corresponding to 14 o'clock is 14.
[0031] In one embodiment of the present specification, when considering the historical energy consumption time data and the historical energy consumption date data, the historical energy consumption time data is converted into time characteristic indicators in the following manner. The historical energy consumption date data is split according to the month dimension and the date dimension respectively, and the attribution month data corresponding to the month dimension and the attribution date data corresponding to the date dimension are determined. For example, the attribution month data of the month dimension corresponding to August 21 is 8, and the attribution date data corresponding to the date dimension is 21. After determining the attribution month dimension and the attribution date dimension, the conversion is performed using a preset time indicator quantization function, and the time indicator quantization function is as follows: H, where T is the time characteristic index, M is the attribute month data, is the number of days in each month from January to month i, is the attribute date data, H is the number of hours corresponding to the historical energy consumption time data, that is, the current number of hours (that is, 14 o'clock, converted to hours is 14). For example, when the historical energy consumption time data corresponding to 14 o'clock on August 21 is converted, T=(31+28+31+30+31+30+31+21)×24+14, that is, the time characteristic index is obtained. It should be noted that the number of days in each month is determined according to whether the year is a leap year.
[0032] Through the above technical solution, by refining the historical energy consumption time data into specific months, dates and times, and converting them into unified time characteristic indicators, data analysis is made more accurate. The refined processing helps to capture subtle differences in time, thereby more accurately analyzing the changing trends and periodic laws of power consumption.
[0033] Performing time frequency analysis on the historical time characteristic indicator to determine the corresponding time frequency characteristic data specifically includes: performing time frequency analysis on the historical time characteristic indicator according to a preset time frequency analysis function to generate the corresponding time frequency characteristic data; the time frequency analysis function is ,in, is the time frequency characteristic data corresponding to the nth historical time characteristic indicator, is a trigonometric function, including any one of the cosine and sine functions, is the nth historical time characteristic indicator, and T is the total number of predetermined time characteristic indicators.
[0034] In one embodiment of the present specification, by , conduct time frequency analysis on historical time characteristic indicators and generate corresponding time frequency characteristic data, is the time frequency characteristic data corresponding to the nth historical time characteristic indicator, is a trigonometric function, including any one of the cosine function and the sine function. You can choose any trigonometric function according to your needs. is the nth historical time characteristic indicator, and T is the total number of predetermined time characteristic indicators. It should be noted that, based on the different determination dimensions of the time characteristic indicators, different determination methods correspond to different values of T. When determining the historical time characteristic indicators, only the historical energy consumption moment data is considered. Here, T is 24, corresponding to the total number of hours per day. When determining the historical time characteristic indicators, the historical energy consumption moment data and the historical energy consumption date data are considered, and the total number of days in the current year is determined according to the year. T is the product of 24 and the total number of days, corresponding to the total number of hours in the current year.
[0035] Through the above technical solutions, time-frequency analysis can reveal the periodic laws in historical time characteristic indicators. By calculating the time-frequency characteristic data corresponding to each historical time characteristic indicator, the periodic components in the data can be identified, such as daily cycles, weekly cycles, monthly cycles, etc.; based on the analysis of time-frequency characteristic data, a more accurate prediction model can be constructed. By identifying the periodic patterns in historical data, the changing trends of future power consumption in different time periods can be predicted, providing a scientific basis for energy management and scheduling.
[0036] Step S103 , multi-dimensional feature fusion is performed on the time frequency feature data corresponding to each historical energy consumption, the reference power consumption evaluation dimension data and the historical energy consumption, so as to determine a plurality of multi-dimensional energy consumption indicator data corresponding to the historical energy consumption time series data.
[0037] Multi-dimensional feature fusion is performed on the time-frequency characteristic data, the reference power consumption evaluation dimension data and the historical energy consumption corresponding to each historical energy consumption to determine multiple multi-dimensional energy consumption indicator data corresponding to the historical energy consumption time series data, specifically including: normalizing the time-frequency characteristic data, the reference power consumption evaluation dimension data and the historical energy consumption corresponding to each historical energy consumption respectively to determine the normalized time-frequency information, the normalized power consumption evaluation dimension information and the normalized energy consumption numerical information; splicing the time-frequency information, the power consumption evaluation dimension information and the energy consumption numerical information to determine the multi-dimensional energy consumption indicator data corresponding to each historical energy consumption to determine the multiple multi-dimensional energy consumption indicator data corresponding to the historical energy consumption time series data.
[0038] In one embodiment of the present specification, the time frequency feature data corresponding to the historical energy consumption, the reference power consumption evaluation dimension data and the historical energy consumption are respectively normalized. The normalization method here can adopt the mean normalization method. By normalizing the time frequency feature data, the reference power consumption evaluation dimension data and the historical energy consumption, the numerical features and the time frequency features are processed to the same order of magnitude, so as to balance the weights of each feature in the clustering algorithm. The time frequency information, the power consumption evaluation dimension information and the energy consumption numerical information are spliced, such as ,in, is the normalized energy consumption information, is the normalized video time frequency information, For the normalized power consumption evaluation dimensional information, the multi-dimensional energy consumption indicator data corresponding to each historical energy consumption is determined according to the above-mentioned splicing method to determine a plurality of the multi-dimensional energy consumption indicator data corresponding to the historical energy consumption time series data.
[0039] Through normalization processing, the dimensional differences between different data dimensions are eliminated, so that different time-frequency characteristics, power consumption evaluation dimensions and energy consumption data can be compared and analyzed on the same scale. The normalized data can improve the convergence speed and accuracy of the model. The multi-dimensional energy consumption indicator data provides the model with richer information and helps to build a more accurate prediction model.
[0040] Step S104, clustering analysis is performed on multiple multi-dimensional energy consumption indicator data through a preset clustering algorithm to determine the token tag information corresponding to each multi-dimensional energy consumption indicator data, so as to make predictions based on multiple token tag information and the time length data to be predicted, and determine multiple predicted token tag information.
[0041] Through a preset clustering algorithm, a cluster analysis is performed on the multiple multidimensional energy consumption indicator data to determine the token label information corresponding to each of the multidimensional energy consumption indicator data, specifically including: inputting the multiple multidimensional energy consumption indicator data into a pre-trained Gaussian mixture model, and constructing a three-dimensional space based on the multidimensional energy consumption indicator data; clustering analysis is performed on the multiple multidimensional energy consumption indicator data in the three-dimensional space to determine multiple groups of data points belonging to the same category; the multidimensional energy consumption indicator data is quantified through the multiple groups of data points, and multiple discrete token label information corresponding to the multidimensional energy consumption indicator data is output.
[0042] In one embodiment of the present specification, a Gaussian mixture model (GMM) is trained in advance with a historical power consumption data set of the same type to determine the model parameters. It should be noted that the historical power consumption data set is a time series data of energy consumption corresponding to a large number of historical moments. Multiple multi-dimensional energy consumption index data are input into the trained Gaussian mixture model. Through the Gaussian mixture model, a three-dimensional space is constructed based on the multi-dimensional energy consumption index data. This space is full of data points. Points with similar distances and similar distributions will be considered to be the same type of information and will eventually be quantified into a class of data. The clustering function of the Gaussian mixture model is used to cluster the multi-dimensional energy consumption index data. The GMM will assign the data points to different Gaussian components (i.e., clusters) according to the distribution characteristics of the data, and each component represents a category. During the clustering process, the model calculates the probability that each data point belongs to each category and assigns it to the category with the highest probability. The GMM algorithm serves as the input layer of the entire model. It performs quantitative classification based on the fusion of numerical information and time-frequency information. This algorithm will classify data with closer distances into one category based on the distribution of the data in space. This distance comprehensively considers the numerical and time-frequency characteristics. Finally, the quantification results of the algorithm are packaged into discrete token labels.
[0043] Through the above technical solution, since GMM is trained based on the same type of power consumption data set, it can better capture the distribution characteristics of this type of data. Targeted training enables the model to more accurately identify the potential structure and pattern in the data during clustering. In the clustering process, GMM not only considers numerical information (such as energy consumption), but also integrates time and frequency information. This multi-dimensional information fusion makes the clustering results more comprehensive and accurate, and can reveal the changing laws and correlations of data at different time scales. Unlike some algorithms that require the pre-specified number of clusters (such as K-means), GMM can automatically determine the optimal number of clusters (i.e., the number of Gaussian components), which makes the model more flexible and adaptable to data sets of different sizes and complexities. The use of clustering can intuitively integrate time information and numerical information into discrete tokens, focusing on the influence of time and frequency characteristics. In addition, GMM is suitable for processing time series data clustering with a large number of clusters (such as up to 10,000). Integrating this algorithm into model prediction greatly improves the convenience and accuracy of large model prediction.
[0044] Prediction is performed based on multiple token label information and the time length data to be predicted to determine multiple predicted token label information, specifically including: obtaining token label vectors in the token label information, mapping each of the token label vectors to a high-dimensional continuous vector space, and determining a high-dimensional token label vector; performing autoregressive generative prediction on the multiple high-dimensional token label vectors through an encoder-decoder based on the Transformer architecture to output multiple high-dimensional prediction feature vectors; according to the time length data to be predicted, projecting the multiple high-dimensional prediction feature vectors to determine multiple specified dimensional feature vectors under the corresponding prediction time length; based on the multiple specified dimensional feature vectors, matching is performed in a pre-constructed token label library to determine multiple predicted token label information, wherein the token label library includes multiple token labels and a vector representation corresponding to each token label.
[0045] In one embodiment of the present specification, first, a token tag vector is obtained and mapped to a high-dimensional continuous vector space, and token tag information is obtained from the previous cluster quantization process. Each token tag can be represented as a vector (usually discrete). In order to utilize the powerful capabilities of the Transformer deep learning model, it is necessary to map these low-dimensional or discrete token tag vectors to a high-dimensional continuous vector space, which is achieved through an embedding layer. The embedding layer can map each token tag to a high-dimensional vector of a fixed size. The Transformer model adopts an encoder-decoder structure, in which the encoder is responsible for processing the input sequence (here is a high-dimensional token tag vector), and the decoder generates a target sequence based on the output of the encoder. During the decoding process, the Transformer adopts an autoregressive method, that is, each time an output is generated, all previous outputs are considered, ensuring that the model captures long-term dependencies in the sequence. Through the decoder of the Transformer model, multiple high-dimensional prediction feature vectors are generated, which contain prediction information about future time steps. Finally, the projection determines the specified dimension feature vector under the prediction time length. According to the time length to be predicted, the high-dimensional prediction feature vector output by the Transformer model is projected into the corresponding low-dimensional space to obtain the feature vector of the specified dimension, which is usually achieved through a linear transformation (such as a fully connected layer). The projected feature vector is a feature vector related to the predicted time length, and this information will be used for subsequent token tag matching. A token tag library is pre-built, which contains multiple token tags and their corresponding vector representations. These vector representations can be determined by the cluster output of the training process of the Gaussian mixture model, and are used to represent multiple token tags that may appear. The projected feature vector of the specified dimension is similar to the vector representation in the token tag library (such as cosine similarity), and the most similar token tag is found as the prediction result. For each feature vector under the predicted time length, the above matching process can be performed to obtain multiple predicted token tag information. Token tags constitute a vocabulary library, which makes the time series model largely similar to the task category of the language model, which is conducive to the prediction of the Transformer architecture.
[0046] Through the above technical solution, token labels are mapped to a high-dimensional continuous vector space, and learned and predicted through the Transformer model, which helps the model learn more abstract and generalized feature representations, so that the model can still maintain good performance when facing unseen data or slightly different application scenarios; by projecting feature vectors of specified dimensions, features of different time lengths can be flexibly predicted, so that the model can be applied to a variety of prediction tasks and meet different business needs; by matching the prediction results with the token label library, key information and patterns in the data can be quickly identified.
[0047] Step S105 , performing a reverse processing operation on each prediction token tag information to generate predicted energy consumption time series data corresponding to each prediction token tag.
[0048] The reverse processing operation is used to determine whether the predicted energy consumption time series data and the historical energy consumption time series data are at the same data level.
[0049] Perform a reverse processing operation on each prediction token label information to generate predicted energy consumption time series data corresponding to each prediction token label, specifically including: determining the predicted token label vector corresponding to each prediction token label information; performing a reverse quantization operation on each prediction token label vector to determine the multi-dimensional predicted energy consumption index data corresponding to each prediction token label vector; performing a reverse normalization operation on the multi-dimensional predicted energy consumption index data to determine the multi-dimensional predicted energy consumption data corresponding to each multi-dimensional predicted energy consumption index data, so as to determine the predicted energy consumption time series data.
[0050] In one embodiment of the present specification, first, for each prediction token label information, it is necessary to determine the corresponding prediction token label vector, and perform dequantization on each prediction token label vector. Dequantization is the inverse operation of the quantization process, which aims to convert the quantized discrete value back to the original continuous value range. Each element (or dimension) in the prediction token label vector is converted back to the continuous value of its corresponding multi-dimensional predicted energy consumption index data. Since the original data may have been normalized (i.e., the data is scaled to a specific range, such as between 0 and 1) before being input into the model, it is necessary to perform denormalization on the dequantized multi-dimensional predicted energy consumption index data. Denormalization is the process of converting the normalized data back to its original dimension and range. After dequantization and denormalization, the obtained multi-dimensional predicted energy consumption data represents the predicted energy consumption time series data corresponding to each prediction token label. These data are consistent with the historical energy consumption time series data in terms of magnitude and dimension, and can be used for subsequent analysis, comparison or decision support.
[0051] Through the above technical solution, by generating historical time feature indicators and performing time frequency analysis, the time dependence and periodicity in the power consumption data can be captured. The focus on time frequency features enables the model to more accurately understand the changing laws of power consumption patterns, so that it can more accurately reflect future power consumption trends during predictions. Multi-dimensional features of time frequency features, reference power consumption evaluation dimension data (such as peak power consumption periods, flat periods, and valley periods) and historical power consumption are integrated to form rich multi-dimensional energy consumption indicator data. Multi-dimensional data provides more comprehensive information for the model, enabling it to better adapt to and identify complex power consumption patterns. Cluster analysis of multi-dimensional energy consumption indicator data using a preset clustering algorithm can classify similar power consumption patterns into one category based on the intrinsic characteristics of the data and assign corresponding token label information. The data-driven clustering method improves the accuracy of classification and provides a more reliable basis for subsequent predictions. The predicted token label information is reversed to generate predicted energy consumption time series data, and ensures that it maintains the same data magnitude as the historical energy consumption time series data. The usability of the prediction results in practical applications is ensured, and misunderstandings or wrong decisions caused by inconsistent magnitudes are avoided; it is not only applicable to the prediction of historical energy consumption time series data, but also can flexibly adjust the prediction range and accuracy according to the different time lengths of the data to be predicted, and is widely used in power consumption prediction tasks under different scenarios and needs. By determining the time-frequency characteristics, performing multi-dimensional feature fusion, cluster analysis, and achieving the magnitude consistency of the prediction results, the problem of ignoring the time-frequency characteristics in the existing prediction process is effectively solved, and the prediction accuracy is improved.
[0052] The embodiment of this specification also provides another whole reasoning process of an electric energy consumption prediction device based on a clustering algorithm. Figure 2 This is an example diagram of the reasoning process of an energy consumption prediction device based on a clustering algorithm provided in an embodiment of this specification. In this embodiment of this specification, only numerical information and time information are considered, and the power consumption evaluation dimension is not considered. Figure 2 As shown, the power consumption prediction device includes a data input module, a clustering algorithm module, an encoding-decoding module, and a post-processing output module. The data input module uses trigonometric functions to represent time-frequency information, and concatenates the time frequency with the time series numerical value, and uses mean normalization to process the numerical features and the time frequency features to the same order of magnitude, so as to balance the weights of each feature in the clustering algorithm; the clustering algorithm module predefines the total number of quantized labels, and uses the clustering algorithm to fit the pre-processed data to complete the quantization of the time series, and then projects the quantized structure into a high-dimensional feature vector through a linear layer; as shown in the formula ), is the number of components in the Gaussian mixture model, It is The mixing coefficient of the Gaussian components. It is A multivariate Gaussian distribution of components, where is the mean vector, is the covariance matrix. The formula can be used to calculate the probability density of each Gaussian component, and clustering can be achieved based on these probability densities. The specific values of the above formula can be obtained using the existing model training process. The encoding-decoding module is used to generate data by autoregressing the input high-dimensional feature vector based on the encoder-decoder of the Transformer architecture; the post-processing output module converts the discrete results predicted by the large model based on the quantized results into the actual time series values, assisting the large model to complete the final prediction.
[0053] After collecting the time series x and the corresponding time frequency t data, first perform trigonometric function on t to obtain t'. Then perform splicing of the spliced data vectors to obtain a mixed vector d. The splicing process here can include numerical information, time information, and power consumption evaluation dimension identifiers, or it can only include numerical information and time information. In the embodiments of this specification, only numerical information and time information are considered for explanation. Therefore, the splicing process here only includes numerical information and time information. By Normalize d to obtain dnew. At this time, dnew contains numerical and time information and can be directly used as the input of the GMM clustering algorithm. GMMs will implement category quantization based on the probability density function. This quantization method is mainly based on the numerical information and time frequency information of the data: the numerical value and time frequency will construct a two-dimensional space, which is full of data points. Points with similar distances and distributions will be considered to be the same type of information and will eventually be quantized into one type of data. Therefore, the output result of the GMM algorithm is a discrete label token vector b. The input projection layer is usually an embedding layer, which maps the quantization result to a high-dimensional continuous vector space to facilitate subsequent model processing and prediction of the data. The decoding-encoding module extracts and processes information based on the high-dimensional vector, and then outputs a processed high-dimensional vector b'. Finally, the linear projection layer in the post-processing module first projects the high-dimensional information to the data f of the required length, and then, the GMMs-based inverse quantization method is used. , obtain the combined information of numerical value and time frequency (f', t'), denormalize f' to obtain the final required prediction result f''.
[0054] Through the above technical solutions, the time frequency information and numerical information in the time series data are innovatively fused. This combination not only retains the time dependency in the data, but also enhances the model's ability to capture periodic and trend patterns, so that the multi-dimensional information in the time series can be fully utilized. Usually, the fusion of time information is achieved through the interaction of neural networks, which is difficult to explain and has uncertainty. The use of clustering can intuitively fuse time information and numerical information into discrete tokens, focusing on the influence of time frequency characteristics. In addition, GMMs is suitable for processing time series data clustering with a large number of clusters (such as up to 10,000 types). Integrating this algorithm into model prediction greatly improves the convenience and accuracy of large model prediction. Combining large models and clustering algorithms, the clustering algorithm is used to enhance the model's understanding of time frequency characteristics, which can help large models better capture complex dependencies and periodic patterns in time series, thereby improving the accuracy of predictions. In addition, through quantization processing, the interference of noise on the model is reduced, which is more in line with the training and prediction needs of large models and improves the generalization ability of the model.
[0055] The embodiment of this specification also provides an energy consumption prediction device based on a clustering algorithm, such as Figure 3 As shown, the device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above method.
[0056] The embodiments of the present specification also provide a non-volatile computer storage medium storing computer executable instructions, wherein the computer executable instructions are configured to execute the above method.
[0057] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, equipment, and non-volatile computer storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0058] The devices and media provided in the embodiments of this specification correspond one-to-one to the methods. Therefore, the devices and media also have similar beneficial technical effects as the corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the devices and media will not be repeated here.
[0059] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0060] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes 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 a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0061] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0062] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0063] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0064] Memory may include non-permanent storage in a computer-readable medium, in the form of random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0065] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0066] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0067] The above description is only one or more embodiments of this specification and is not intended to limit this specification. For those skilled in the art, one or more embodiments of this specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of one or more embodiments of this specification shall be included in the scope of the claims of this specification.
Claims
1. A method for predicting power consumption based on clustering algorithm, characterized in that: The method comprises: Acquire historical energy consumption time series data and to-be-predicted time length data within a historical collection time interval, wherein the historical energy consumption time series data includes multiple historical energy consumptions and historical energy consumption time data corresponding to each of the historical energy consumptions; Generate historical time characteristic indicators and reference power consumption evaluation dimension data corresponding to each of the historical energy consumption data according to the historical energy consumption time data, so as to perform time frequency analysis on the historical time characteristic indicators and determine the corresponding time frequency characteristic data, wherein the reference power consumption evaluation dimension data includes a power consumption peak period dimension, a power consumption level period dimension, and a power consumption valley period dimension; Performing multi-dimensional feature fusion on the time-frequency characteristic data, the reference power consumption evaluation dimension data and the historical energy consumption corresponding to each of the historical energy consumption, so as to determine a plurality of multi-dimensional energy consumption indicator data corresponding to the historical energy consumption time series data; By using a preset clustering algorithm, cluster analysis is performed on the multiple multi-dimensional energy consumption indicator data to determine the token tag information corresponding to each of the multi-dimensional energy consumption indicator data, so as to make predictions based on the multiple token tag information and the time length data to be predicted, and determine multiple prediction token tag information; Perform a reverse processing operation on each of the predicted token label information to generate predicted energy consumption time series data corresponding to each of the predicted token labels, wherein the reverse processing operation is used to determine that the predicted energy consumption time series data and the historical energy consumption time series data are at the same data level.
2. The method for predicting electric energy consumption based on clustering algorithm according to claim 1, characterized in that: Generate a historical time characteristic index and reference power consumption evaluation dimension data corresponding to each historical energy consumption amount according to the historical energy consumption time data, specifically including: According to the historical energy consumption time data, matching is performed in a pre-constructed power consumption evaluation dimension mapping table to determine reference power consumption evaluation dimension data corresponding to each of the historical energy consumption time data, wherein the power consumption evaluation dimension mapping table includes multiple power consumption evaluation dimensions and time information corresponding to each of the power consumption evaluation dimensions; Determine the historical energy consumption time data and the historical energy consumption date data in the historical energy consumption time data; The historical energy consumption time data and the historical energy consumption date data are converted by a preset time index quantization function to generate a historical time characteristic index corresponding to each historical energy consumption time data.
3. The method for predicting electric energy consumption based on clustering algorithm according to claim 2, characterized in that: The historical energy consumption time data and the historical energy consumption date data are converted by a preset time index quantification function to generate a historical time characteristic index corresponding to each historical energy consumption time data, specifically including: According to the preset dimensions, the historical energy consumption date data is split to determine the month data corresponding to the month dimension and the date data corresponding to the date dimension; Determine the cumulative day index corresponding to the current annual cycle through the attribution month data and the attribution date data, and convert the cumulative day index into an hour dimension to generate a cumulative hour index; The accumulated hourly index and the historical energy consumption time data are superimposed to determine a historical time characteristic index corresponding to the historical energy consumption time data.
4. The method for predicting electric energy consumption based on clustering algorithm according to claim 1, characterized in that: Performing time frequency analysis on the historical time characteristic indicators to determine corresponding time frequency characteristic data specifically includes: According to a preset time frequency analysis function, a time frequency analysis is performed on the historical time characteristic index to generate corresponding time frequency characteristic data; The time-frequency analysis function is ,in, is the time frequency characteristic data corresponding to the nth historical time characteristic indicator, is a trigonometric function, including any one of the cosine and sine functions, is the nth historical time characteristic indicator, and T is the total number of predetermined time characteristic indicators.
5. The method for predicting electric energy consumption based on clustering algorithm according to claim 1, characterized in that: The time frequency characteristic data, the reference power consumption evaluation dimension data and the historical energy consumption corresponding to each of the historical energy consumption are subjected to multi-dimensional feature fusion to determine a plurality of multi-dimensional energy consumption indicator data corresponding to the historical energy consumption time series data, specifically including: Normalizing the time-frequency characteristic data, the reference power consumption evaluation dimension data, and the historical energy consumption data corresponding to each of the historical energy consumption data to determine normalized time-frequency information, normalized power consumption evaluation dimension information, and normalized energy consumption value information; The time frequency information, the power consumption evaluation dimension information and the energy consumption value information are spliced to determine the multi-dimensional energy consumption indicator data corresponding to each of the historical energy consumption data, so as to determine the multiple multi-dimensional energy consumption indicator data corresponding to the historical energy consumption time series data.
6. The method for predicting electric energy consumption based on clustering algorithm according to claim 1, characterized in that: By using a preset clustering algorithm, cluster analysis is performed on the plurality of multi-dimensional energy consumption indicator data to determine the token tag information corresponding to each of the multi-dimensional energy consumption indicator data, specifically including: Inputting the plurality of multi-dimensional energy consumption index data into a pre-trained Gaussian mixture model, and constructing a three-dimensional space according to the multi-dimensional energy consumption index data; Performing cluster analysis on the plurality of multi-dimensional energy consumption indicator data in the three-dimensional space to determine a plurality of groups of data points belonging to the same category; The multi-dimensional energy consumption index data is quantified through the multiple groups of data points, and a plurality of discrete token label information corresponding to the multi-dimensional energy consumption index data is output.
7. The method for predicting electric energy consumption based on clustering algorithm according to claim 1, characterized in that: Predicting based on the plurality of token tag information and the to-be-predicted time length data, and determining a plurality of predicted token tag information, specifically includes: Obtaining a token label vector in the token label information, mapping each of the token label vectors to a high-dimensional continuous vector space, and determining a high-dimensional token label vector; Performing autoregressive generative prediction on the plurality of high-dimensional token label vectors through an encoder-decoder based on a Transformer architecture to output a plurality of high-dimensional prediction feature vectors; According to the time length data to be predicted, projecting the multiple high-dimensional prediction feature vectors to determine multiple specified-dimensional feature vectors under the corresponding prediction time length; Based on the multiple specified dimension feature vectors, matching is performed in a pre-built token tag library to determine multiple predicted token tag information, wherein the token tag library includes multiple token tags and a vector representation corresponding to each of the token tags.
8. The method for predicting electric energy consumption based on clustering algorithm according to claim 1, characterized in that: Performing a reverse processing operation on each of the predicted token label information to generate predicted energy consumption time series data corresponding to each of the predicted token labels specifically includes: Determine a predicted token label vector corresponding to each predicted token label information; Performing dequantization processing on each of the prediction token label vectors to determine the multi-dimensional predicted energy consumption index data corresponding to each of the prediction token label vectors; The multi-dimensional predicted energy consumption index data is subjected to a denormalization process to determine the multi-dimensional predicted energy consumption data corresponding to each multi-dimensional predicted energy consumption index data, so as to determine the predicted energy consumption time series data.
9. An electric energy consumption prediction device based on clustering algorithm, characterized in that: The device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform the method according to any one of claims 1 to 8.
10. A non-volatile computer storage medium storing computer executable instructions, characterized in that: The computer executable instructions are configured to execute the method according to any one of claims 1 to 8.