Building cost element price prediction method based on PSO-CNN-LSTM-ATT combination model

By combining the combined model of PSO, CNN, LSTM and attention mechanism, the problem of insufficient accuracy and robustness in traditional methods when processing complex time series data is solved, and more efficient construction resource price prediction is achieved.

CN119991167APending Publication Date: 2025-05-13CITY COLLEGE OF DALIAN UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411963121.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

Traditional building resource price prediction methods are difficult to effectively capture nonlinear relationships in complex, multi-dimensional time series data, and the prediction accuracy and model robustness are insufficient in multi-factor complex environments.

Method used

The method based on the PSO-CNN-LSTM-ATT combination model is adopted to extract the local features of price data through convolutional neural networks, model the timing dependence of prices in long and short-term memory networks, and combine the attention mechanism to improve attention to key time steps. Finally, the particle swarm optimization algorithm is used to optimize the model hyperparameters.

Benefits of technology

It significantly improves the accuracy of building resource price prediction and the robustness of the model, can more effectively process complex multi-dimensional time series data, adapt to data sets of different sizes and complexities, and maintain high predictive performance in the face of market volatility and policy changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119991167A_ABST
    Figure CN119991167A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of building cost, and discloses a building cost element price prediction method based on a PSO-CNN-LSTM-ATT combined model, and the method combines the feature extraction capability of a convolutional neural network, the time sequence analysis capability of a long and short-term memory network and the key information focusing capability of an attention mechanism. And optimizing hyper-parameters of the model through a particle swarm optimization algorithm. The model can efficiently and accurately predict future prices of building materials, labor force and mechanical cost, and is especially suitable for a long-term price prediction scene. Experimental results show that compared with a traditional method, the model is remarkably improved in the aspects of prediction precision and robustness. The method can be widely applied to cost management and material management of engineering projects, and provides powerful support for scientific decision making.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of construction cost, and in particular to a method for predicting prices of construction cost elements based on a PSO-CNN-LSTM-ATT combined model. Background Art

[0002] In construction project management, accurate prediction of price fluctuations of key resources is essential to achieve effective cost control and management of projects. However, traditional forecasting methods have obvious limitations when dealing with complex, multi-dimensional time series data, and it is difficult to capture nonlinear relationships. These methods usually rely on simple statistical models or rules, which cannot fully reflect the dynamic impact of market fluctuations, policy changes and other influencing factors on prices.

[0003] With the rapid development of deep learning technology, researchers have gradually realized that using complex algorithm models can better cope with this challenge. In particular, the application of convolutional neural networks (CNN) and long short-term memory networks (LSTM) in time series prediction has provided new ideas for solving the problem of building resource price prediction. However, although these models can capture the temporal characteristics and local features of some data, they still face the problem of how to improve prediction accuracy and model robustness in a complex environment with multiple factors.

[0004] In order to further improve the prediction performance, the researchers introduced the attention mechanism (ATT), which enables the model to focus on the key time points and features that affect the results, thereby improving the prediction effect. At the same time, the particle swarm optimization algorithm (PSO) is also used to optimize the hyperparameter settings of the deep learning model, further enhancing the accuracy and stability of the model.

[0005] Although existing studies have improved the performance of prediction models to varying degrees, how to more effectively combine CNN, LSTM, ATT and PSO algorithms to develop a model that can comprehensively improve the accuracy of construction resource price prediction is still an important topic in the current research field. This invention is proposed in this context, aiming to provide an efficient and reliable price prediction method for construction project management to cope with the increasingly complex market environment and dynamically changing cost factors. Summary of the invention

[0006] 1. Technical issues to be resolved

[0007] The present invention provides a price prediction method for construction cost factors based on the PSO-CNN-LSTM-ATT combined model, aiming to achieve accurate prediction of construction material, labor and machinery prices by combining deep learning models with optimization algorithms. The method uses convolutional neural networks for feature extraction, long short-term memory networks for time series modeling, and combines attention mechanisms to increase the focus on key time steps. Finally, the particle swarm optimization algorithm is used to optimize the model's hyperparameters to further improve the prediction accuracy and model robustness.

[0008] (II) Technical solution

[0009] To achieve the above technical objectives, the present invention provides the following technical solutions: a method for predicting the price of construction cost elements based on the PSO-CNN-LSTM-ATT combined model, comprising the following steps:

[0010] Step 1: Obtain historical building materials, labor, and machinery price data to construct a multidimensional dataset;

[0011] Step 2: Use convolutional neural networks to extract local features from price data and identify trends and cyclical changes in the data;

[0012] Step 3: Input the extracted local features into the long short-term memory network to model the temporal dependency of prices;

[0013] Step 4: Introduce the attention mechanism to highlight the time points that have a significant impact on price changes by assigning weights to different time steps;

[0014] Step 5: Use the particle swarm optimization algorithm to optimize the hyperparameters of the convolutional neural network, long short-term memory network, and attention mechanism model to obtain the optimal hyperparameter configuration;

