A Transformer-based method and device for predicting the seismic performance of metal dampers
By using a Transformer-based neural network architecture and physical constraint loss function optimization, the problem of low efficiency in traditional methods is solved, and efficient and accurate prediction of the seismic performance of metal dampers is achieved under small sample conditions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GERB QINGDAO VIBRATION CONTROL
- Filing Date
- 2026-03-12
- Publication Date
- 2026-05-26
AI Technical Summary
Existing technologies for predicting the seismic performance of metal dampers are characterized by low efficiency and high computational cost of traditional finite element methods, and the strong dependence of deep learning-based methods on training data, resulting in insufficient prediction accuracy under small sample conditions.
We employ a Transformer-based neural network architecture, using dual encoders to independently learn dynamically loaded displacement time-series data and static geometric parameter data. We also utilize a cross-attention mechanism to explicitly model the intrinsic relationship between the two, while employing a physical constraint loss function to optimize the model and reduce the dependence on labeled data.
The accuracy and efficiency of predicting the seismic performance of metal dampers are improved with reduced labeled data. The model can strictly conform to physical laws even under unexperienced conditions, reducing the risk of overfitting.
Smart Images

Figure CN121835312B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of electrical digital data processing technology, and in particular to a method and device for predicting the seismic performance of metal dampers based on Transformer. Background Technology
[0002] Metal dampers are key components for improving the seismic performance of buildings, bridges, and other infrastructure. Accurate prediction of their seismic performance is therefore crucial. Simplified analysis models result in large prediction errors, while refined finite element simulation methods are computationally expensive and time-consuming, making rapid parametric analysis and optimization difficult. Therefore, efficiently predicting the seismic performance of metal dampers is of great significance for their widespread application.
[0003] To address the inefficiency of traditional finite element methods, deep learning-based surrogate models have been introduced. Specifically, the prediction task is typically constructed as a sequence-to-sequence (Seq2Seq) learning problem, processed using models such as recurrent neural networks (RNNs), long short-term memory networks (LSTMs), or Transformers. In these approaches, the model input usually consists of a time-varying displacement sequence and geometric parameters describing the damper's physical properties. For example, the geometric parameter vector is copied along the time dimension and concatenated with the displacement values at each time step to form an augmented input sequence that integrates dynamic and static information, which is then fed into the neural network. The model training process is data-driven, optimizing network parameters by minimizing data fitting losses such as the mean square error between the predicted force sequence and the actual force sequence obtained from finite element simulation, thereby enabling the model to learn the mapping relationship from the input sequence to the output force sequence.
[0004] However, the way related technologies directly splice the geometric parameters describing the physical properties of the damper with the dynamic displacement sequence requires the network to implicitly learn the complex nonlinear coupling relationship between the two. This makes the model dependent on the quantity and quality of the training data. When the training samples are insufficient or the working conditions to be predicted exceed the coverage of the training set, the accuracy of related technologies in predicting the seismic performance of metal dampers is insufficient. Summary of the Invention
[0005] This application provides a Transformer-based method and device for predicting the seismic performance of metal dampers, which improves the accuracy of predicting the seismic performance of metal dampers while reducing the amount of labeled data.
[0006] In a first aspect, a method for predicting the seismic performance of metal dampers based on Transformer is provided. The method is characterized by its application to a prediction device and includes: constructing a neural network with a Transformer architecture comprising a first encoder, a second encoder, and a decoder, wherein both the first and second encoders are composed of a predetermined number of identical encoder layers stacked together; inputting preprocessed loading displacement time-series data and geometric parameter data of the metal dampers from a predetermined training set into the first and second encoders respectively, generating a dynamic temporal feature sequence corresponding to each time step in the loading displacement time-series data and static geometric structural features characterizing the inherent physical properties of the metal damper; inputting the preprocessed loading displacement time-series data from the predetermined training set into a decoder... The decoder obtains the hidden state sequence of the decoder. In the cross-attention layer of the decoder, the dynamic temporal feature sequence is used as the key vector, the static geometric structure feature is used as the value vector, and the hidden state sequence is used as the query vector. The coupled feature representation that integrates the loading displacement temporal data and geometric parameter data is determined through the attention mechanism. The predicted damping force sequence in the training phase is determined based on the coupled feature representation. The loss value is calculated based on the predicted damping force sequence and the real force sequence in the preset training set through the preset physical constraint loss function. The network parameters of the neural network are iteratively updated with the goal of minimizing the loss value. The network parameters corresponding to the minimum loss in the preset validation set are used as the optimal model parameters to obtain the optimal prediction model. The seismic performance of the metal damper under test is predicted based on the optimal prediction model.
[0007] By adopting the above technical solution, the predictive device constructs a dual-encoder Transformer neural network architecture. Dynamically loaded displacement time-series data and static geometric parameter data are learned independently by the first and second encoders, respectively. Through a cross-attention mechanism in the reconstructed decoder, using dynamic time-series features as keys, static geometric features as values, and the decoder's own state as queries, the intrinsic relationship between displacement history and the inherent physical properties of the metal damper can be explicitly understood and modeled. Simultaneously, a physical constraint loss function is used to optimize the model during training. This physical regularization reduces the dependence on a large amount of labeled data, enabling the model to converge quickly even under small sample conditions. Furthermore, the prediction results strictly conform to physical laws even under unexperienced conditions, thereby improving the accuracy of predicting the seismic performance of the metal damper while reducing the amount of labeled data.
[0008] In conjunction with some embodiments of the first aspect, in some embodiments, the step of calculating the loss value based on the predicted damping force sequence and the real force sequence in a preset training set using a preset physical constraint loss function specifically includes: the preset physical constraint loss function is:
[0009]
[0010] in, To pre-define the physical constraint loss function, To predict the loss, it is used to measure the difference between the predicted damping force and the actual value, and to guide the model to learn the yield and stiffening criteria of the damper. The loading loss is used to constrain the model to meet the damper's loading criteria during the loading phase; The unloading loss is used to constrain the model to meet the damper's unloading criterion during the unloading phase. For loading loss coefficient, The unloading loss coefficient is... For batch size, For sequence length, To predict the damping force, For true strength, This is the penalty coefficient for the loading criterion; it is set to 1 if the loading criterion is violated, and 0 otherwise. The difference in predictive power, This is the penalty coefficient for the unloading criterion; it is set to 1 if the unloading criterion is violated, and 0 otherwise. This represents stiffness error.
[0011] By adopting the above technical solution, the key mechanical criteria of the damper (such as yield criterion and loading / unloading path constraints) are embedded in the optimization objective in the form of a loss function, which injects stronger physical common sense into the model's learning process. This allows for rapid convergence even with reduced labeled data, and ensures that the prediction results strictly conform to the key mechanical criteria of the damper even under unexperienced working conditions.
[0012] In conjunction with some embodiments of the first aspect, in some embodiments, before the step of constructing a neural network with a Transformer architecture including a first encoder, a second encoder, and a decoder, the method further includes: establishing a parameterized finite element model of the metal damper; generating a preset number of different combinations of geometric parameters within a preset range of key geometric parameters of the metal damper using the Latin hypercube sampling method; randomly combining the geometric parameter combinations with preset loading conditions to obtain an initial dataset, wherein the preset loading conditions are divided into regular cyclic displacement loading conditions and random cyclic displacement loading conditions, the strain amplitude of the regular cyclic displacement loading conditions increases stepwise according to a preset rule, and the strain amplitude of the random cyclic displacement loading conditions is randomly generated within a preset range and the signs alternate; performing nonlinear static analysis on the initial dataset based on the parameterized finite element model to extract the force-displacement hysteresis curve of the initial dataset; and dividing the initial dataset and the force-displacement hysteresis curve of the initial dataset into a preset training set, a preset validation set, and a preset test set according to a preset ratio.
[0013] By adopting the above technical solution, the predictive equipment uses a parameterized finite element model combined with Latin hypercube sampling in the key geometric parameter space to generate a large number of damper samples covering a wide design range more efficiently and at a lower cost. Simultaneously, by using regular cyclic displacement loading conditions and random cyclic displacement loading conditions, the model can learn the mechanical response under different loading paths, enhancing its generalization ability.
[0014] In conjunction with some embodiments of the first aspect, in some embodiments, the step of constructing a neural network with a Transformer architecture including a first encoder, a second encoder, and a decoder specifically includes: dividing the hyperparameters to be determined in the neural network into three levels: batch size, model architecture parameters, and optimizer parameters and other training control hyperparameters, with the optimizer parameters and other training control hyperparameters at the same level; based on a preset training set and a preset validation set, with the objective of minimizing the preset validation set loss value, independently optimizing in the order of batch size, model architecture parameters, and optimizer parameters and other training control hyperparameters to determine the optimal hyperparameter combination; constructing a neural network including a first encoder, a second encoder, and a decoder based on the optimal hyperparameter combination, and loading the corresponding optimizer configuration.
[0015] By adopting the above technical solution, the complex global optimization problem is decomposed into three independent optimization processes carried out in an orderly manner at three levels. This optimization sequence, from macro (batch size) to meso (model architecture) and then to micro (optimizer parameters and other training control hyperparameters), improves the efficiency and stability of hyperparameter search.
[0016] In conjunction with some embodiments of the first aspect, in some embodiments, the step of predicting the seismic performance of the metal damper under test based on the optimal prediction model specifically includes: quantitatively evaluating the prediction accuracy and generalization ability of the optimal prediction model based on preset test set data; after the evaluation reaches the preset target, inputting the geometric parameters of the metal damper under test and the target loading displacement sequence into the optimal prediction model to obtain the seismic performance prediction result of the metal damper under test.
[0017] By adopting the above technical solution and performing quantitative evaluation on a preset test set, the reliability of the prediction model is improved before predicting the seismic performance of the metal damper under test.
[0018] In conjunction with some embodiments of the first aspect, in some embodiments, the step of inputting the preprocessed loading displacement time series data and geometric parameter data of the metal damper in the preset training set into the first encoder and the second encoder respectively includes: using the LSTM embedding layer of the first encoder to convert the loading displacement time series data into high-dimensional time series features with a preset model dimension, adding position encoding and inputting it into the first encoder; using the MLP embedding layer of the second encoder to map the geometric parameter data, generating high-dimensional static features with a preset model dimension, and inputting them into the second encoder.
[0019] By employing the above technical solution, LSTM embedding layers are used to process loading displacement time-series data, capturing the temporal dependencies and dynamic evolution patterns within the sequence. MLP embedding layers are used to process static geometric parameter data, mapping it from a low-dimensional parameter space to a high-dimensional feature space consistent with the main model. This targeted processing ensures that both source data are effectively converted into information-rich and uniformly formatted high-dimensional feature representations before entering the dual encoder for deeper feature learning.
[0020] In conjunction with some embodiments of the first aspect, in some embodiments, after the step of converting the loaded displacement time series data into high-dimensional time series features with a preset model dimension using an LSTM embedding layer and adding position encoding before inputting it into the first encoder, the method further includes: the first encoder and decoder using an LSTM embedding layer with the same parameters.
[0021] By adopting the above technical solution, the first encoder and decoder use the same LSTM embedding layer with the same parameters, that is, parameter sharing, which reduces the total number of parameters of the model, reduces the model complexity, and thus mitigates the risk of overfitting that may occur when training on a limited dataset.
[0022] In a second aspect, embodiments of this application provide a prediction device, which includes: one or more processors and a memory; the memory is coupled to the one or more processors, and the memory is used to store computer program code, the computer program code including computer instructions, and the one or more processors call the computer instructions to cause the prediction device to perform the method described in the first aspect and any possible implementation thereof.
[0023] Thirdly, embodiments of this application provide a computer program product containing instructions that, when the computer program product is run on a prediction device, cause the prediction device to perform the method described in the first aspect and any possible implementation thereof.
[0024] Fourthly, embodiments of this application provide a computer-readable storage medium including instructions that, when executed on a prediction device, cause the prediction device to perform the method described in the first aspect and any possible implementation thereof.
[0025] Understandably, the prediction device provided in the second aspect, the computer program product provided in the third aspect, and the computer storage medium provided in the fourth aspect are all used to execute the methods provided in the embodiments of this application. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding methods, and will not be repeated here.
[0026] One or more technical solutions provided in the embodiments of this application have at least the following technical effects or advantages:
[0027] 1. The prediction device constructs a dual-encoder Transformer neural network architecture. Dynamically loaded displacement time-series data and static geometric parameter data are learned independently by the first and second encoders, respectively. Through a cross-attention mechanism in the reconstruction decoder, dynamic time-series features are used as keys, static geometric features as values, and the decoder's own state as queries. This allows for an explicit understanding and modeling of the intrinsic relationship between displacement history and the inherent physical properties of the metal damper. Simultaneously, a physical constraint loss function is used to optimize the model during training. This physical regularization reduces the dependence on a large amount of labeled data, enabling the model to converge quickly even under small sample conditions. Furthermore, the prediction results strictly conform to physical laws even under unexperienced conditions, thereby improving the accuracy of predicting the seismic performance of the metal damper while reducing the amount of labeled data.
[0028] 2. The prediction device learns the dynamic loading displacement time series data and static geometric parameter data independently by the first encoder and the second encoder, respectively. Through the cross-attention mechanism of the reconstruction decoder, the dynamic time series features are used as keys, the static geometric features are used as values, and the decoder's own state is used as queries. This allows for an explicit understanding and modeling of the intrinsic relationship between displacement history and the inherent physical properties of the metal damper. Consequently, the Transformer model of this invention can predict the force sequence in parallel at all locations by loading displacement time series data and geometric parameter data. That is, the force prediction does not depend on the previous force prediction, thus achieving parallel prediction and improving prediction efficiency.
[0029] 3. The first encoder and decoder use the same LSTM embedding layer with the same parameters, i.e. parameter sharing, which reduces the total number of parameters in the model, reduces the model complexity, and thus mitigates the risk of overfitting that may occur when training on a limited dataset. Attached Figure Description
[0030] Figure 1This is a flowchart illustrating a method for predicting the seismic performance of a metal damper based on Transformer, as described in an embodiment of this application.
[0031] Figure 2 This is a schematic diagram of a Transformer neural network architecture based on physical constraints in an embodiment of this application.
[0032] Figure 3 This is a geometric dimension diagram of a metal damper according to an embodiment of this application.
[0033] Figure 4 This is a comparison chart of test results for a Transformer neural network model based on physical constraints in an embodiment of this application.
[0034] Figure 5 This is a schematic diagram of the physical device structure of a prediction device in the embodiments of this application. Detailed Implementation
[0035] The terminology used in the following embodiments of this application is for the purpose of describing particular embodiments only and is not intended to be limiting of this application. As used in the specification and appended claims of this application, the singular expressions “a,” “an,” “the,” “the,” “the,” and “this” are intended to include the plural expressions as well, unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in this application refers to and includes any or all possible combinations of one or more of the listed items.
[0036] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature, and in the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more.
[0037] This application provides a Transformer-based method and device for predicting the seismic performance of metal dampers, which improves the accuracy of predicting the seismic performance of metal dampers while reducing the amount of labeled data.
[0038] Please see Figure 1 This is a flowchart illustrating a method for predicting the seismic performance of a metal damper based on Transformer, as described in an embodiment of this application.
[0039] S101. Construct a neural network with a Transformer architecture that includes a first encoder, a second encoder, and a decoder.
[0040] For details, see attached. Figure 2 As shown, EncoderA is the first encoder, EncoderB is the second encoder, and Decoder is the decoder. EncoderA and EncoderB are both composed of N identical stacked encoder layers. Each encoder layer contains a multi-head attention layer and a feedforward network layer, employing residual connections and layer normalization. The decoder is composed of N identical stacked decoder layers. Each decoder layer contains a masked multi-head attention layer, an encoder-decoder cross-attention layer, and a feedforward network layer. Both EncoderA and Decoder have LSTM embedding layers with the same parameters, while EncoderB has an MLP embedding layer. The LSTM embedding layer is used to process the loading displacement time-series data of the metal damper from the pre-defined training set, transforming it from one-dimensional space to model dimension d. m Furthermore, it enhances the ability to extract sequence features. The MLP embedding layer in EncoderB is used to map the geometric parameter data of the metal dampers in the preset training set into high-dimensional features and input them into EncoderB.
[0041] Before constructing a neural network with a Transformer architecture comprising a first encoder, a second encoder, and a decoder, the predictive device needs to prepare and process the dataset. In some embodiments, taking a dog-bone weakened metal damper as an example, a parameterized finite element model of the metal damper can be established first. Then, 500 different combinations of geometric parameters can be generated within a preset key geometric parameter range of the metal damper using the Latin hypercube sampling method. This preset key geometric parameter range includes the damper height H, width B, length L, web weakening coefficients a and b, and flange weakening coefficients c1 and c2, such as... Figure 3 The figure shows the geometric dimensions of a metal damper. Next, the geometric parameters are randomly combined with preset loading conditions to obtain 600 initial datasets. The preset loading conditions are divided into regular cyclic displacement loading conditions and random cyclic displacement loading conditions. The strain amplitude of the regular cyclic displacement loading conditions increases in a stepwise manner according to a preset pattern, while the strain amplitude of the random cyclic displacement loading conditions is randomly generated within a preset range and the signs alternate. For example, the regular cyclic displacement loading controls the rotation angle θ at the loading end of the dog-bone weakening metal damper, causing the nominal strain amplitude to increase in a stepwise manner according to a preset pattern. 1%→ 2%→ 3%→ 4%→ The strain amplitude increases in a stepwise manner, increasing by 5%. The random cyclic displacement loading starts with a strain amplitude of 0 and ends with 5%. From the second strain amplitude onwards, the signs of the strain amplitudes alternate (the number of alternations is the same as in the regular loading condition of the same period), and the magnitude of the strain amplitude is randomly generated within the range of 1% to 5%. Then, based on the parametric finite element model, a nonlinear static analysis is performed on the initial dataset, and the force-displacement hysteresis curve of the initial dataset is extracted as the true label for each data sample. Finally, the maximum and minimum values in the interval [-1, 1] are normalized for all input features (loading displacement time series data and geometric parameter data) and output target (force sequence). The normalization calculation formula is: ,in, and These represent the maximum and minimum values of the feature in the sample sequence, respectively. After normalization, the entire dataset is randomly divided into a preset training set, a preset validation set, and a preset test set in a ratio of 70%:20%:10%.
[0042] In some embodiments, after preparing and processing the dataset, to ensure that the Transformer-based seismic performance prediction method for metal dampers achieves optimal performance, a targeted structured hyperparameter optimization strategy can be employed. The core of this strategy lies in classifying hyperparameters based on their function and correlation, and implementing phased sequential optimization. Specifically, firstly, the hyperparameters are divided into multiple levels, including, for example, batch size, model architecture parameters (such as the Transformer model dimension d). m Number of attention heads h, number of encoder layers n enc Number of decoder layers n dec d ropout The rate and the number of LSTM layers n), optimizer parameters (such as the L2 regularization coefficient w) d The first moment estimate exponential decay rate β1, the second moment estimate exponential decay rate β2, and the numerical stability parameter epsilon, as well as other training control hyperparameters (such as the maximum number of training epochs, the cosine annealing period T). max and initial learning rate l r (etc.). Subsequently, optimization is performed in a macroscopic to microscopic order: first, the batch size is determined, then the model architecture parameters are optimized, and finally, the optimizer hyperparameters and other training control hyperparameters are fine-tuned. This phased optimization method improves optimization efficiency by decoupling hyperparameters at different levels and helps to find the global optimum stably and systematically. Finally, through the above training and optimization process, the model with the best performance on the preset validation set is selected from the training iterations as the final seismic performance prediction model for metal dampers. For example, in this embodiment, the attached... Figure 2The core hyperparameter configuration for the Transformer architecture neural network is: Transformer model dimension d m =32, number of attention heads h=2, number of encoder layers n enc =2, number of decoder layers n dec =2,d ropout The learning rate is 0.1, the number of LSTM and MLP layers is n=2, the batch size is B=32, and the initial learning rate is l. r =0.001, maximum training epochs is 100. The AdamW optimizer is used to update model parameters, with a weight decay coefficient of 1×10⁻⁶. -4 The first-order moment estimates the exponential decay rate β1 = 0.9, the second-order moment estimates the exponential decay rate β2 = 0.999, and the numerical stability parameter epsilon = 1.0e. -8 Cosine annealing period T max =100. Training is performed on a single NVIDIA RTX 4090 GPU. This process of calculating the loss, backpropagating the gradient, and updating the parameters is repeated for a batch of data in the training set. One training epoch is completed when all batches of the entire training set have undergone this process. Through multiple iterations, the parameters of the neural network are continuously optimized, making the difference between the model's predictions and the true values (defined by the loss function) smaller and smaller, thus learning a complex mapping relationship from input to output.
[0043] S102. Input the preprocessed loading displacement time series data and geometric parameter data of the metal damper in the preset training set into the first encoder and the second encoder respectively to generate a dynamic time series feature sequence corresponding to each time step in the loading displacement time series data and a static geometric structure feature characterizing the inherent physical properties of the metal damper.
[0044] After constructing the neural network in step S101, the preprocessed loading displacement time-series data of the metal damper in the preset training set is added with position encoding and then input into the first encoder for feature extraction and dimensional transformation, generating a dynamic temporal feature sequence corresponding to each time step in the loading displacement time-series data. The geometric parameter data of the metal damper in the preset training set is directly input into the second encoder for feature extraction and dimensional transformation, generating static geometric structural features characterizing the inherent physical properties of the metal damper.
[0045] S103. Input the preprocessed loading displacement time series data from the preset training set into the decoder to obtain the hidden state sequence of the decoder.
[0046] Specifically, this step is performed during the forward propagation phase of model training. Preprocessed loading displacement time-series data from the preset training set is used as input to the decoder. After processing by the decoder's Masked Multi-Head Attention layer, the result is the decoder's hidden state sequence, which encodes the contextual information of the target output sequence. Traditional Transformer models use the actual force from the previous step as input to predict the actual force at the next moment, thus failing to achieve parallel prediction; that is, the prediction at the next moment requires waiting for the prediction at the previous moment to complete. This invention independently learns the dynamic loading displacement time-series data and static geometric parameter data from the first and second encoders, respectively. By reconstructing the decoder's cross-attention mechanism, using dynamic temporal features as keys, static geometric features as values, and the decoder's own state as queries, it can explicitly understand and model the intrinsic relationship between displacement history and the inherent physical properties of the metal damper. This allows the Transformer model of this invention to predict the force sequence in parallel at all locations using loading displacement time-series data and geometric parameter data; that is, force prediction does not depend on the previous force prediction, achieving parallel prediction and improving prediction efficiency.
[0047] S104. In the cross-attention layer of the decoder, the dynamic temporal feature sequence is used as the key vector, the static geometric structure feature is used as the value vector, and the hidden state sequence is used as the query vector. The coupled feature representation that integrates the loading displacement temporal data and geometric parameter data is determined through the attention mechanism.
[0048] Specifically, this step is executed immediately after S103 during the forward propagation process. Traditional cross-attention mechanisms typically use the output of the same encoder as both key and value. This application restructures this: the dynamic temporal feature sequence (representing the loading displacement history) generated by the first encoder in S102 is linearly transformed and used as the key vector; the static geometric structure features (representing the physical properties of the metal damper) generated by the second encoder are linearly transformed and used as the value vector; and the hidden state sequence (representing the current prediction context) generated by the decoder mask from the attention layer in S103 is linearly transformed and used as the query vector. This is achieved through the attention formula... ,in, For model dimensions. The decoder's query vector at each time step. It will be related to the key vector of the entire dynamic time series feature sequence. A dot product operation is performed to determine which parts of the historical displacement sequence should be focused on at the current prediction time. The calculated attention weights are then used to apply the value vector of static geometric features. A weighted summation is performed. The physical implication of this design is that the model utilizes currently predicted demand ( To retrieve the most relevant historical displacement states ( ), and based on this correlation, dynamically from the inherent physical properties of the damper ( Extracting and combining the most relevant information from the data, a more accurate representation of the coupled characteristics of a specific metal damper under a specific displacement loading is generated.
[0049] S105. Determine the predicted damping force sequence during the training phase based on the coupled feature representation.
[0050] Specifically, this step follows S104 in the forward propagation process, transforming the highly abstract feature representation of the decoder, which incorporates information from multiple sources, into a concrete and interpretable physical quantity: damping force. In S104, the decoder's cross-attention layer generates a coupled feature representation for each time step. While this representation is information-rich, it remains in a high-dimensional latent space. To obtain the final predicted force value, this coupled feature representation needs to pass through subsequent processing layers. Typically, this coupled feature representation is fed into a feedforward network, which usually consists of two linear layers and a nonlinear activation function between them. The feedforward network performs further nonlinear transformations and refinements on the coupled feature representation. Finally, the feature vector processed by the feedforward network passes through a final linear layer (also called the output layer or projection layer), which reduces the dimension of the high-dimensional feature vector from the model dimension (…). This is mapped to the output dimension. After this linear transformation, the predicted damping force at the current time step is obtained. This process is repeated for each time step in the sequence to eventually form a complete sequence of predicted damping forces.
[0051] S106. Based on the predicted damping force sequence and the real force sequence in the preset training set, calculate the loss value through the preset physical constraint loss function.
[0052] Specifically, this step is performed after the forward propagation of each iteration of model training is completed and before the backpropagation begins. Unlike traditional loss functions that only use mean squared error, this application employs a composite physical constraint loss function to calculate the loss value in order to guide the model in learning the key mechanical behaviors of the metal damper, including the yield criterion, strengthening criterion, loading criterion, and unloading criterion. The preset physical constraint loss function is:
[0053]
[0054] in, To pre-define the physical constraint loss function, To predict the loss, it is used to measure the difference between the predicted damping force and the actual value, and to guide the model to learn the yield and stiffening criteria of the damper. The loading loss is used to constrain the model to meet the damper's loading criteria during the loading phase; The unloading loss is used to constrain the model to meet the damper's unloading criterion during the unloading phase. For loading loss coefficient, In this embodiment, the unloading loss coefficient is used. Take 1.0, Take 0.1, For batch size, For the sequence length, in this embodiment, we take... =32, =1351. To predict the damping force, For true strength, This is the penalty coefficient for the loading criterion; it is set to 1 if the loading criterion is violated, and 0 otherwise. The difference in predictive power, This is the penalty coefficient for the unloading criterion; it is set to 1 if the unloading criterion is violated, and 0 otherwise. This represents stiffness error.
[0055] S107. With minimizing the loss value as the optimization objective, iteratively update the network parameters of the neural network.
[0056] Specifically, this step is performed after the loss value is calculated. Based on the loss calculated through forward propagation, gradient descent-like algorithms are used to adjust the model so that its next prediction is closer to the desired target. The entire process is based on the chain rule: first, the gradient of the loss value with respect to the output of the last layer of the network is calculated; then, this gradient is propagated layer by layer backward to calculate the gradient of the loss value with respect to the parameters of each layer. This gradient vector indicates the direction in which the loss value decreases the fastest. Then, the optimizer updates the network parameters based on the calculated gradients.
[0057] S108. The network parameters corresponding to the minimum loss of the preset validation set are taken as the optimal model parameters to obtain the optimal prediction model.
[0058] During the iterative training of S107, model parameters are continuously optimized to minimize the loss on the training set. However, if overtraining occurs, the model may memorize noise and special cases from the training set, resulting in perfect performance on the training set but poor performance on unseen new data (such as the validation or test set). This phenomenon is called overfitting. To address this issue, after each training epoch or several iterations, the model is evaluated on a pre-defined validation set, and its loss value on the validation set is calculated. The training process continuously monitors this validation set loss and compares the current model's network parameters with the parameters corresponding to the historical lowest validation set loss. Once the current validation set loss is found to be lower than the historical lowest value, the current network parameters are saved as the current optimal model parameters. Furthermore, an early stopping mechanism can be employed, using the pre-defined validation set loss as a monitoring metric. If the validation set loss does not decrease for 15 consecutive epochs, training is terminated early, and the model parameters with the lowest validation set loss are rolled back. After training, the final selected parameters are not the last set of parameters at the end of training, but rather the set of parameters that performed best on the validation set throughout the entire process—the optimal model parameters. By loading this set of optimal parameters into the constructed neural network architecture, we obtain the final optimal prediction model used for prediction.
[0059] S109. Based on the optimal prediction model, predict the seismic performance of the metal damper under test.
[0060] The optimal prediction model refers to the neural network with the best generalization ability obtained from step S108. The metal damper to be tested refers to a new instance of a metal damper whose seismic performance needs to be evaluated but whose performance is unknown. Seismic performance prediction refers to using the model, inputting the geometric parameters and loading displacement sequence of the damper to be tested, to quickly generate its corresponding mechanical response results, such as force-displacement hysteresis curves.
[0061] Specifically, this step is executed after obtaining the optimal prediction model in step S108. The loading displacement time series data and geometric parameter data of the metal damper under test are input into the optimal prediction model to obtain the seismic performance prediction results of the metal damper under test (such as force-displacement hysteresis curve).
[0062] In some embodiments, to ensure the reliability of the model, the prediction accuracy and generalization ability of the optimal prediction model can be quantitatively evaluated using a preset test set obtained in step S101. By calculating the error indices (such as root mean square error, coefficient of determination R², etc.) between the prediction results and the true labels in the test set, the prediction accuracy and generalization ability of the model can be quantitatively evaluated. When the evaluation results meet preset engineering requirements (e.g., 95% of the sample prediction errors are within ±5%), the optimal prediction model is verified as a reliable prediction tool. Figure 4 As shown, Figure 4 The results show a comparison between the force-displacement hysteresis curves of six test models and the actual values. Figure 4 It is evident that the force-displacement hysteresis curve predicted by the method of this invention closely matches the actual curve, demonstrating high-precision prediction capability and good generalization ability. Furthermore, the method of this invention takes less than 1 second for a single prediction, far exceeding the traditional finite element method.
[0063] In the above embodiments, the prediction device constructs a dual-encoder Transformer neural network architecture. Dynamically loaded displacement time-series data and static geometric parameter data are learned independently by the first and second encoders, respectively. Through a cross-attention mechanism in the reconstruction decoder, using dynamic time-series features as keys, static geometric features as values, and the decoder's own state as queries, it can explicitly understand and model the intrinsic relationship between displacement history and the inherent physical properties of the metal damper. Simultaneously, a physical constraint loss function is used to optimize the model during training. This physical regularization reduces the dependence on a large amount of labeled data, enabling the model to converge quickly even under small sample conditions. Furthermore, the prediction results strictly conform to physical laws even under unexperienced conditions, thereby improving the accuracy of predicting the seismic performance of the metal damper while reducing the amount of labeled data.
[0064] The above describes a method for predicting the seismic performance of a metal damper based on Transformer in the embodiments of this application. The following describes an exemplary prediction device 500 provided in the embodiments of this application.
[0065] Figure 5 This is a schematic diagram of an exemplary hardware structure of the prediction device 500 provided in an embodiment of this application. In some embodiments, the prediction device 500 is a computer device. The computer device includes a processor, a memory, and a network interface connected via a system bus. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database of the computer device is used to store data. The network interface of the computer device is used to communicate with other external terminals or servers via a network connection. In some embodiments, the network interface can be a wired network interface; in some embodiments, the network interface can also be a wireless network interface. When the computer program is executed by the processor, it implements a Transformer-based method for predicting the seismic performance of metal dampers according to an embodiment of this application.
[0066] Those skilled in the art will understand that Figure 5 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0067] In some embodiments of this application, a computer-readable storage medium is also provided, including instructions that, when executed on the prediction device 500, cause the prediction device 500 to perform a Transformer-based method for predicting the seismic performance of a metal damper according to an embodiment of this application.
[0068] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
[0069] As used in the above embodiments, depending on the context, the term "when..." can be interpreted as meaning "if...", "after...", "in response to determining...", or "in response to detecting...". Similarly, depending on the context, the phrase "when determining..." or "if (the stated condition or event) is interpreted as meaning "if determining...", "in response to determining...", "when (the stated condition or event) is detected", or "in response to detecting (the stated condition or event)".
[0070] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive), etc.
[0071] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes described in the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.
Claims
1. A method for predicting the seismic performance of a metal damper based on Transformer, characterized in that, Applied to a prediction device, the method includes: A neural network with a Transformer architecture comprising a first encoder, a second encoder, and a decoder is constructed, wherein the first encoder and the second encoder are both composed of a predetermined number of identical encoder layers stacked together; The preprocessed loading displacement time series data and geometric parameter data of the metal damper in the preset training set are input to the first encoder and the second encoder respectively to generate a dynamic time series feature sequence corresponding to each time step in the loading displacement time series data and a static geometric structure feature characterizing the inherent physical properties of the metal damper. The preprocessed loading displacement time series data from the preset training set is input into the decoder to obtain the hidden state sequence of the decoder; In the cross-attention layer of the decoder, the dynamic temporal feature sequence is used as the key vector, the static geometric structure feature is used as the value vector, and the hidden state sequence is used as the query vector. The coupled feature representation that fuses the loading displacement temporal data and the geometric parameter data is determined through the attention mechanism. The predicted damping force sequence for the training phase is determined based on the aforementioned coupling feature representation. Based on the predicted damping force sequence and the real force sequence in the preset training set, the loss value is calculated using a preset physical constraint loss function; The preset physical constraint loss function is: , wherein The preset physical constraint loss function, the To predict the loss, it is used to measure the difference between the predicted damping force and the actual value, guiding the model to learn the yield and stiffening criteria of the damper; the aforementioned The loading loss is used to constrain the model to meet the damper's loading criterion during the loading phase; the The unloading loss is used to constrain the model to meet the damper's unloading criterion during the unloading phase; the... The loading loss coefficient, the The unloading loss coefficient, the For batch size, the stated For the sequence length, the To predict the damping force, the For true strength, the stated The loading criterion penalty coefficient is set to 1 when the loading criterion is violated, and 0 otherwise. The difference in predictive power, the The unloading criterion penalty coefficient is set to 1 when the unloading criterion is violated, and 0 otherwise. This refers to stiffness error; The network parameters of the neural network are iteratively updated with the goal of minimizing the loss value. The optimal model is obtained by taking the network parameters that minimize the loss on the preset validation set as the optimal model parameters. Based on the optimal prediction model, the seismic performance of the metal damper under test is predicted.
2. The method according to claim 1, characterized in that, Prior to the step of constructing a neural network with a Transformer architecture comprising a first encoder, a second encoder, and a decoder, the method further includes: Establish a parametric finite element model of the metal damper; The Latin hypercube sampling method is used to generate a preset number of different combinations of geometric parameters within the preset key geometric parameter range of the metal damper. The geometric parameters are randomly combined with the preset loading conditions to obtain an initial dataset. The preset loading conditions are divided into regular cyclic displacement loading conditions and random cyclic displacement loading conditions. The strain amplitude of the regular cyclic displacement loading conditions increases stepwise according to a preset rule, and the strain amplitude of the random cyclic displacement loading conditions is randomly generated within a preset range and the signs alternate. Based on the parametric finite element model, a nonlinear static analysis is performed on the initial dataset to extract the force-displacement hysteresis curve of the initial dataset; The initial dataset and the force-displacement hysteresis curves of the initial dataset are divided into the preset training set, the preset validation set, and the preset test set according to a preset ratio.
3. The method according to claim 2, characterized in that, The steps for constructing a neural network with a Transformer architecture comprising a first encoder, a second encoder, and a decoder specifically include: The hyperparameters to be determined in the neural network are divided into three levels: batch size, model architecture parameters, and optimizer parameters and other training control hyperparameters. The optimizer parameters and other training control hyperparameters are at the same level. Based on the preset training set and the preset validation set, with the goal of minimizing the loss value of the preset validation set, the optimal combination of hyperparameters is determined by independently optimizing the batch size, model architecture parameters, optimizer parameters, and other training control hyperparameters in that order. Based on the optimal hyperparameter combination, the neural network comprising the first encoder, the second encoder, and the decoder is constructed, and the corresponding optimizer configuration is loaded.
4. The method according to claim 2, characterized in that, The steps for predicting the seismic performance of the metal damper under test based on the optimal prediction model specifically include: The prediction accuracy and generalization ability of the optimal prediction model are quantitatively evaluated based on the preset test set data. After the preset target is achieved, the geometric parameters of the metal damper under test and the target loading displacement sequence are input into the optimal prediction model to obtain the seismic performance prediction result of the metal damper under test.
5. The method according to claim 1, characterized in that, The step of inputting the preprocessed loading displacement time series data and geometric parameter data of the metal damper from the preset training set into the first encoder and the second encoder respectively includes: The loaded displacement time series data is converted into high-dimensional time series features with a preset model dimension using the LSTM embedding layer of the first encoder, and then input into the first encoder after adding position encoding. The geometric parameter data is mapped using the MLP embedding layer of the second encoder to generate high-dimensional static features with the preset model dimensions, and then input into the second encoder.
6. The method according to claim 5, characterized in that, After the step of converting the loaded displacement time series data into high-dimensional time series features with a preset model dimension using an LSTM embedding layer, and adding position encoding before inputting it into the first encoder, the method further includes: The first encoder and the decoder use an LSTM embedding layer with the same parameters.
7. A prediction device, characterized in that, The prediction device includes: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code including computer instructions, and the one or more processors call the computer instructions to cause the prediction device to perform the method as described in any one of claims 1-6.
8. A computer program product containing instructions, characterized in that, When the computer program product is run on the prediction device, the prediction device performs the method as described in any one of claims 1-6.
9. A computer-readable storage medium comprising instructions, characterized in that, When the instructions are executed on the prediction device, the prediction device performs the method as described in any one of claims 1-6.