A LightGBM-Transformer-based crane frame electrical system fault diagnosis method and system
Patent Information
- Application Number
- CN202611025853.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-10
- Publication Date
- 2026-10-20
AI Technical Summary
在吊艇架运行过程中,因工作环境存在噪声干扰,且信号呈现波动状、非线性和不确定性等特点,尤其是在吊艇架故障诊断中,针对吊艇架电气系统,其工作过程包含启动、加速、恒速、减速及制动等多个瞬态阶段,且受到海浪冲击带来的随机负载扰动,在这种频繁启停和变负载工况下,电气系统的电流和电压信号呈现出高度的非平稳和非线性特征,且故障信号耦合、故障样本不足等问题使得诊断难度增大,很难提高精度,从而造成短时间难以定位故障源,增大吊艇架的维护成本
[0015]本申请实施例提供的基于LightGBM-Transformer吊艇架电气系统故障诊断方案,具有如下有益效果:LightGBM作为传统机器学习模型擅长处理表格数据,具有高效的训练速度和低内存占用,但在处理复杂的时序依赖和序列数据时相对较弱;Transformer作为深度学习模型能高效捕捉序列数据中的长距离依赖,适用于长序列数据分类任务,但其计算复杂度较高,需要强大的硬件支持。对于吊艇架电气系统状态数据,通过CQSCA-LightGBM+BO-Transformer组合算法可以更高效处理复杂故障模式,提高了模型的鲁棒性和泛化性,具体如下:
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This application relates to the field of davit fault diagnosis technology, and in particular to a fault diagnosis method and system for davit electrical systems based on LightGBM-Transformer. Background Technology
[0002] A davit is a specialized lifting device on ships designed for storing, lowering, and recovering lifeboats, rescue boats, or transport boats, and is a core component of a ship's emergency rescue and lifesaving system. Davits have a complex structure, typically composed of mechanical, electrical, and hydraulic systems that work together to operate and control them. During davit operation, noise interference in the working environment and the fluctuating, nonlinear, and uncertain signal characteristics pose significant challenges, especially in davit fault diagnosis. The electrical system's operation involves multiple transient phases, including start-up, acceleration, constant speed, deceleration, and braking, and is subject to random load disturbances from wave impacts. Under these frequent start-stop and variable load conditions, the current and voltage signals of the electrical system exhibit highly non-stationary and nonlinear characteristics. Furthermore, issues such as fault signal coupling and insufficient fault samples increase the difficulty of diagnosis, hindering accuracy and making it difficult to quickly locate the fault source, thus increasing davit maintenance costs. Summary of the Invention
[0003] In view of this, embodiments of this application provide a fault diagnosis method for the electrical system of a davit based on the LightGBM-Transformer. One or more embodiments of this application also relate to a fault diagnosis system for the electrical system of a davit based on the LightGBM-Transformer, a computing device, a computer-readable storage medium, and a computer program, to address the technical deficiencies existing in the prior art.
[0004] According to a first aspect of the embodiments of this application, a fault diagnosis method for an electrical system of a davit based on LightGBM-Transformer is provided, comprising: The current operating status data of the davit electrical system is obtained, and the current operating status data is preprocessed to obtain preprocessed current operating status data. By inputting the preprocessed current operating status data into the trained improved LightGBM model, the feature data of the davit electrical system are obtained; By inputting the characteristic data of the davit electrical system into the trained improved Transformer model, the fault diagnosis results of the davit electrical system are obtained.
[0005] Preferably, the improved LightGBM model is a model whose hyperparameters are optimized using the Chaotic Quantum Sine and Cosine Algorithm (CQSCA); the improved Transformer model is a model whose hyperparameters are optimized using the Bayesian optimization algorithm.
[0006] Preferably, the improved LightGBM model includes: Generate a population consisting of multiple individuals; In each optimization iteration, the hyperparameter configuration of each individual in the population is updated using chaotic mapping and quantum rotation to obtain the updated hyperparameter configuration of each individual in the population. Repeatedly iterate and optimize until the maximum number of iterations or the convergence condition is reached. The hyperparameter configuration in the population is updated in each iteration, and the optimal hyperparameters are finally found.
[0007] Preferably, the trained improved LightGBM model includes: Obtain the optimal LightGBM hyperparameters and pass them to the LightGBM model for training to obtain a trained improved LightGBM model.
[0008] Preferably, the improved Transformer model includes: Initialize the Bayesian optimizer, and define the search range of hyperparameters and the fitness function; The search range of hyperparameters is modeled based on Gaussian process regression, and the combination of hyperparameters most likely to improve performance is selected by collecting fitness functions. Repeatedly iterate and optimize until the maximum number of iterations or the convergence condition is reached. Update the hyperparameter combination that is most likely to improve performance in each iteration, and finally find the optimal hyperparameter combination.
[0009] Preferably, the trained improved Transformer model includes: Obtain the optimal combination of hyperparameters and pass it to the Transformer model for training to obtain a trained improved Transformer model.
[0010] According to a second aspect of the embodiments of this application, a fault diagnosis system for the electrical system of a davit based on LightGBM-Transformer is provided, comprising: The preprocessing module is configured to acquire the current operating status data of the davit electrical system and obtain preprocessed current operating status data by preprocessing the current operating status data. The feature data acquisition module is configured to obtain feature data of the davit electrical system by inputting the preprocessed current operating state data into the trained improved LightGBM model; The fault diagnosis module is configured to obtain fault diagnosis results of the davit electrical system by inputting the feature data of the davit electrical system into a trained improved Transformer model.
[0011] Preferably, the improved LightGBM model is a model whose hyperparameters are optimized using the Chaotic Quantum Sine and Cosine Algorithm (CQSCA); the improved Transformer model is a model whose hyperparameters are optimized using the Bayesian optimization algorithm.
[0012] According to a third aspect of the embodiments of this application, a computing device is provided, comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the steps of the fault diagnosis method for the electrical system of the davit based on LightGBM-Transformer.
[0013] According to a fourth aspect of the embodiments of this application, a computer-readable storage medium is provided that stores computer-executable instructions, which, when executed by a processor, implement the steps of the fault diagnosis method for the electrical system of the davit based on LightGBM-Transformer.
[0014] According to a fifth aspect of the present application, a computer program is provided, wherein when the computer program is executed in a computer, the computer is instructed to perform the steps of the above-described fault diagnosis method for the electrical system of a davit based on LightGBM-Transformer.
[0015] The fault diagnosis scheme for davit electrical systems based on LightGBM-Transformer provided in this application has the following advantages: LightGBM, as a traditional machine learning model, excels at processing tabular data, boasting high training speed and low memory consumption, but it is relatively weak in handling complex temporal dependencies and sequential data; Transformer, as a deep learning model, can efficiently capture long-distance dependencies in sequential data and is suitable for long-sequence data classification tasks, but its computational complexity is high, requiring powerful hardware support. For davit electrical system status data, the CQSCA-LightGBM+BO-Transformer combined algorithm can more efficiently handle complex fault modes, improving the model's robustness and generalization ability, as detailed below: (1) Combination of global optimization capability and local refinement: CQSCA provides LightGBM with powerful global optimization capability in fault diagnosis. Through chaotic mapping and quantum rotation mechanism, it can explore extensively in the huge hyperparameter space and quickly locate the optimal region. BO-optimized Transformer uses a surrogate model to perform local refinement search on the hyperparameters of the Transformer model, such as the number of self-attention heads and the number of encoder layers. When processing time series data in fault diagnosis, BO helps improve the accuracy of the model in details by progressively refining the search region. Combining the two, CQSCA global optimization provides extensive search, while BO local optimization ensures precise adjustment of hyperparameters within the optimal region, improving the overall diagnostic performance.
[0016] (2) Reduced computational complexity: In fault diagnosis tasks, CQSCA-LightGBM avoids global traversal of the entire search space by locating potential effective regions in the initial stage, thereby reducing the consumption of computational resources and significantly reducing computational complexity. BO can intelligently select a small number of samples for optimization, thereby reducing the computational cost of Transformer hyperparameter tuning. This allows the Transformer to avoid excessive trial and error in the high-dimensional hyperparameter space, thus reducing the amount of computation required for each training round. Therefore, the combination of CQSCA-LightGBM and BO-Transformer not only reduces the number of model training and hyperparameter searches, but also significantly reduces the computational complexity in the fault diagnosis process.
[0017] (3) Adapting to High-Dimensional Complex Problems: Fault diagnosis tasks often involve complex, high-dimensional data and multiple hyperparameters. CQSCA-optimized LightGBM helps to quickly find the optimal hyperparameters when dealing with high-dimensional, complex interactive tabular data, thereby improving LightGBM's performance on high-dimensional data. Especially in fault diagnosis, the data usually contains many feature interactions, and CQSCA-LightGBM can effectively identify these interactions, avoiding the model from getting trapped in local optima; BO-Transformer can improve the model's ability to capture long-distance dependencies when processing high-dimensional time-series data. Therefore, the combined algorithm of CQSCA-LightGBM+BO-Transformer can cope with high-dimensional, complex data problems.
[0018] (4) Robustness and high accuracy: In fault diagnosis tasks, the CQSCA-LightGBM+BO-Transformer combined algorithm, especially in complex time series data scenarios, combines the advantages of each algorithm to ensure that the model avoids local optima in multiple rounds of optimization, and ensures the stability and high accuracy of the model, ultimately improving the overall effect of fault diagnosis.
[0019] (5) Addressing the problem of imbalanced data: When facing imbalanced data, LightGBM usually needs to adjust some specific hyperparameters, such as feature importance, loss function adjustment, and number of leaves in the tree. CQSCA can effectively improve the model's attention to minority class data by precisely adjusting the feature importance of LightGBM in the initial stage, ensuring that the model does not favor predicting normal class data; BO can adjust the training strategy of Transformer through optimization, making it more robust on imbalanced data, especially in time series data, it can focus on capturing subtle patterns of fault occurrence, thereby improving the recognition rate of minority class data. Attached Figure Description
[0020] Figure 1 This is a flowchart of a fault diagnosis method for an electrical system of a davit based on LightGBM-Transformer, provided in Embodiment 1 of the present invention. Figure 2 A flowchart of the CQSCA optimization process provided in this embodiment of the invention; Figure 3 A schematic diagram of the improved LightGBM model provided in the embodiments of the present invention; Figure 4 The importance score map of the top 15 features of LightGBM output provided in this embodiment of the invention; Figure 5 A flowchart of the BO optimization process provided in this embodiment of the invention; Figure 6 A schematic diagram of the improved Transformer model provided in an embodiment of the present invention; Figure 7 This is a flowchart of the fault diagnosis method for the electrical system of a davit based on LightGBM-Transformer provided in Embodiment 2 of the present invention; Figure 8 This is a schematic diagram of a fault diagnosis system for the electrical system of a davit based on LightGBM-Transformer, provided in an embodiment of the present invention. Detailed Implementation
[0021] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. In the following description, suffixes such as "module," "part," or "unit" used to denote elements are used only for the purpose of illustrative purposes and have no inherent meaning. Therefore, "module," "part," or "unit" may be used interchangeably.
[0022] This application provides a fault diagnosis method for the electrical system of a davit based on LightGBM-Transformer. This application also relates to a fault diagnosis system for the electrical system of a davit based on LightGBM-Transformer, a computing device, a computer-readable storage medium, and a computer program, which will be described in detail in the following embodiments.
[0023] This invention provides a fault diagnosis method and system for davit electrical systems based on LightGBM-Transformer. The system obtains the operating status of the davit under normal operation and when a fault is injected. After preprocessing, the system uses an improved LightGBM for feature extraction and combines it with an improved Transformer model for classification. While reducing the computational load of the model, the system can achieve high-precision fault diagnosis of the davit electrical system. The fusion of multiple optimization strategies significantly enhances the robustness and reliability of the diagnostic system, especially under the condition of unbalanced fault data.
[0024] Example 1: The following is combined Figures 1-6 A typical embodiment of the present invention will be further explained and described. like Figure 1 As shown, a fault diagnosis method for the electrical system of a davit based on LightGBM-Transformer is provided, and the specific steps are as follows: Step 1: Obtain the operating status data of the davit electrical system; Step 2: After data preprocessing, we obtain the training set, validation set, and test set; Step 3: Train the improved LightGBM model to extract leaf node features from the data; Step 4: Calculate the importance of each tree and select the leaf features of the top 50 trees as input; Step 5: Use the dimensionality-reduced features as input to the improved Transformer model to classify fault types; Step 6: Evaluate and visualize the model, and save it for later use.
[0025] Step 1 describes a data acquisition system developed using LabVIEW software. Its components include sensors, a data acquisition card, a host computer, and a power supply system. The system collects data such as three-phase voltage and current of the pump station motor and winch motor, incoming line voltage and current, temperature, and 12 switch quantity detection data. The sampling frequency is 30Hz. The specific data acquisition field names are shown in Table 1 below. Table 1. Electrical System Parameter Description Step 2 involves loading and cleaning faulty data from the Excel file, handling missing data, non-numerical features, and categorical variables, and scaling the numerical values using a standard scaler to improve model performance. The specific steps are as follows: Step 2.1: Load the fault data from the Excel file, set the window size to 15, the step size to 1, and divide it into training set, validation set, and test set, setting a total of 13 categories of normal and fault modes. The category mapping relationship is shown in Table 2 below: Table 2 Fault Categories and Numbers Step 2.2: Check the dataset for missing values and handle missing values. Furthermore, the mean imputation method is used to impute missing values for all numerical features. For each missing value... Use the mean of this column. filling: in, This is the number of samples that are not missing in this column. It represents the value of each sample in the features that is not missing; Step 2.3: By traversing all columns, identify non-numeric columns and date / time columns, and process them accordingly. Specifically, attempt to convert non-numeric columns to numeric columns; delete those that cannot be converted. For date / time columns, convert them to time characteristics. Step 2.4: Separate feature data and label data. The feature column contains all columns except fault_type and fault_label. All feature data is stored in x, and fault type labels are stored in y for subsequent processing. Step 2.5: Use LabelEncoder to convert the label data from non-integer values to integer values; Step 2.6: Check whether the feature dimensions of the training set, validation set, and test set are consistent to avoid errors in subsequent calculations due to inconsistent dimensions; Step 2.7: Standardize the data using StandardScale to adjust the mean to 0 and the standard deviation to 1, ensuring that each feature has the same scale, thus guaranteeing the stability of the model and accelerating training. Furthermore, calculate the mean of each column's features: Calculate the standard deviation for each column: Perform standardization conversion: in, represents each sample value in the feature, and N is the number of samples; Step 2.8: Use the joblib library to save the normalizer object as a .pkl file for future standardization of new data.
[0026] Step 3 includes using a LightGBM model optimized with CQSCA (Chaos Quantum Sine Cosine Algorithm) and training the improved LightGBM model to extract features from the data and output them.
[0027] As a further technical solution, the improved LightGBM model is a LightGBM model optimized by the chaotic quantum sine and cosine algorithm. The specific CQSCA hyperparameter tuning process is as follows: Figure 2 As shown, it specifically includes: Step 3.1: Generate a population. Each individual in the population represents a possible combination of hyperparameters. Each individual consists of a set of randomly initialized hyperparameter values, which are set according to the range of hyperparameter values, as shown in the following formula: in, For the first Individual hyperparameter configurations For hyperparameters, It is the hyperparameter dimension; Furthermore, the population size (population_size) is set to 50, the maximum number of iterations (max_iterations) is set to 100, and the optimization range of LightGBM parameters is defined, including eight parameters: number of leaf nodes (10, 63), learning rate (0.01, 0.3), feature sampling ratio (0.5, 1.0), sample sampling ratio (0.5, 1.0), L1 regularization coefficient (0.0, 2.0), L2 regularization coefficient (0.0, 2.0), minimum number of samples per leaf node (2, 20), and sampling frequency (0.2, 2.0). Step 3.2: Use chaotic mapping to enhance the diversity of individuals and the randomness of the search; Furthermore, the chaotic mapping adopts the Logistic mapping, and the chaotic value is updated by formula (7), as follows: in, It is a constant of the chaotic mapping, taken as... , It is the chaos value of the current individual. It is the updated chaos value; Step 3.3: Update the population by adjusting the initial position of individuals using a sine or cosine function combined with chaotic values; Furthermore, CQSCA incorporates the results of chaotic mapping into the weights, generating the intermediate state positions of individuals using sine and cosine formulas. , as shown ,Mode : Sine Update: Cosine update: in, It is the first The first individual One hyperparameter, , , , It is a random number. It is the th global optimal solution One hyperparameter; Step 3.4: Use quantum rotation to finally update the position of each individual, thereby introducing global information and escaping local optima; Furthermore, based on the intermediate state position generated in step 3.3 and the position of the global optimal solution, the rotation angle is used... The formula for phase superposition is as follows: in, This represents the intermediate state position after sine and cosine updates. This is the globally optimal solution. The rotation angle; Step 3.5: Evaluate the hyperparameter configuration for each individual using the objective function; Step 3.6: If the fitness of an individual is better than the current optimal solution, then update the current optimal solution. The new optimal solution will become the reference point for the optimal solution in the search space. Step 3.7: Repeat the iterative optimization until the maximum number of iterations or the convergence condition is reached. Update the hyperparameter configuration in the population in each iteration to finally find the optimal hyperparameter solution.
[0028] As a further technical solution, such as Figure 3 As shown, the improved LightGBM model is trained, and features are extracted from the data and output, including the following steps: Step 4.1: Set the LightGBM hyperparameters, including the number of leaf nodes num_leaves, learning rate learning_rate, feature sampling ratio feature_fraction, sample sampling ratio bagging_fraction, regularization coefficients lambda_l1 and lambda_l2, minimum number of samples per leaf node min_data_in_leaf, and sampling frequency bagging_freq; Step 4.2: Initialize the LightGBM model by converting the training and validation data into a dataset format usable by the LightGBM model using lgb.Dataset; Step 4.3: Optimize using the CQSCA algorithm. The optimizer searches within a given parameter range to find a set of optimal LightGBM hyperparameters. The optimized parameters are then passed to the LightGBM model for training. Specifically, the optimized parameter values are: number of leaf nodes num_leaves = 10, learning rate = 0.046, feature fraction = 0.5, sampling fraction bagging fraction = 0.5, regularization coefficients lambda_l1 = 0.762, lambda_l2 = 0.477, minimum number of samples per leaf node min_data_in_leaf = 3, and sampling frequency bagging_freq = 2.0. Furthermore, LightGBM is an efficient implementation based on Gradient Boosting Decision Tree (GBDT). Its training process core involves iteratively constructing multiple decision trees to gradually reduce prediction error. After obtaining the optimal hyperparameters through CQSCA, a fitness function `fitness_func` is defined to train the LightGBM model based on the input hyperparameters. The formula for the fitness function `fitness_func` is as follows: Multi_LogLoss is a softmax-based log loss function for multi-class classification. It measures classification performance by minimizing the cross-entropy between the model's predicted probability distribution and the true class, as shown in the following formula: in, To predict the number of samples, For the number of categories, For the true classification, that is, the first The sample belongs to the first kind, To predict the classification probability for the model, i.e. the first... The sample belongs to the first The probability of a class; The objective function of LightGBM consists of a loss function and a regularization term, as shown in the following formula: in, For loss function, For regularization terms, For the first The regularization term for the tree is used to limit the complexity of the model and avoid overfitting. The formula is as follows: in, The regularization coefficient is . The number of leaf nodes. For the first The score of each leaf node; The decision tree is built iteratively using the `lgb.train` function. In each iteration, the negative gradient of the current model is calculated, and a new decision tree is fitted to predict that gradient. The contribution of the new tree is controlled by the `learning_rate`, the maximum number of iterations is set to `num_boost_round=50`, and an early stopping strategy (`early_stopping`) is used to prevent overfitting. Step 4.4: After training is complete, extract the feature vectors using the indexes of the leaf nodes of each tree; Furthermore, LightGBM's feature extraction primarily uses the `pred_leaf=True` parameter to obtain the leaf node indices of each tree as new features. Specifically, leaf node index features are obtained for the training set, validation set, and test set, respectively. Step 4.5: Output the extracted features as input to improve the Transformer model, and output the importance scores of each feature to evaluate the contribution of different features to the model's decision. For example, ... Figure 4 The following is a map showing the importance scores of the top 15 features output by LightGBM; Furthermore, the leaf node features extracted in step 4.4 have high dimensionality, so these features need to be further filtered to select the most meaningful features for subsequent Tansformer model training.
[0029] In step 4, tree information is obtained through tree_info, the importance of each tree is calculated based on the split_gain of each tree, and the leaf features of the top 50 trees are selected as input. Step 5 includes classifying a Transformer model optimized using the Bayesian Optimization (BO) algorithm and training an improved Transformer model. As a further technical solution, the Transformer model optimized by the Bayesian optimization algorithm (BO) is as follows: Figure 5 As shown, it includes the following steps: Step 5.1: Initialize the Bayesian optimizer and define the search range of hyperparameters; Furthermore, the number of iterations for Bayesian optimization is set to n_iter=50, the number of initial random sampling points is set to init_points=5, and the upper confidence boundary is set to kappa=2.576. The optimization range of Transformer parameters is defined, including the number of Transformer blocks (1, 12), the dimension of attention heads (8, 128), the number of attention heads (2, 16), the dimension of the feedforward network (64, 2048), the dropout ratio (0.1, 0.5), the number of fully connected layers (1, 3), the number of units in the fully connected layers (32, 128), the learning rate (0.0001, 0.01), and the training batch size (16, 128), for a total of 9 parameters. Step 5.2: Define the fitness function, which returns the accuracy on the validation set as the optimization objective; Furthermore, the Bayesian optimization defaults to minimizing the fitness function, training on the training set for 20 epochs, with the goal of maximizing the validation set accuracy. The validation set accuracy from the last epoch is then used, calculated... As a fitness value; Step 5.3: Model the hyperparameter space based on Gaussian process regression, and select the next hyperparameter combination most likely to improve performance through the acquisition function; Furthermore, in Bayesian optimization, Gaussian process regression is used to create a probabilistic model of the objective function. This model estimates the behavior of the objective function using existing sample data and provides a predicted value and a measure of uncertainty for each possible input point. A Gaussian process defines the joint distribution of function values, assuming the function values come from a multivariate Gaussian distribution: in, It is the mean function. It refers to the kernel function. The Bayesian optimization selects the overall kernel function as follows: Among them, the Matern kernel offers greater flexibility in controlling the smoothness of the function, as shown in the following formula: in, It is the Euclidean distance between two points. For length scale, It is a modified Bessel function. It is a smoothness parameter that controls the smoothness of the function; constant kernel The formula is: in, Indicates the magnitude of the output data; White noise kernel The formula is: in, The variance of the noise represents the noise level in the input data. Furthermore, the key to Bayesian optimization is to guide the search of the hyperparameter space through a Gaussian process, selecting the hyperparameter combination most likely to improve performance. To achieve this, a sampling function is used to determine the next evaluation point; this sampling function selects the optimal sampling point based on the predictions (i.e., mean and variance) of the current surrogate model. The expected improvement (EI) is chosen as the acquisition function, which attempts to maximize the improvement between the current best function value and the predicted function value, as shown in the following formula: in, This is the best assessment point at present; Step 5.4: Find the optimal combination of hyperparameters through continuous iteration and return the optimal hyperparameters.
[0030] As a further technical solution, such as Figure 6 As shown, the improved Transformer model, where training the improved Transformer model for classification includes the following steps: Step 6.1: Adjust the features extracted by the improved LightGBM to a format suitable for the input of the Transformer model, i.e., three-dimensional data [samples, features, 1], where each feature needs to have one channel. Step 6.2: Optimize the hyperparameters of the Transformer model using Bayesian optimization, namely the number of Transformer blocks, the dimension of the attention head, the number of attention heads, the dimension of the feedforward network, the dropout ratio, the number of fully connected layers, the number of units in the fully connected layer, the learning rate, and the training batch size. Step 6.3: Construct the initial Transformer model and use a Transformer block with multi-head self-attention mechanism and feedforward neural network to process the input data; Furthermore, because the Transformer has a self-attention mechanism, it can handle sequence data. When inputting the features extracted by LightGBM into the Transformer, a positional encoding needs to be added to each position to preserve the positional information of each sample in the sequence. Positional encodings are typically generated using sine and cosine functions. in, For the position encoding matrix, The position of the sample in the sequence. The dimension index of the encoded vector. The dimension of the position encoding vector; In the Transformer encoder, the self-attention mechanism is a core component, and its calculation formula is as follows: in, These are the query, key, and value vector spaces, respectively. This is a scaling factor used to prevent gradient vanishing; To enhance the model's ability to capture complex semantic and structural information in sequence data and improve feature representation performance, Transformer typically uses a multi-head attention mechanism, as shown in the following formula: in, , representing the feature matrix of a single attention. For the number of attention heads, For each dimension of attention head, This is the weight matrix; After each Transformer layer, the output from the self-attention mechanism passes through a feedforward neural network. While multi-head self-attention can effectively capture dependencies and global information in a sequence, the feedforward neural network can perform further nonlinear transformations on this information to learn more complex feature representations. The formula is as follows: in, and It is the weight matrix of the feedforward neural network. and It is the bias vector; In Transformer, residual connections are typically used between each sub-layer (such as self-attention layers and feedforward layers). This means that the output of each sub-layer is added to its input before being passed to the next layer, as shown in the formula: in, For residual layer output, For the output of the sub-layer, For input to the sub-layer; Layer normalization normalizes the output of each layer, ensuring that the inputs of each layer have a similar distribution, thereby accelerating training. Its core principle is to normalize the feature dimensions of individual samples, as shown in the following formula: For the input vector Layer normalization first calculates the mean and variance of the vector: Then, the input is normalized using the mean and variance: in, It is a very small constant used to avoid division by zero errors; Finally, scaling and translation are used to restore the model's expressive power, as shown in the following formula: Wherein, scaling factor Translation factor All dimensions are .
[0031] Step 6.4: Use Bayesian optimization to search for the optimal hyperparameters and train the final Transformer model. The specific optimized parameter values are: number of Transformer blocks num_transformer_blocks=10, attention head dimension head_size=90, number of attention heads num_heads=3, feedforward network dimension ff_dim=913, dropout ratio dropout_rate=0.239, number of fully connected layers num_dense_layers=2, number of fully connected layer units dense_units=45, learning rate learning_rate=0.005, and training batch size batch_size=74. Step 6.5: The model is processed through an MLP layer, using the softmax function for prediction, and the F1 score is calculated and a classification report is generated through an evaluation method.
[0032] Furthermore, based on the confusion matrix, the accuracy, precision, and recall are output using the following formulas: Step 6 involves model evaluation and visualization, followed by saving for later use.
[0033] Example 2: This embodiment provides a fault diagnosis system for the electrical system of a davit based on LightGBM-Transformer, as follows: Module 1: Configured to acquire operating status data of the davit electrical system; Module 2: Configured to obtain training, validation, and test sets after data preprocessing; Module 3: Configured to train using an improved LightGBM model to extract leaf node features from the data; Module 4: is configured to calculate the importance of each tree and select the leaf features of the top 50 trees as input; Module 5: Configured to use the reduced-dimensional features as input to the improved Transformer model to classify fault types; Module 6: Configured for model evaluation and visualization, saved for later use.
[0034] Example 3: This embodiment also provides an electronic device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement the fault diagnosis method for the davit electrical system based on LightGBM-Transformer.
[0035] Example 4: This embodiment also provides a computer-readable storage medium, which includes a stored computer program, wherein the computer program, when running, controls the device where the computer-readable storage medium is located to execute the fault diagnosis method for the davit electrical system based on LightGBM-Transformer.
[0036] Example 5: Figure 7 A flowchart of a fault diagnosis method for an electrical system of a davit based on LightGBM-Transformer, according to an embodiment of this application, is shown, which specifically includes the following steps.
[0037] Step S101: Obtain the current operating status data of the davit electrical system, and obtain preprocessed current operating status data by preprocessing the current operating status data; Step S102: By inputting the preprocessed current operating status data into the trained improved LightGBM model, the feature data of the davit electrical system are obtained; In one specific embodiment of this application, the improved LightGBM model is a model in which the hyperparameters of the LightGBM model are optimized using the Chaotic Quantum Sine and Cosine Algorithm (CQSCA); wherein, the improved LightGBM model includes: Generate a population consisting of multiple individuals; In each optimization iteration, the hyperparameter configuration of each individual in the population is updated using chaotic mapping and quantum rotation to obtain the updated hyperparameter configuration of each individual in the population. Repeatedly iterate and optimize until the maximum number of iterations or the convergence condition is reached. The hyperparameter configuration in the population is updated in each iteration, and the optimal hyperparameters are finally found.
[0038] In one specific embodiment of this application, the trained improved LightGBM model includes: Obtain the optimal LightGBM hyperparameters and pass them to the LightGBM model for training to obtain a trained improved LightGBM model.
[0039] Step S103: By inputting the feature data of the davit electrical system into the trained improved Transformer model, the fault diagnosis results of the davit electrical system are obtained.
[0040] In one specific embodiment of this application, the improved Transformer model is a model that optimizes the hyperparameters in the Transformer model using a Bayesian optimization algorithm, wherein the improved Transformer model includes: Initialize the Bayesian optimizer, and define the search range of hyperparameters and the fitness function; The search range of hyperparameters is modeled based on Gaussian process regression, and the combination of hyperparameters most likely to improve performance is selected by collecting fitness functions. Repeatedly iterate and optimize until the maximum number of iterations or the convergence condition is reached. Update the hyperparameter combination that is most likely to improve performance in each iteration, and finally find the optimal hyperparameter combination.
[0041] In one specific embodiment of this application, the trained improved Transformer model includes: Obtain the optimal combination of hyperparameters and pass it to the Transformer model for training to obtain a trained improved Transformer model.
[0042] After obtaining the fault diagnosis results of the davit electrical system, the davit provided in this embodiment further includes: obtaining the current operating status data of the davit mechanical system, and obtaining preprocessed current operating status data by preprocessing the current operating status data; obtaining feature data of the davit mechanical system by inputting the preprocessed current operating status data into a trained improved LightGBM model; and obtaining the fault diagnosis results of the davit mechanical system by inputting the feature data of the davit mechanical system into a trained improved Transformer model.
[0043] The specific steps are as follows: Step 1: Obtain the operating status data of the davit mechanical system; Furthermore, the data acquisition system is developed based on LabVIEW software. Its components include sensors, a data acquisition card, a host computer, and a power supply system. The data it collects includes: lateral strain on the boom surface, bolt vibration, bearing vibration, boom rope displacement, lifting speed, boom tension, etc. The sampling frequency is 12.8kHz. The specific data acquisition field names are shown in Table 3 below. Table 3 Mechanical System Parameter Description Step 2: After data preprocessing, we obtain the training set, validation set, and test set; Load fault data from an Excel file, set the window size to 1024, the step size to 1024, and divide the data into training, validation, and test sets. A total of six categories of normal and fault modes are set, and the category mapping relationship is shown in Table 4 below. Table 4 Fault Categories and Numbers Step 3: Train the improved LightGBM model to extract leaf node features from the data; Step 4: Calculate the importance of each tree and select the leaf features of the top 50 trees as input; Step 5: Use the dimensionality-reduced features as input to the improved Transformer model to classify fault types; Step 6: Evaluate and visualize the model, and save it for later use.
[0044] After obtaining the fault diagnosis results of the davit electrical system, the davit provided in this embodiment further includes: obtaining the current operating status data of the davit hydraulic system, and obtaining preprocessed current operating status data by preprocessing the current operating status data; obtaining feature data of the davit hydraulic system by inputting the preprocessed current operating status data into a trained improved LightGBM model; and obtaining the fault diagnosis results of the davit hydraulic system by inputting the feature data of the davit hydraulic system into a trained improved Transformer model.
[0045] The specific steps are as follows: Step 1: Obtain the operating status data of the davit hydraulic system; The data acquisition system is developed based on LabVIEW software. Its components include sensors, a data acquisition card, a host computer, and a power supply system. The data it collects includes: accumulator nitrogen pressure, accumulator hydraulic oil pressure, pressure gauge pressure, manual directional valve A-port pressure, solenoid directional valve A-port pressure, front boom cylinder pressure, middle boom cylinder pressure, return oil pressure, etc. The sampling frequency is 30Hz. The specific data acquisition field names are shown in Table 5 below. Table 5 Hydraulic System Parameter Description Step 2: After data preprocessing, we obtain the training set, validation set, and test set; Load fault data from an Excel file, set the window size to 30, the step size to 15, and divide it into training set, validation set, and test set. A total of 7 categories of normal and fault modes are set, and the category mapping relationship is shown in Table 6 below: Table 6 Fault Categories and Numbers Step 3: Train the improved LightGBM model to extract leaf node features from the data; Step 4: Calculate the importance of each tree and select the leaf features of the top 50 trees as input; Step 5: Use the dimensionality-reduced features as input to the improved Transformer model to classify fault types; Step 6: Evaluate and visualize the model, and save it for later use.
[0046] This embodiment also includes: obtaining the final fault diagnosis result of the davit based on the fault diagnosis results of the davit electrical system, the davit mechanical system, and the davit hydraulic system, wherein the formula includes: in, The results of fault diagnosis for the davit system; The results of fault diagnosis for the mechanical system; The results of fault diagnosis for the electrical system; This is the result of fault diagnosis for the hydraulic system.
[0047] Furthermore, considering the independent physical dimensions and heterogeneous sampling characteristics of the input parameters of the three subsystems of the davit frame (mechanical, electrical, and hydraulic), a joint posterior probability decision mechanism based on series reliability theory is adopted at the decision level. Let the independent fault models of the three subsystems output the probabilities of failure (i.e., fault diagnosis results) respectively. , and The final joint failure probability formula for the davit system is as follows: in, The combined failure probability of the davit system is given, and this combined failure probability is used as the davit failure diagnosis result, and when... The system provides fault warnings in real time.
[0048] Example 6: This application also provides an embodiment of a fault diagnosis system for the electrical system of a davit based on the LightGBM-Transformer. Figure 8 This illustration shows a structural schematic diagram of a fault diagnosis system for a davit based on the LightGBM-Transformer davit electrical system, according to an embodiment of this application. Figure 8 As shown, the system includes: The preprocessing module is configured to acquire the current operating status data of the davit electrical system and obtain preprocessed current operating status data by preprocessing the current operating status data. The feature data acquisition module is configured to obtain feature data of the davit electrical system by inputting the preprocessed current operating state data into the trained improved LightGBM model; The fault diagnosis module is configured to obtain fault diagnosis results of the davit electrical system by inputting the feature data of the davit electrical system into a trained improved Transformer model.
[0049] In one specific embodiment of this application, the improved LightGBM model is a model in which the hyperparameters of the LightGBM model are optimized using the Chaotic Quantum Sine and Cosine Algorithm (CQSCA); the improved Transformer model is a model in which the hyperparameters of the Transformer model are optimized using the Bayesian optimization algorithm.
[0050] The above is a schematic scheme of a fault diagnosis system for the electrical system of a davit based on the LightGBM-Transformer, according to this embodiment. It should be noted that the technical solution of this fault diagnosis system for the electrical system of a davit based on the LightGBM-Transformer belongs to the same concept as the technical solution of the fault diagnosis method for the electrical system of a davit based on the LightGBM-Transformer described above. Details not described in detail in the technical solution of the fault diagnosis system for the electrical system of a davit based on the LightGBM-Transformer can be found in the description of the technical solution of the fault diagnosis method for the electrical system of a davit based on the LightGBM-Transformer described above.
[0051] The preferred embodiments of the present invention have been described above with reference to the accompanying drawings, but this does not limit the scope of the invention. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and spirit of the present invention should be within the scope of the present invention.
Claims
1. A fault diagnosis method for the electrical system of a davit based on LightGBM-Transformer, characterized in that, include: The current operating status data of the davit electrical system is obtained, and the current operating status data is preprocessed to obtain preprocessed current operating status data. By inputting the preprocessed current operating status data into the trained improved LightGBM model, the feature data of the davit electrical system are obtained; By inputting the characteristic data of the davit electrical system into the trained improved Transformer model, the fault diagnosis results of the davit electrical system are obtained.
2. The method according to claim 1, characterized in that, The improved LightGBM model is a model whose hyperparameters are optimized using the Chaotic Quantum Sine and Cosine Algorithm (CQSCA); the improved Transformer model is a model whose hyperparameters are optimized using the Bayesian optimization algorithm.
3. The method according to claim 2, characterized in that, The improved LightGBM model includes: Generate a population consisting of multiple individuals; In each optimization iteration, the hyperparameter configuration of each individual in the population is updated using chaotic mapping and quantum rotation to obtain the updated hyperparameter configuration of each individual in the population. Repeatedly iterate and optimize until the maximum number of iterations or the convergence condition is reached. The hyperparameter configuration in the population is updated in each iteration, and the optimal hyperparameters are finally found.
4. The method according to claim 3, characterized in that, The trained improved LightGBM model includes: Obtain the optimal LightGBM hyperparameters and pass them to the LightGBM model for training to obtain a trained improved LightGBM model.
5. The method according to claim 2, characterized in that, The improved Transformer model includes: Initialize the Bayesian optimizer, and define the search range of hyperparameters and the fitness function; The search range of hyperparameters is modeled based on Gaussian process regression, and the combination of hyperparameters most likely to improve performance is selected by collecting fitness functions. Repeatedly iterate and optimize until the maximum number of iterations or the convergence condition is reached. Update the hyperparameter combination that is most likely to improve performance in each iteration, and finally find the optimal hyperparameter combination.
6. The method according to claim 5, characterized in that, The trained improved Transformer model includes: Obtain the optimal combination of hyperparameters and pass it to the Transformer model for training to obtain a trained improved Transformer model.
7. A fault diagnosis system for the electrical system of a davit based on LightGBM-Transformer, characterized in that, include: The preprocessing module is configured to acquire the current operating status data of the davit electrical system and obtain preprocessed current operating status data by preprocessing the current operating status data. The feature data acquisition module is configured to obtain feature data of the davit electrical system by inputting the preprocessed current operating state data into the trained improved LightGBM model; The fault diagnosis module is configured to obtain fault diagnosis results of the davit electrical system by inputting the feature data of the davit electrical system into a trained improved Transformer model.
8. The system according to claim 7, characterized in that, The improved LightGBM model is a model whose hyperparameters are optimized using the Chaotic Quantum Sine and Cosine Algorithm (CQSCA); the improved Transformer model is a model whose hyperparameters are optimized using the Bayesian optimization algorithm.
9. A computing device, comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, they implement the steps of the fault diagnosis method for the electrical system of the davit based on any one of claims 1 to 6.
10. A computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the fault diagnosis method for the electrical system of a davit based on any one of claims 1 to 6.