[0015] Step 6. Apply the optimized PSO-CNN-LSTM-ATT model to historical data to predict the price fluctuations of future construction cost factors.

[0016] Preferably, the step 1 includes the following steps:

[0017] A1. Use K-nearest neighbor interpolation to process missing values ​​in the data. Use the KNN algorithm to find the nearest neighbor points to the missing values, and use the known values ​​of these neighbors to interpolate the missing data.

[0018] A2. Detect and process abnormal data through the Isolation Forest algorithm;

[0019] A3. Use the maximum and minimum value normalization method to map the data to the interval of 0 and 1 to ensure that the dimensions of different features are consistent. The calculation formula is as follows:

[0020]

[0021] Among them, x is the historical price data, min is the minimum value of the historical price in the data set, and max is the maximum value of the historical price in the data set.

[0022] Preferably, in step 2, the normalized price time series is input into a convolutional neural network model. The convolutional neural network model extracts local features in the data through a convolution operation to capture trends and periodic patterns in price changes. The formula for the convolution operation is as follows:

[0023]

[0024] Among them, O i is the i-th element in the output feature sequence, F U is the weight of the convolution kernel at position U, I i+u is the value of the input time series at position i+u, b is the bias term, m is the size of the convolution kernel, that is, the number of elements in the convolution kernel, and u is the position of the element in the convolution kernel;

[0025] The convolutional layer is followed by a maximum pooling layer for dimensionality reduction to reduce computational complexity and retain key features.

[0026] Preferably, in step 3, the features extracted by the convolutional neural network model are transferred to the long short-term memory network model for time series modeling. The long short-term memory network model processes the long-term dependencies in the data through its gating mechanism and effectively captures the key patterns in price changes. The calculation process of the long short-term memory network model includes the state update of the forget gate, the input gate and the output gate. The specific formula is as follows:

[0027] f t =σ(W fx x t +W fh h t-1 +b f )

[0028] i t =σ(W ix x t +W ih h t-1 +b i )

[0029]

[0030] o t =σ(W ox x t +W oh h t-1 +bo )

[0031] S t =g t ⊙i t +S t-1 ⊙f t

[0032]

[0033] Among them, f t For the forget gate, i t is the input gate, g t is the input node, o t is the output gate, S t is the intermediate output, h t is the state of the state unit, W fx , W fh , W ix , W ih , W gx , W gh , W ox , W oh are the corresponding gates and input x t and intermediate output h t-1 The matrix weights to be multiplied, b f , b i , b g , b o are the bias terms of the corresponding gates, ⊙ represents the bitwise multiplication of the elements in the vector, σ represents the change of the sigmoid function, Indicates the change of tanh function.

[0034] Preferably, in step 4, an attention mechanism is introduced based on the long short-term memory network model, and the implementation steps of the attention mechanism are as follows:

[0035] B1. Calculate the weight coefficient, that is, calculate the attention distribution of all input values;

[0036] B2. Perform weighted summation on the weight coefficients, that is, calculate the weighted average of the input information of a single output value.

[0037] Preferably, in step five, the particle swarm optimization algorithm randomly searches a number of particles in the search space, and each particle gradually searches for the global optimal solution through its speed and position in an iterative process, and the optimization process includes particle initialization, fitness evaluation and update operations.

[0038] Preferably, the initialization of the particles sets the key parameters of the particle swarm optimization, including the number of iterations NGEN, the population size N, and the constraint range of the variables. The parameters are set as: NGEN=50, N=20, and the upper and lower bounds of the hyperparameters are:

[0039] C1. The lower bound of the number of LSTM network units is 100 and the upper bound is 500;

[0040] C2, the lower bound of the convolution kernel size is 3, and the upper bound is 10;

[0041] C3, the lower bound of the learning rate is 0.001 and the upper bound is 0.01;

[0042] The initial position and velocity of the particle are randomly distributed within the defined upper and lower bounds. The position initialization formula is:

[0043]

[0044] in, is the position of the zth particle in the dth dimension, r1 is a random number, is the minimum value of this dimension, is the maximum value of this dimension.

[0045] Preferably, the fitness evaluation and update operations include fitness evaluation, speed update, position update, boundary check, iteration and optimization, and final model training;

[0046] The fitness evaluation calculates the position fitness of each particle through a fitness function;

[0047] The velocity update, i.e. the velocity of each particle, is based on its historical best position p best and the global optimal position g best Update, the speed update formula is:

[0048]

[0049] in, is the velocity of the i+1th generation particle, w is the inertia weight, c1 and c2 are learning factors, which respectively indicate the degree to which the particle is affected by its own experience, and r1 and r2 are random numbers;

[0050] The update formula for the location update is:

[0051]

[0052] in, is the position of the particle of the i+1th generation in the dth dimension;

