Power transmission and transformation project transformer cost prediction method, device and equipment based on improved transformer model
By improving the transformer model and combining multi-dimensional parameters and multi-head causal attention mechanism, the problem of low accuracy of transformer cost prediction data for power transmission and transformation projects is solved, more accurate price predictions are achieved, and prediction errors are reduced.
Patent Information
- Application Number
- CN202410468153.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-18
- Publication Date
- 2024-09-24
AI Technical Summary
In the existing technology, the accuracy of the transformer cost prediction data for power transmission and transformation projects is low, making it difficult to accurately predict the changing patterns and trends of transformer prices.
Using a method based on the improved transformer model, by obtaining historical time series data, performing data processing and model training, combined with multi-dimensional parameters, the LSTM prediction model is used to predict the transformer cost of power transmission and transformation projects, including data normalization, smoothing and K Folded cross-validation,prediction using multi-head causal attention mechanism and,feedforward neural network.
It improves the accuracy of the transformer cost prediction for power transmission and transformation projects, reduces the difference between the predicted cost and the actual cost, and significantly improves the accuracy of the prediction data.
Smart Images

Figure CN118691297A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of transformer cost prediction, and in particular to a method, device and equipment for predicting transformer cost of a power transmission and transformation project based on an improved transformer model. Background Art
[0002] The power grid is an important public infrastructure for national economic and social development, covering urban and rural areas. In recent years, my country's investment in power grid construction has continued to increase, the power grid's power supply capacity has steadily increased, the grid structure has been continuously optimized, and the power grid has achieved remarkable results. With the continuous expansion of the scale of investment and construction of power grid construction projects, the continuous emergence of new technologies and processes in power grid construction projects, and the continuous changes in the market price level of equipment and materials, the investment planning and project cost management of power grid construction projects face higher requirements and standards. As a key electrical equipment in power grid construction projects, transformers have high unit prices and frequent price fluctuations. How to construct a scientific and reasonable prediction model to analyze the laws and trends of transformer cost changes is crucial.
[0003] The cost of transformers for power transmission and transformation projects is a market transaction factor, and its changes are affected by many factors. At present, research on the cost of power transmission and transformation projects such as substations and transmission lines has been carried out at home and abroad, but the prediction technology for the cost of transformers for power transmission and transformation projects is still relatively scarce, and there are still some shortcomings and gaps. Summary of the invention
[0004] The embodiments of the present application provide a method, device and equipment for predicting the cost of transformers for power transmission and transformation projects based on an improved transformer model. The present invention combines parameters in multiple dimensions, considers the cost of transformers for power transmission and transformation projects for multiple periods, obtains accurate prediction data on the cost of transformers for power transmission and transformation projects, and reduces the difference between the predicted cost and the actual cost.
[0005] The embodiment of the present application provides a method, device and equipment for predicting the cost of a transformer for a power transmission and transformation project based on an improved transformer model, including the following steps:
[0006] S1 obtains a cost prediction model for a power transmission and transformation project transformer. The input variable of the power transmission and transformation project transformer cost prediction model is the cost of the power transmission and transformation project transformer during the test period. The cost of the power transmission and transformation project transformer during the prediction period is used as the output variable of the power transmission and transformation project transformer cost prediction model.
[0007] S2 collects first data corresponding to the cost of transformers for power transmission and transformation projects in a historical time series, wherein the first data includes a relevant historical series and a historical price time series;
[0008] S3 processes the first data to generate a sample set, and divides the samples in the sample set into training samples and test samples;
[0009] S4 trains the improved transformer model using the training samples;
[0010] S5 uses the test samples to test the trained improved transformer model and obtains the trained transformer cost prediction model for power transmission and transformation projects.
[0011] Furthermore, the transformer cost prediction model for the power transmission and transformation project is obtained by training an improved transformer model based on the first data.
[0012] Furthermore, the relevant historical sequence includes transformer cost data of the previous phase, the previous two phases and the previous three phases of power transmission and transformation projects.
[0013] Furthermore, the data processing of the first data includes normalization processing, data smoothing processing and data set division processing.
[0014] Furthermore, the data smoothing process uses a linear smoothing filter, including a Savitzky-Golay filter and a simple moving average.
[0015] Furthermore, the data set partitioning process adopts a K-fold cross validation method.
[0016] Further, a transformer model suitable for the task is selected;
[0017] The pre-processed transformer cost data of the previous, second and third phases of power transmission and transformation projects are passed to the model as input variables;
[0018] The current transformer cost data of power transmission and transformation projects is used as the output variable;
[0019] The model is used to predict the transformer cost of power transmission and transformation projects, and a trained improved transformer model is obtained.
[0020] Furthermore, the root mean square error or mean absolute error is used when testing the trained improved transformer model using the test samples.
[0021] Furthermore, it includes a storage medium, which retains the historical power transmission and transformation project transformer cost data and all current power transmission and transformation project transformer cost forecast data, and the first data of the current forecast data sequence is recursively compared with the historical cost forecast data in the storage medium.
[0022] Further, the data collection unit is used to collect first data corresponding to the cost of transformers for power transmission and transformation projects in a historical time series, wherein the first data includes a related historical series and a historical price time series;
[0023] A data processing unit, used to perform data processing on the first data, generate a sample set, and divide the samples in the sample set into training samples and test samples;
[0024] A model training unit, which trains the improved transformer model using training samples;
[0025] The model testing unit uses the test samples to test the trained improved transformer model to obtain the trained transformer cost prediction model for power transmission and transformation projects;
[0026] The prediction model unit uses the power transmission and transformation project transformer cost prediction model to predict the power transmission and transformation project transformer cost in the historical period and obtain the current power transmission and transformation project transformer cost.
[0027] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages:
[0028] By combining parameters in multiple dimensions and considering the transformer costs of multiple phases of power transmission and transformation projects, accurate transformer cost forecast data for power transmission and transformation projects is obtained, which reduces the price difference between the predicted cost and the actual cost, and effectively solves the problem of low accuracy of transformer cost forecast data for power transmission and transformation projects in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 A method, device and equipment flow chart for predicting transformer cost for power transmission and transformation projects based on an improved transformer model provided in an embodiment of the present application;
[0030] Figure 2 The cost prediction results of the embodiments of the method, device and equipment for predicting the cost of transformers for power transmission and transformation projects based on the improved transformer model provided in the embodiments of the present application;
[0031] Figure 3 A schematic diagram of model training based on an improved transformer provided in an embodiment of the present application; DETAILED DESCRIPTION
[0032] The embodiments of the present application solve the problem of low accuracy of power transmission and transformation project transformer cost prediction data in the prior art by providing a power transmission and transformation project transformer cost prediction method, device and equipment based on an improved transformer model. By combining parameters in multiple dimensions and considering the power transmission and transformation project transformer costs for multiple periods, accurate power transmission and transformation project transformer cost prediction data is obtained, thereby reducing the price difference between the predicted cost and the actual cost.
[0033] In order to better understand the above technical solution, the above technical solution will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0034] The present disclosure provides a LSTM prediction method for power grid investment and construction cost considering multi-dimensional factors, comprising the following steps:
[0035] S1 obtains a cost prediction model for a transformer for a power transmission and transformation project. The input variable of the cost prediction model for a transformer for a power transmission and transformation project is the cost of the transformer for a power transmission and transformation project during the test period. The cost of the transformer for a power transmission and transformation project during the prediction period is used as the output variable of the cost prediction model for a transformer for a power transmission and transformation project. S2 collects first data corresponding to the cost of the transformer for a power transmission and transformation project in a historical time series. The first data includes a related historical series and a historical price time series. S3 processes the first data to generate a sample set, and divides the samples in the sample set into training samples and test samples. S4 trains an improved transformer model using the training samples. S5 tests the trained improved transformer model using the test samples to obtain a trained cost prediction model for a transformer for a power transmission and transformation project.
[0036] In the above scheme, the period to be predicted is input into a pre-trained power transmission and transformation project transformer cost prediction model to obtain the price of the power transmission and transformation project transformer in the period to be predicted; wherein, the power transmission and transformation project transformer cost prediction model is obtained by training an improved transformer model based on the price and historical time series corresponding to the historical time series of the power transmission and transformation project transformer.
[0037] Collect the price data corresponding to the historical time series of the power transmission and transformation project transformer and the historical price time series. According to the cost data of the power transmission and transformation project transformer and the historical time series of the power transmission and transformation project transformer cost, the relevant historical time series include: the previous period, the previous two periods and the previous three periods of the power transmission and transformation project transformer cost data.
[0038] The prediction method of the transformer is to preprocess the input data. Data preprocessing mainly includes the following three parts: data normalization, data smoothing, and data set division.
[0039] 1) Data normalization
[0040] The historical data range of transformer cost for power transmission and transformation projects may be of different scales. If there is a very large scale range of data, the impact of small scale range data on model training is easy to be ignored, so normalization is needed. Logarithmic normalization is to process each data using the following formula to convert the data into its logarithmic form so as to better meet the requirements of the model.
[0041]
[0042] Where: x is the original sequence data, and x' is the sequence data after logarithmic normalization.
[0043] 2) Data smoothing
[0044] The collected data often has glitches and noise, and it is not effective to use it directly for prediction and analysis. The original sample data needs to be smoothed and preprocessed. The Savitzky-Golay filter formula can be used for data smoothing. Its main idea is to fit a polynomial near the data point and use the pre-calculated coefficients to perform weighted averaging of adjacent data points. This can smooth the data while maintaining the shape of the data without introducing too much phase delay.
[0045] The workflow is:
[0046] First, select some parameters to configure how the Savitzky-Golay filter works, including the degree of the fitting polynomial (usually 2 to 4) and the window size (usually an odd number);
[0047] Secondly, according to the selected parameters, the coefficients required for Savitzky-Golay filtering are calculated. These coefficients are pre-calculated and used to weighted average adjacent data points.
[0048] Then, for each data point, the data points in the window (the number is the window size) and the corresponding coefficients are weighted averaged to generate a smoothed data sequence;
[0049] Finally, boundary processing is performed to ensure that boundary points are also smoothed.
[0050] The specific mathematical principles are as follows:
[0051] First, a total of 2n+1 observations before and after the current moment are filtered and fitted with a k-1 order polynomial. For the observations at the current moment, the following formula is used for fitting:
[0052] x t =a0+a1*t+a2*t 2 +…+a k-1 *t k-1
[0053] Secondly, the predicted values of the previous and next moments (such as t-1, t+1, t-2, t+2, etc.) can also be calculated using the above formula, resulting in a total of 2n+1 formulas, forming a matrix:
[0054]
[0055] Simplify the above matrix:
[0056] X (2n+1)×1 =T (2n+1)×k +A k×1 +E (2n+1)×1
[0057] In the formula: the subscripts of each parameter represent their respective dimensions;
[0058] Then, calculate the filtered value of the model:
[0059] P=T·A=T·(T trans ·T) -1 ·T trans ·X=B·X
[0060] A=(T trans ·T) -1 ·T trans ·X
[0061] Where: superscript trans means transposition;
[0062] Finally, the relationship matrix between the filtered values and the observed values is calculated:
[0063] B=T·(T trans ·T) -1 ·T trans
[0064] The Savitzky-Golay filtering formula can effectively remove the noise in the original data set and make the original data plot curve smooth, which is helpful to avoid overfitting or underfitting.
[0065] 3) Dataset division
[0066] After data normalization and data smoothing, the data set needs to be divided into training set and test set before model training. The k-fold cross-validation method is used to divide the data set into k folds, and each fold is used as a test set in turn, and the remaining k-1 folds are used as training sets, and cross-validation is performed multiple times.
[0067] The specific steps are:
[0068] First, the original data set is divided into k non-overlapping subsets, each of which is called a fold. For each fold i, the i-th fold is used as the test set, and the remaining k-1 folds are used as training sets.
[0069] Secondly, train the model on the training set, perform performance evaluation on the test set, and calculate the performance indicators of the model in the i-th cross-validation, such as accuracy, precision, recall, etc.;
[0070] Finally, the above process is repeated until each fold is used as a test set, thus completing k cross-validations, and averaging the performance indicators of each cross-validation to obtain the average performance estimate of the model.
[0071] Through the above-mentioned data normalization, data smoothing and data set division methods, the data is converted into a format suitable for model input, a transformer model suitable for the task is selected, and the preprocessed transformer cost data of the previous, second and third periods of power transmission and transformation projects are passed to the model as input variables. The current power transmission and transformation project transformer cost data is used as the output variable, and the model is used to predict the transformer cost of power transmission and transformation projects.
[0072] The training process of the improved transformer model is:
[0073] 1) Since the transformer model has no temporal relationship with the input sample sequence, the sine and cosine functions need to be used to positionally encode the input data. Each dimension of the positional encoding corresponds to a sine signal or a cosine signal, that is:
[0074] PE(p os ,2i)=sin(p os / 10000 2i / d )
[0075] PE(p os ,2i+1)=cos(p os / 10000 2i / d )
[0076] Where: p os is the position of the element in the sample for prediction of transformer cost for power transmission and transformation project; i is the dimension of the element in the sample for prediction of transformer cost for power transmission and transformation project; d is the dimension of the position vector in the model.
[0077] 2) The input matrix of the transformer cost prediction of the power transmission and transformation project is mapped to three sets of different vector matrices through three different linear transformations, namely the query matrix Q, the key matrix K and the value matrix V, namely:
[0078]
[0079] Where: X is the sample input matrix; W Q , W K , W ν are the linear transformation weight matrices respectively.
[0080] 3) The improved transformer transmission and transformation project transformer cost intelligent prediction model is embodied in a multi-head causal attention module connected to a feedforward neural network. The multi-head causal self-attention module is used to process the vector output by the feedforward neural network to obtain the output of the multi-head causal attention mechanism layer, and the output of the multi-head causal attention mechanism is obtained through linear change and Softmax function.
[0081] The Softmax function is:
[0082]
[0083] Where: d k is the gradient factor, and mask(·) represents the masking operation. The mask sets the upper triangular elements of the matrix (excluding the diagonal) to -∞, ensuring that the attention of a certain point can only be calculated through the elements before the point, preventing information leakage and making the correlation calculation towards the historical direction; at the same time, it enhances / weakens the spatial characteristics of strong / weak correlation, which helps the model better focus on important information.
[0084] The output of the multi-head causal attention mechanism is:
[0085]
[0086] Where: W i Q , W i K , W i V The linear transformation weight matrices of Q, K and V for the i-th head respectively; W o It is the linear transformation weight matrix after concatenating multiple causal attention matrices; Concat is the concatenation of multiple Attention results.
[0087] 4) After the multi-head causal attention mechanism calculates, the transformer cost prediction sample of the power transmission and transformation project enters a fully connected feedforward neural network layer for calculation, and then the output is:
[0088] F FN (Z) = max(0,ZW1+b1)W2+b2
[0089] Where: b1, b2 represent bias.
[0090] 5) Encode the two sub-layers of multi-head causal attention and feedforward neural network, use residual connection for normalization operation, and then obtain the transformer cost prediction result of power transmission and transformation project:
[0091]
[0092] Where: s Out is the transformer cost of the power transmission and transformation project in the sample; LN is layer normalization; u L , are the mean and variance respectively; α and β represent the gain and bias respectively; ε is the adjustment parameter.
[0093] When using the test sample for validation, the root mean square error or mean absolute error is used to measure the accuracy of the prediction;
[0094] The root mean square error RMSE is expressed as:
[0095]
[0096] The mean absolute percentage error MAPE is expressed as:
[0097]
[0098] Where: Y i is the actual value, is the predicted value, and n is the predicted number.
[0099] For example, this embodiment predicts the cost of transformers for power transmission and transformation projects in a certain area, uses the preprocessed historical three-phase data of the cost of transformers for power transmission and transformation projects as the input variable of the improved transformer model, and uses the current cost of transformers for power transmission and transformation projects as the output variable, and uses Python software for programming and calculation.
[0100] The parameters of the improved transformer model are set as follows: the number of multiple heads is 4, the dimension d is 64, the number of nodes in the fully connected layer is 128, the number of neurons in the hidden layer is 512, and the dropout is 0.2. 100 data groups are used as training samples to train the improved transformer model, and the optimal parameter values of the improved transformer model for the transformer cost of power transmission and transformation projects are obtained. The data set is divided by the k-fold cross-validation method, and the first 35 data are selected as the training set, and the last 5 data groups are selected as the test set.
[0101] In order to prove the accuracy of the improved transformer model prediction, the improved transformer model, linear regression and grey prediction models are used to predict the transformer cost of power transmission and transformation projects. Figure 2 shown.
[0102] according to Figure 2 The prediction results are calculated, and the root mean square error RMSE and mean absolute percentage error MAPE of the improved transformer model, linear regression model, and grey prediction model are calculated respectively. The root mean square error RMSE and mean absolute percentage error MAPE predicted by the improved transformer model are 1349.25% and 1.43% respectively, the root mean square error RMSE and mean absolute percentage error MAPE predicted by the linear regression model are 2485.88% and 2.60% respectively, and the root mean square error RMSE and mean absolute percentage error MAPE predicted by the grey prediction model are 2482.94 and 2.31% respectively.
[0103] This shows that the transformer model improved by multi-head causal attention and feedforward neural network has higher prediction accuracy. As a new intelligent machine learning algorithm, the transformer model has great application potential in the cost prediction of transformers in power transmission and transformation projects.
[0104] It should be understood by those skilled in the art that the embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention 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.
[0105] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. 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.
[0106] 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.
[0107] 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.
[0108] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0109] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A method for predicting transformer cost for power transmission and transformation projects based on an improved transformer model, characterized in that: include: Obtain a cost prediction model for a transformer for a power transmission and transformation project, wherein the input variable of the cost prediction model for a transformer for a power transmission and transformation project is the cost of the transformer for a power transmission and transformation project during the period to be tested, and the cost of the transformer for a power transmission and transformation project during the period to be predicted is used as the output variable of the cost prediction model for a transformer for a power transmission and transformation project; Collecting first data corresponding to the cost of transformers for power transmission and transformation projects in a historical time series, wherein the first data includes a related historical series and a historical price time series; Processing the first data to generate a sample set, and dividing the samples in the sample set into training samples and test samples; Using training samples to train the improved transformer model; The trained improved transformer model is tested using test samples to obtain a trained transformer cost prediction model for power transmission and transformation projects.
2. The method for predicting transformer cost for power transmission and transformation projects based on the improved transformer model according to claim 1, characterized in that: The transformer cost prediction model for power transmission and transformation projects is obtained by training an improved transformer model based on the first data.
3. The method for predicting transformer cost for power transmission and transformation projects based on the improved transformer model as claimed in claim 1, characterized in that: The relevant historical series include transformer cost data of the previous phase, the previous two phases and the previous three phases of power transmission and transformation projects.
4. The method for predicting transformer cost for power transmission and transformation projects based on the improved transformer model according to claim 1, characterized in that: The data processing performed on the first data includes normalization processing, data smoothing processing and data set division processing.
5. The method for predicting transformer cost for power transmission and transformation projects based on the improved transformer model as claimed in claim 4, characterized in that: The data smoothing process uses a linear smoothing filter, including a Savitzky-Golay filter and a simple moving average.
6. The method for predicting transformer cost for power transmission and transformation projects based on the improved transformer model as claimed in claim 1, characterized in that: The data set partitioning process adopts K-fold cross validation method.
7. The method for predicting transformer cost for power transmission and transformation projects based on the improved transformer model as claimed in claim 4, characterized in that: The method of training the improved transformer model using the training samples includes: Select a transformer model that is appropriate for the task; The pre-processed transformer cost data of the previous, second and third phases of power transmission and transformation projects are passed to the model as input variables; The current transformer cost data of power transmission and transformation projects is used as the output variable; The model is used to predict the transformer cost of power transmission and transformation projects, and a trained improved transformer model is obtained.
8. The method for predicting transformer cost for power transmission and transformation projects based on the improved transformer model as claimed in claim 1, characterized in that: When the trained improved transformer model is tested using the test sample, a root mean square error or a mean absolute error is used.
9. A device for predicting transformer cost for power transmission and transformation projects based on an improved transformer model, characterized in that: It includes a storage medium, which retains the transformer cost data of power transmission and transformation projects in historical periods and all current transformer cost forecast data of power transmission and transformation projects. The first data of the current forecast data sequence is recursively compared with the historical cost forecast data in the storage medium.
10. Transformer cost prediction equipment for power transmission and transformation projects based on improved transformer model, characterized by: include: A data collection unit, used to collect first data corresponding to the cost of transformers for power transmission and transformation projects in a historical time series, wherein the first data includes a related historical series and a historical price time series; A data processing unit, used to perform data processing on the first data, generate a sample set, and divide the samples in the sample set into training samples and test samples; A model training unit, which trains the improved transformer model using training samples; The model testing unit uses the test samples to test the trained improved transformer model to obtain the trained transformer cost prediction model for power transmission and transformation projects; The prediction model unit uses the power transmission and transformation project transformer cost prediction model to predict the power transmission and transformation project transformer cost in the historical period and obtain the current power transmission and transformation project transformer cost.