[0053] The boundary check ensures that the particle position remains within the predefined search space. If it is out of range, the particle position is restricted to the boundary. The formula is:

[0054]

[0055] in, and are the minimum and maximum values ​​of the dth dimension respectively;

[0056] The iteration and optimization are performed through continuous iteration of the particle swarm optimization algorithm, each time updating the speed and position of the particle, and gradually searching for the optimal hyperparameter combination. At the end of each round of iteration, the fitness function is used to evaluate the performance of the current particle. If the fitness value is improved compared to the previous global optimal position, gbes is updated. t ;

[0057] After finding the optimal hyperparameter combination, the final model training uses the hyperparameter configuration to perform final training on the CNN-LSTM-ATT model. The specific configuration is as follows:

[0058] Number of LSTM cells: 300

[0059] Convolution kernel size: 5

[0060] Learning rate: 0.001.

[0061] Preferably, the CNN-LSTM-ATT model after hyperparameter optimization and model training in step 6 predicts the test set data, and performs denormalization on the prediction results, which includes loading the best model, model prediction output, denormalization and prediction result evaluation;

[0062] The loading of the best model saves the model weight with the best performance on the validation set during the training process;

[0063] The model predicts output using the test set input data X test Perform model prediction and obtain normalized prediction results

[0064] The denormalization process converts the model prediction results into the original data scale by using the minimum-maximum denormalization formula to convert the normalized prediction values Restore to actual forecast value Its expression is as follows:

[0065]

[0066] Among them, max and min are the maximum and minimum values ​​of historical data respectively. is the actual predicted value after denormalization;

[0067] The prediction result evaluation uses root mean square error, mean square error, mean absolute error, coefficient of determination and mean absolute percentage error to comprehensively analyze the performance of the model in predicting the price of labor, materials and machinery;

[0068] The root mean square error is the square root of the mean of the sum of squares of the differences between the predicted value and the actual value, and its expression is as follows:

[0069]

[0070] Where yi is the actual value, is the predicted value, n is the number of samples, and RMSE is the root mean square error;

[0071] The mean square error is the mean of the sum of squares of the differences between the predicted value and the actual value, and its expression is as follows:

[0072]

[0073] Among them, MSE is the mean square error;

[0074] The mean absolute error is the mean of the absolute values ​​of the differences between the predicted values ​​and the actual values, and its expression is as follows:

[0075]

[0076] Among them, MAE is the mean absolute error;

[0077] The determination coefficient represents the degree of fit between the model prediction value and the actual value, and its value range is between 0 and 1. Its expression is as follows:

[0078]

[0079] Among them, R 2 is the coefficient of determination, is the mean of the actual values;

[0080] The mean absolute percentage error is the average of the absolute value of the difference between the predicted value and the actual value as a percentage of the actual value. It represents the proportion of the error to the actual value, and its expression is as follows:

[0081]

[0082] Where MAPE is the mean absolute percentage error.

[0083] Preferably, the price prediction objects include construction cost elements of rebar, concrete, ordinary workers and mechanical equipment.

[0084] Compared with the prior art, the present invention provides a method for predicting the price of construction cost elements based on the PSO-CNN-LSTM-ATT combined model, which has the following beneficial effects:

[0085] 1. By combining the feature extraction capability of convolutional neural networks, the temporal characteristics capture capability of long short-term memory networks, and the key information focusing capability of attention mechanisms, the present invention can more comprehensively process complex multi-dimensional time series data and capture important features and trends in price fluctuations. Compared with traditional statistical methods and single algorithm models, the prediction accuracy of the present invention is significantly improved.

[0086] 2. The present invention uses the particle swarm optimization algorithm to intelligently optimize the model's hyperparameters, so that the model can adapt to data sets of different sizes and complexities. The PSO algorithm avoids the defect of traditional hyperparameter tuning methods that are prone to falling into local optimality, improves the model's global optimal search capability, and ensures that the model maintains good prediction performance in different application scenarios.

[0087] 3. By introducing the attention mechanism, the model can automatically identify the key time points and features that have a greater impact on the prediction results, avoiding the weaknesses of traditional models in dealing with nonlinearity and multi-factor interactions. This method can still maintain a high level of prediction robustness when facing external factors such as market fluctuations and policy changes.

[0088] 4. The introduction of the particle swarm optimization algorithm not only improves the prediction accuracy of the model, but also effectively reduces the time cost of model tuning. Compared with grid search and random search, the particle swarm optimization algorithm can find the optimal hyperparameter configuration in a shorter time, thereby reducing the model training time and improving computing efficiency.

[0089] 5. The present invention is suitable for price forecasting in the construction industry, and has broad application prospects in the fields of dynamic cost management, material procurement, bidding strategy formulation, etc. In addition, due to its ability to process multidimensional time series data, the present invention can also be extended to other fields that require price forecasting, such as financial markets, energy industries, etc. BRIEF DESCRIPTION OF THE DRAWINGS

[0090] Figure 1 It is a schematic diagram of the process steps of the present invention;

[0091] Figure 2 This is a schematic diagram of the basic unit of the LSTM network of the present invention;

[0092] Figure 3 This is a schematic diagram of the CNN-LSTM neural network structure of the present invention;

[0093] Figure 4 This is a schematic diagram of the network structure of the attention mechanism of the present invention;

[0094] Figure 5 This is a schematic diagram of the network structure diagram of the CNN-LSTM-Attention model of the present invention. DETAILED DESCRIPTION

[0095] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0096] The present invention provides a price prediction method for construction cost factors based on a PSO-CNN-LSTM-ATT combined model, aiming to achieve accurate prediction of the prices of construction materials, labor and machinery by combining a deep learning model with an optimization algorithm. The method adopts a convolutional neural network (CNN) for feature extraction, a long short-term memory network (LSTM) for time series modeling, and combines an attention mechanism (ATT) to improve the focus on key time steps. Finally, a particle swarm optimization algorithm (PSO) is used to optimize the hyperparameters of the model to further improve the prediction accuracy and model robustness.

[0097] See also Figure 1 ,A construction cost factor price prediction method based on the PSO-CNN-LSTM-ATT combination model, includes the following steps:

[0098] Step 1: Obtain historical building materials, labor and machinery price data to construct a multi-dimensional data set. To ensure the integrity and accuracy of the data, the present invention performs the following processing on the data set:

[0099] (1) Missing data processing

[0100] The K-nearest neighbor (KNN) interpolation method is used to process the missing values ​​in the data. The specific method is to find the neighbor points closest to the missing values ​​through the KNN algorithm (K=3), and use the known values ​​of these neighbors to interpolate the missing data, thereby ensuring the continuity and integrity of the data.

[0101] The specific implementation method is as follows:

[0102] Assume we have a set of known data points (x i ,y i ), where i = 1, 2, ..., n, we want to estimate the value y0 of a new point x0, the steps of KNN interpolation can be expressed as:

[0103] 1. Find the nearest neighbor

[0104] For each x0, find the K nearest neighbors

[0105] 2. Calculate the weight (usually use the inverse of the distance as the weight)

[0106]

[0107] in, is x0 and The distance between

[0108] 3. Weighted average

[0109]

[0110] (2) Abnormal data processing

[0111] Abnormal data is detected and processed through the Isolation Forest algorithm. The algorithm uses 100 decision trees to identify anomalies in the data. The anomalies are marked and removed, and only normal data is retained for subsequent analysis and model training. The steps are as follows:

[0112] Step 1: Outlier Detection

[0113] Build 100 decision trees, each of which is trained on a randomly selected subset of samples from the entire dataset;

[0114] For each tree, a feature and a split point are randomly selected to divide the data into two parts, and the two parts of the data are recursively split until the stopping condition is met (for example, the number of data points in the node is less than a preset value or the maximum depth of the tree is reached);

[0115] Calculate the path length of each data point in all trees, that is, the number of splits required from the root node to the node where the point is isolated.

[0116] Step 2: Outlier Marking

[0117] Based on the calculated path length, an anomaly score is assigned to each data point. The anomaly score can be calculated based on the inverse of the path length, that is:

[0118]

[0119] Here, h(x) is the average path length of data point x in all trees.

[0120] Step 3: Remove outliers

[0121] Set an anomaly score threshold, mark the data points with anomaly scores exceeding the threshold as outliers, and remove them from the dataset.

[0122] Step 4, normal data retention

[0123] After removing the outliers, the remaining data points are identified as normal data, which will be retained for subsequent analysis and model training.

[0124] (3) Normalization

[0125] Use the maximum and minimum normalization method to map the data to the interval of 0 and 1 to ensure the consistency of dimensions between different features and prevent uneven weights during model training. The normalization formula is as follows:

[0126]

[0127] Among them, x is the historical price data, min is the minimum value of the historical price in the data set, and max is the maximum value of the historical price in the data set.

[0128] Step 2: Use convolutional neural networks to extract local features in price data, identify trends and periodic changes in the data, and input the normalized price time series into the convolutional neural network (CNN) model. CNN extracts local features in data through convolution operations, capturing trends and periodic patterns in price changes. The formula for the convolution operation is as follows:

[0129]

[0130] Among them, O i is the i-th element in the output feature sequence, F U is the weight of the convolution kernel at position U, I i+u is the value of the input time series at position i+u, b is the bias term, m is the size of the convolution kernel, that is, the number of elements in the convolution kernel, and u is the position of the element in the convolution kernel;

[0131] The convolutional layer is followed by a maximum pooling layer for dimensionality reduction to reduce computational complexity and retain key features.

[0132] The main purpose of the max pooling layer is to reduce the spatial dimension of the feature map. It works by extracting the maximum value from non-overlapping sub-regions in the feature map extracted by the convolutional layer. For example, a 2×2 max pooling operation will consider each 2×2 block and only pass the maximum value in each block. The max pooling layer not only reduces the amount of data that subsequent layers need to process, thereby reducing the computational burden, but also enhances the model's robustness to small changes and distortions in the input data. In this way, the network is able to remove unnecessary details while retaining key information. The benefit of doing so is that the spatial size of the data is reduced, thereby reducing the number of parameters and computational complexity.

[0133] Step 3: Refer to Figure 2 , the extracted local features are input into the long short-term memory network to model the temporal dependency of prices, and the features extracted by CNN are passed to the LSTM model for temporal modeling. LSTM processes the long-term dependency in the data through its gating mechanism and effectively captures the key patterns in price changes. The calculation process of LSTM includes the state update of the forget gate, input gate, and output gate. The specific formula is as follows:

[0134] f t =σ(W fx x t +W fh h t-1 +b f )

[0135] i t =σ(W ix x t +W ih h t-1 +b i )

[0136]

[0137] o t =σ(W ox x t +W oh h t-1 +b o )

[0138] S t =g t ⊙i t +S t-1 ⊙f t

[0139]

[0140] Among them, f t For the forget gate, i t is the input gate, g t is the input node, o t is the output gate, S t is the intermediate output, h t is the state of the state unit, W fx , W fh , W ix , W ih , W gx , W gh , W ox , W oh are the corresponding gates and input x t and intermediate output h t-1 The matrix weights to be multiplied, b f 、bi 、b g 、b o are the bias terms of the corresponding gates, ⊙ represents the bitwise multiplication of the elements in the vector, σ represents the change of the sigmoid function, Indicates the change of tanh function.

[0141] See also Figure 3 The architecture of the CNN-LSTM model is an innovative hybrid network structure in time series data analysis, which combines the feature extraction function of convolutional neural networks (CNN) with the sequence processing ability of long short-term memory networks (LSTM). The entire CNN-LSTM structure combines the powerful spatial feature extraction ability of CNN and the time series analysis ability of LSTM, enabling the model to simultaneously process the spatial and temporal dimensions in time series data.

[0142] Step 4: Introduce the attention mechanism, and highlight the time points that have a significant impact on price changes by assigning weights to different time steps: Introduce the attention mechanism based on the LSTM layer to highlight the key time points in historical data that have the greatest impact on future predictions. The implementation steps of the attention mechanism are as follows: First, calculate the weight coefficient, that is, calculate the attention distribution of all input values; second, perform weighted summation on the weight coefficient, that is, calculate the weighted average of the input information of a single output value. Its general structure is as follows: Figure 4 As shown, in Figure 4 In the equation, x1,...,x n is the input value; q is the query vector of the neural network; a1,...,a n is the attention distribution of all input values ​​of the query vector; s is the score function of the attention.

[0143] The attention score function can be expressed as:

[0144]

[0145] Where W is the autonomous learning parameter of the neural network; i is the i-th item among all input values.

[0146] Taking the softmax function value of the attention score function formula, we can get the input value x i Attention Divisiona i , which can be expressed as:

[0147] a i =softmax(s(x i ,q))

[0148] The weighted average a of all input values ​​and their attention distribution can be expressed as

[0149] The present invention introduces the attention mechanism (Attention), the purpose of which is to enable the model to identify and focus on specific time points that have a significant impact on the prediction results. The CNN-LSTM deep neural network structure with the attention mechanism is introduced as follows Figure 5 shown.

[0150] Step 5. Use the particle swarm optimization algorithm to optimize the hyperparameters of the convolutional neural network, long short-term memory network and attention mechanism model to obtain the optimal hyperparameter configuration: In order to improve the performance of the model, the present invention uses the particle swarm optimization (PSO) algorithm to optimize the hyperparameters of the model. PSO simulates the behavior of the particle group in the search space to find the optimal solution and finally achieve the optimal configuration of the hyperparameters. The basic idea of ​​the PSO algorithm is to randomly search a group of particles in the search space, and each particle gradually approaches the global optimal solution through its speed and position in the iterative process. The PSO optimization process involves particle initialization, fitness evaluation, speed and position update operations.

[0151] 1. Initialization and particle swarm settings

[0152] The initialization of particle swarm optimization is a key step to ensure the success of the algorithm. In the initialization stage, the position and velocity of the particles are set, and the initial optimal position p of each particle is determined. best and the global best position gbest. Reasonable initialization can improve the diversity and global search ability of the particle swarm.

[0153] Initialization steps:

[0154] Parameter definition: Set the key parameters of PSO, including the number of iterations NGEN, the population size N, and the constraint range of the variables. In the present invention, the parameters are set as: NGEN = 50, N = 20, and the upper and lower bounds of the hyperparameters are:

[0155] (1) The lower bound of the number of LSTM units is 100 and the upper bound is 500.

[0156] (2) The lower bound of the convolution kernel size is 3 and the upper bound is 10.

[0157] (3) The lower bound of the learning rate is 0.001 and the upper bound is 0.01.

[0158] The initial position and velocity of the particle are randomly distributed within the defined upper and lower bounds. The position initialization formula is:

[0159]

[0160] in, is the position of the ith particle in the dth dimension, r1 is a random number, and are the minimum and maximum values ​​of this dimension respectively.

[0161] 2. Fitness evaluation and update operations

[0162] The core of the PSO algorithm is to update the speed and position of each particle so that the particle gradually moves toward the global optimal solution. This process involves fitness evaluation and update operations.

[0163] (1) Fitness evaluation: The position fitness of each particle is calculated through the fitness function. In this study, fitness evaluation is based on the model's loss function (e.g., mean square error or cross entropy loss) to measure the performance of the particle's hyperparameter settings in model training.

[0164] (2) Velocity update: The velocity of each particle is based on its historical best position p best and the global optimal position g best Update. The speed update formula is:

[0165]

[0166] in, is the speed of the i+1 generation particle, w is the inertia weight, which controls the influence of the previous speed on the current speed; c1 and c2 are learning factors, which respectively indicate the degree to which the particle is affected by its own experience, and r1 and r2 are random numbers;

[0167] (3) Position update: According to the updated velocity, the particle's position is also updated. The position update formula is:

[0168]

[0169] in, is the position of the i+1th generation particle in the dth dimension.

[0170] (4) Boundary check: Ensure that the particle position remains within the predefined search space. If it exceeds the range, the particle position is restricted to the boundary. The formula is:

[0171]

[0172] in, and are the minimum and maximum values ​​of the dth dimension respectively.

[0173] Through these steps, the PSO algorithm can gradually find the parameter settings that optimize the model prediction performance in the hyperparameter search space.

[0174] (5) Iteration and optimization: The PSO algorithm continuously iterates, updating the particle speed and position each time, and gradually searching for the optimal hyperparameter combination. At the end of each iteration, the fitness function is used to evaluate the performance of the current particle. If the fitness value is improved compared to the previous global optimal position, g is updated. best .

[0175] The PSO algorithm of the present invention performs 50 iterations (ie, NGEN=50) until the hyperparameters converge or a preset number of iterations is reached.

[0176] (6) Final model training

[0177] After finding the optimal hyperparameter combination, use this hyperparameter configuration to perform final training on the CNN-LSTM-ATT model. The specific configuration is as follows:

[0178] Number of LSTM cells: 300

[0179] Convolution kernel size: 5

[0180] Learning rate: 0.001

[0181] The model was optimized using the above method on the training set, and its prediction performance was verified on the test set.

[0182] Through the PSO algorithm optimization method of the present invention, the optimal hyperparameter combination of the CNN-LSTM-ATT model can be found in the efficient search space. Compared with traditional grid search and random search, PSO significantly reduces the computational cost and improves the prediction accuracy of the model.

[0183] Step 6. Apply the optimized PSO-CNN-LSTM-ATT model to historical data to predict the price fluctuations of future construction cost factors.

[0184] After hyperparameter optimization and model training, the CNN-LSTM-ATT model predicts the test set data and denormalizes the prediction results for comparison and analysis with the original data. The process includes loading the best model, predicting output, denormalizing, and evaluating the prediction results.

[0185] (1) Load the best model: During the training process, save the model weights with the best performance on the validation set. Load these best weights during the prediction phase to ensure that the model's prediction results are optimal.

[0186] (2) Model prediction output: Use the test set input data X test Perform model prediction and obtain normalized prediction results

[0187] (3) Denormalization

[0188] In order to convert the model prediction results to the original data scale, the normalized prediction values ​​are converted to Restore to actual forecast value

[0189]

[0190] Among them, max and min are the maximum and minimum values ​​of historical data respectively. is the actual predicted value after denormalization.

[0191] (4) Evaluation of prediction results

[0192] In order to evaluate the prediction effect of the model, the root mean square error (RMSE), mean square error (MSE), mean absolute error (MAE), and determination coefficient (R 2 ) and mean absolute percentage error (MAPE) are used to comprehensively analyze the performance of the model in predicting the prices of labor, materials and machinery.

[0193] ① Root mean square error (RMSE)

[0194] RMSE is the square root of the mean of the sum of the squares of the differences between the predicted values ​​and the actual values. It is more sensitive to large errors and therefore reflects large errors in the model's predictions. The formula is as follows:

[0195]

[0196] Among them, y i is the actual value, is the predicted value, and n is the number of samples.

[0197] ② Mean Square Error (MSE)

[0198] MSE is the mean of the sum of squares of the differences between the predicted and actual values. It is similar to RMSE, but does not take a square root. MSE is also more sensitive to large errors. The formula is as follows:

[0199]

[0200] ③ Mean absolute error (MAE)

[0201] MAE is the mean of the absolute values ​​of the differences between the predicted values ​​and the actual values. Compared to RMSE and MSE, MAE is insensitive to large errors and can therefore provide a smoother error measure. The formula is as follows:

[0202]

[0203] ④ Coefficient of determination (R 2 )

[0204] R 2 Indicates the degree of fit between the model prediction value and the actual value. Its value range is between 0 and 1. The closer the value is to 1, the better the model fit is. The formula is as follows:

[0205]

[0206] in, is the mean of the actual values.

[0207] ⑤ Mean absolute percentage error (MAPE)

[0208] MAPE is the mean of the absolute value of the difference between the predicted value and the actual value as a percentage of the actual value. It represents the proportion of the error relative to the actual value, which is conducive to the error comparison between data of different scales. The formula is as follows:

[0209]

[0210] By integrating a variety of advanced technologies and optimization algorithms, the present invention successfully improves the prediction accuracy of construction cost factor prices and the stability of the model, overcomes the shortcomings of the existing technology, and provides an effective decision support tool for construction project management and other price forecasting fields.

[0211] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A method for predicting construction cost factor prices based on a PSO-CNN-LSTM-ATT combined model, characterized in that: The following steps are involved: Step 1: Obtain historical building materials, labor, and machinery price data to construct a multidimensional dataset; Step 2: Use convolutional neural networks to extract local features from price data and identify trends and cyclical changes in the data; Step 3: Input the extracted local features into the long short-term memory network to model the temporal dependency of prices; Step 4: Introduce the attention mechanism to highlight the time points that have a significant impact on price changes by assigning weights to different time steps; Step 5: Use the particle swarm optimization algorithm to optimize the hyperparameters of the convolutional neural network, long short-term memory network, and attention mechanism model to obtain the optimal hyperparameter configuration; Step 6. Apply the optimized PSO-CNN-LSTM-ATT model to historical data to predict the price fluctuations of future construction cost factors.

2. A method for predicting construction cost factor prices based on a PSO-CNN-LSTM-ATT combined model according to claim 1, characterized in that: The step one includes the following steps: A1. Use K-nearest neighbor interpolation to process missing values ​​in the data. Use the KNN algorithm to find the nearest neighbor points to the missing values, and use the known values ​​of these neighbors to interpolate the missing data. A2. Detect and process abnormal data through the Isolation Forest algorithm; A3. Use the maximum and minimum value normalization method to map the data to the interval of 0 and 1 to ensure that the dimensions of different features are consistent. The calculation formula is as follows: Among them, x is the historical price data, min is the minimum value of the historical price in the data set, and max is the maximum value of the historical price in the data set.

3. The method for predicting construction cost factor prices based on the PSO-CNN-LSTM-ATT combined model according to claim 1 is characterized in that: In the step 2, the normalized price time series is input into the convolutional neural network model. The convolutional neural network model extracts local features in the data through convolution operations to capture trends and periodic patterns in price changes. The formula for the convolution operation is as follows: Among them, O i is the i-th element in the output feature sequence, F U is the weight of the convolution kernel at position U, I i+u is the value of the input time series at position i+u, b is the bias term, m is the size of the convolution kernel, that is, the number of elements in the convolution kernel, and u is the position of the element in the convolution kernel; The convolutional layer is followed by a maximum pooling layer for dimensionality reduction to reduce computational complexity and retain key features.

4. The method for predicting construction cost factor prices based on the PSO-CNN-LSTM-ATT combined model according to claim 1 is characterized in that: In step 3, the features extracted by the convolutional neural network model are transferred to the long short-term memory network model for time series modeling. The long short-term memory network model processes the long-term dependencies in the data through its gating mechanism and effectively captures the key patterns in price changes. The calculation process of the long short-term memory network model includes the state update of the forget gate, input gate and output gate. The specific formula is as follows: f t =σ(W fx x t +W fh h t-1 +b f ) i t =σ(W ix x t +W ih h t-1 +b i ) o t =σ(W ox x t +W oh h t-1 +b o ) S t =g t ⊙i t +S t-1 ⊙f t Among them, f t For the forget gate, i t is the input gate, g t is the input node, o t is the output gate, S t is the intermediate output, h t is the state of the state unit, W fx , W fh , W ix , W ih , W gx , W gh , W ox , W oh are the corresponding gates and input x t and intermediate output h t-1 The matrix weights to be multiplied, b f , b i , b g , b o are the bias terms of the corresponding gates, ⊙ represents the bitwise multiplication of the elements in the vector, σ represents the change of the sigmoid function, Indicates the change of tanh function.

5. The method for predicting construction cost factor prices based on the PSO-CNN-LSTM-ATT combined model according to claim 1 is characterized in that: In step 4, an attention mechanism is introduced based on the long short-term memory network model. The implementation steps of the attention mechanism are as follows: B1. Calculate the weight coefficient, that is, calculate the attention distribution of all input values; B2. Perform weighted summation on the weight coefficients, that is, calculate the weighted average of the input information of a single output value.

6. The method for predicting construction cost factor prices based on the PSO-CNN-LSTM-ATT combined model according to claim 1 is characterized in that: In step 5, the particle swarm optimization algorithm randomly searches a number of particles in the search space, and each particle gradually searches for the global optimal solution through its speed and position in an iterative process. The optimization process includes particle initialization, fitness evaluation and update operations.

7. The method for predicting construction cost factor prices based on the PSO-CNN-LSTM-ATT combined model according to claim 6 is characterized in that: The initialization of the particles sets the key parameters of the particle swarm optimization, including the number of iterations NGEN, the population size N, and the constraint range of the variables. The parameters are set as: NGEN = 50, N = 20, and the upper and lower bounds of the hyperparameters are: C1. The lower bound of the number of LSTM network units is 100 and the upper bound is 500; C2, the lower bound of the convolution kernel size is 3, and the upper bound is 10; C3, the lower bound of the learning rate is 0.001 and the upper bound is 0.01; The initial position and velocity of the particle are randomly distributed within the defined upper and lower bounds. The position initialization formula is: in, is the position of the zth particle in the dth dimension, r1 is a random number, is the minimum value of this dimension, is the maximum value of this dimension.

8. The method for predicting construction cost factor prices based on the PSO-CNN-LSTM-ATT combined model according to claim 6 is characterized in that: The fitness evaluation and update operations include fitness evaluation, speed update, position update, boundary check, iteration and optimization, and final model training; The fitness evaluation calculates the position fitness of each particle through a fitness function; The velocity update, i.e. the velocity of each particle, is based on its historical best position p best and the global optimal position g best Update, the speed update formula is: in, is the velocity of the i+1th generation particle, w is the inertia weight, c1 and c2 are learning factors, which respectively indicate the degree to which the particle is affected by its own experience, and r1 and r2 are random numbers; The update formula for the location update is: in, is the position of the particle of the i+1th generation in the dth dimension; The boundary check ensures that the particle position remains within the predefined search space. If it is out of range, the particle position is restricted to the boundary. The formula is: in, and are the minimum and maximum values ​​of the dth dimension respectively; The iteration and optimization are performed through continuous iteration of the particle swarm optimization algorithm, each time updating the speed and position of the particle, and gradually searching for the optimal hyperparameter combination. At the end of each round of iteration, the fitness function is used to evaluate the performance of the current particle. If the fitness value is improved compared to the previous global optimal position, g is updated. best ; After finding the optimal hyperparameter combination, the final model training uses the hyperparameter configuration to perform final training on the CNN-LSTM-ATT model. The specific configuration is as follows: Number of LSTM cells: 300 Convolution kernel size: 5 Learning rate: 0.

001.

9. The method for predicting construction cost factor prices based on the PSO-CNN-LSTM-ATT combined model according to claim 1 is characterized in that: The CNN-LSTM-ATT model after hyperparameter optimization and model training in step 6 predicts the test set data and performs denormalization on the prediction results, which includes loading the best model, model prediction output, denormalization and prediction result evaluation; The loading of the best model saves the model weight with the best performance on the validation set during the training process; The model predicts output using the test set input data X test Perform model prediction and obtain normalized prediction results The denormalization process converts the model prediction results into the original data scale by using the minimum-maximum denormalization formula to convert the normalized prediction values Restore to actual forecast value Its expression is as follows: Among them, max and min are the maximum and minimum values ​​of historical data respectively. is the actual predicted value after denormalization; The prediction result evaluation uses root mean square error, mean square error, mean absolute error, coefficient of determination and mean absolute percentage error to comprehensively analyze the performance of the model in predicting the price of labor, materials and machinery; The root mean square error is the square root of the mean of the sum of squares of the differences between the predicted value and the actual value, and its expression is as follows: where y i is the actual value, is the predicted value, n is the number of samples, and RMSE is the root mean square error; The mean square error is the mean of the sum of squares of the differences between the predicted value and the actual value, and its expression is as follows: Among them, MSE is the mean square error; The mean absolute error is the mean of the absolute values ​​of the differences between the predicted values ​​and the actual values, and its expression is as follows: Among them, MAE is the mean absolute error; The determination coefficient represents the degree of fit between the model prediction value and the actual value, and its value range is between 0 and 1. Its expression is as follows: Among them, R 2 is the coefficient of determination, is the mean of the actual values; The mean absolute percentage error is the average of the absolute value of the difference between the predicted value and the actual value as a percentage of the actual value. It represents the proportion of the error to the actual value, and its expression is as follows: Where MAPE is the mean absolute percentage error.

10. A method for predicting construction cost factor prices based on a PSO-CNN-LSTM-ATT combined model according to any one of claims 1 to 9, characterized in that: The price forecast objects include construction cost elements of rebar, concrete, ordinary workers and mechanical equipment.