Hydraulic system fault diagnosis method based on data-driven stacking model
By constructing an RF-XGB model and combining sliding window mid-range filtering and zero-mean unit variance standardization to process sensor data, the problem of poor fault diagnosis in hydraulic systems was solved, achieving high-accuracy and robust fault diagnosis of hydraulic systems and reducing maintenance costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-09
- Publication Date
- 2026-04-10
AI Technical Summary
Existing methods for diagnosing hydraulic system faults are not very effective, especially for complex models where the diagnostic results are difficult to trace, and they often focus on a single hydraulic component, limiting their practicality.
An ensemble model RF-XGB was constructed using Random Forest (RF) and XGBoost. Sensor data was processed by sliding window mean filtering and zero-mean unit variance standardization. The RF-XGB model was then used for fault diagnosis. Multiple decision trees were constructed using Random Forest and weights were assigned to the trees. XGBoost was used for gradient boosting and regularization to improve the accuracy and robustness of the model.
It achieves high accuracy and robustness in hydraulic system fault diagnosis, can quickly generalize to new fault scenarios, reduces reliance on large-scale physical test data, shortens the diagnosis cycle and reduces maintenance costs.
Smart Images

Figure CN121834577A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of hydraulic system fault diagnosis, and particularly relates to a hydraulic system fault diagnosis method based on a data-driven stacked model. BACKGROUND
[0002] As the core power transmission and control unit of engineering machinery, the technical performance of the hydraulic system directly determines the work efficiency and reliability of the equipment. As a key subsystem of large engineering machinery such as excavators, loaders and cranes, the hydraulic system realizes efficient conversion of mechanical energy and hydraulic energy through precise pressure control and flow distribution, providing power support for multi-dimensional action execution of the equipment. Since the hydraulic system involves multiple complex components and operating parameters, its faults are frequent and diverse. Common hydraulic system faults mainly include pressure abnormalities, flow fluctuations, oil leaks, increased noise, etc., involving components such as hydraulic pumps, hydraulic motors, hydraulic valves, hydraulic oil lines, oil tanks, and oil.
[0003] As a key power transmission device, the fault diagnosis of the hydraulic system has always been a research hotspot and difficulty in the field of engineering machinery. The hydraulic system is complex in structure, involving multiple precision components and high-pressure circuits, and its fault types are diverse and have concealment and chain effect, posing great challenges to traditional fault diagnosis methods. In recent years, with the rapid development of sensor technology, signal processing technology and artificial intelligence technology, the hydraulic system fault diagnosis technology has made significant progress, but it still faces the problems of poor effect of simple fault diagnosis methods and difficulty in tracing analysis of complex model diagnosis results. With the rise of machine learning and deep learning, intelligent fault diagnosis methods based on data-driven have been widely applied in hydraulic system fault diagnosis. Machine learning automatically learns the potential patterns and fault features in the data through analysis of a large amount of historical operation data, significantly improving the efficiency and accuracy of fault diagnosis, and further improving the performance of the model through different integration schemes. Integrated model fault diagnosis has become an important development direction of fault diagnosis technology. However, the use of neural networks, convolutional neural networks and other methods mainly realizes decision-making through highly nonlinear transformation and hierarchical feature abstraction, and the "black box" characteristic makes it difficult to trace the internal decision logic, and the accuracy needs to be further improved. Moreover, most of them focus on a kind of hydraulic component, and the practicality is limited. SUMMARY
[0004] The present application aims to provide a hydraulic system fault diagnosis method based on a data-driven stacked model, solving the technical problem of poor effect of existing hydraulic system fault diagnosis methods.
[0005] According to actual engineering requirements, Random Forest (RF) and XGBoost are introduced to construct an integrated model RF-XGB model to diagnose hydraulic system fault features.
[0006] To achieve the above object, the technical scheme adopted by the present application is as follows: A hydraulic system fault diagnosis method based on a data-driven stacking model, the method comprising the following steps: Step 1: Determine the state of the hydraulic system and the hydraulic system performance parameters as the judgment index, construct the hydraulic system performance parameter and hydraulic system state data set, preliminarily analyze the correlation based on the data, and eliminate irrelevant influencing factors; Step 2: Establish an RF-XGB model based on hydraulic system fault diagnosis to realize fault diagnosis; Further, in step 1, in order to construct the data-driven diagnosis model, the state sensor data of the hydraulic system is integrated into a binary tuple with the structure of ( D, O ), wherein D represents the hydraulic system performance parameters, i.e. features, including pressure, motor power, volume flow, temperature and vibration, O represents the current state of the hydraulic system, such as normal operation of the cooler, slight lag of the valve and internal pump leakage, etc., the feature data is integrated from a vector to a feature matrix, and the data set is established based on this, in the data set, C i represents the i th sample data, i =1, 2, …, n , D j represents the j th hydraulic system performance parameter, j =1, 2, …, m , O k represents the k th current state of the hydraulic system, k =1, 2, …, q .
[0007] Further, in step 2, the RF-XGB model takes random forest as the base learner and XGBoost as the meta-learner to establish the fault diagnosis model, in order to eliminate the influence of different dimensions on model training, zero-mean unit variance method is adopted to standardize all features to obtain , the formula is: (1) (2) (3) represents the average value, represents the standard deviation, represents the data obtained after standardization.
[0008] In view of the short-time pulse noise in the hydraulic signal, a sliding window median filter is introduced to smooth abnormal fluctuations and retain the fault precursor characteristics.
[0009] Further, the preprocessed data set is divided into a training set, a validation set and a test set in a ratio of 6:2:2; then a random forest (RF) model is taken as a base learner, a single tree corresponding training data set is formed by self-sampling of the training set, the RF model is trained, the self-sampling number is equal to the sample number of the training set, the number of trees of the RF model is M Each decision tree is constructed based on a CART (Classification And Regression Trees) algorithm; The Gini impurity of a node t is defined as: (4) Wherein P i represents the proportion of the t th class sample in the node i , q is the total number of sample state columns, when the samples in the node all belong to the same category, O i = 1, at this time Gini ( t )= 0, when the samples are uniformly distributed, the Gini impurity reaches the maximum value, and each tree randomly selects the square root of the total number of features to calculate the Gini impurity when splitting, so as to reduce the repetition of the same strong correlation features between different trees and improve the diversity of the random forest model. The purity difference of each sub-node before and after splitting is calculated, and the feature with the largest Gini impurity difference is selected for splitting; (5) Wherein Gini ( t ) is the Gini impurity of the current node, Gini ( t L ), Gini ( t R ) are the Gini impurities of the left and right child nodes, N t , N L and N R are the sample numbers of the current node and its left and right child nodes respectively; By maximizing the Gini impurity difference to achieve pure node splitting, the randomness and diversity between different trees are increased, the variance of the random forest model is reduced, and the generalization performance is improved. The left and right child nodes continue to split to the next level until the number of data in the child node is less than the set minimum number of data or the depth of the child node reaches the set maximum tree depth, then the splitting stops and the current tree construction is completed.
[0010] Furthermore, the RF model is improved by refining the training set. For a single tree, the unsampled samples are collected as out-of-bag samples, forming a shape of ( N OOB, k ) matrix, where N OOB is the number of samples outside the bag. The initial RF model predicts the number of samples outside the bag using the following formula: (6) in Indicator of hydraulic system status The probability prediction for the first i The out-of-bag error of the prediction results for each tree is calculated individually. The detection capability of the tree is evaluated based on its detection performance on out-of-bag samples. The error rate of the out-of-bag error test is calculated. e i The calculation formula is: (7) in This represents the out-of-bag prediction value for the tree sample. The true label of the sample; Then, based on the tree's out-of-bag error, a weighted calculation is performed using voting weights to obtain the tree. i Voting weight The calculation formula is: (8) in T This is a temperature smoothing coefficient used to effectively prevent weights from concentrating on a very small number of trees with low out-of-bag errors, thus preventing excessive weight concentration in the model. It ensures that the model retains diversity and stability when weights are assigned based on out-of-bag errors. Extending the weight calculation formula to all trees in the model allows us to express it as: (9) The weights of each tree in the model are assigned through normalization, and the final prediction result of the RF model is obtained. Represented as: (10) Furthermore, by employing a staking integration approach, the improved RF model is applied to each fault type of the current sample. O i Predicted probability B iAs a new feature, the original data is combined to construct the meta-learner training set. C '( C i , B To ensure that the meta-learner can access both linear and nonlinear information in the initial dataset, all variables in the initial dataset are retained.
[0011] Furthermore, the specific process of constructing the XGBoost model is as follows: by sequentially constructing several weak learners, each new tree fits the residual of the previous model or the negative gradient of the objective function, and the model prediction is accumulated in an additive manner. In classification tasks, the sign or probability is determined by accumulating the output. XGBoost introduces Taylor approximation of second derivative information, objective function regularization, column sampling, learning rate and tree structure constraints, automatic handling of missing values, and efficient parallelization and distributed implementation optimization methods. Using C' as the data sample, train the XGBoost model. The objective function of XGBoost is as follows: (11) In the formula Indicates the first i The complexity regularization term for trees, This represents the current loss. For the current sample, the logarithmic loss is defined as: (12) In the formula P i,o This represents the XGBoost model's predicted samples. i Category O The probability, For indicator functions, when When the category is the same as c =1, otherwise =0, by adjusting the objective function O b The second-order Taylor expansion approximation is used to calculate the gain of candidate splits. Gain The calculation formula is as follows: (13) in This represents the sum of the gradients of the left and right child nodes. Represents the sum of the second derivatives of the left and right child nodes, according to Gain The result with the largest value is split until the tree model is completed. The prediction results of each tree model are then summed to convert them into probabilities for comparison of each category. P i,k The final classification result of XGBoost is calculated. The calculation formula is as follows: (14) (15) Then, the accuracy of the model on the validation set is evaluated as follows: (16) Wherein TP is the number of positive samples correctly identified, FP is the number of false negatives, TN is the number of negative samples correctly identified, FN is the number of missed positive samples. If the model performance indicators do not meet the requirements, the optimal hyperparameters of RF and XGBoost are determined using Bayesian optimization.
[0012] The present application has the following beneficial effects due to the use of the above technical solutions: The hydraulic system state diagnosis method of the present application fuses RF and XGBoost models, establishes an RF-XGB model, and has strong interpretability. Random forest RF is used to construct multiple decision trees on massive sensor data, the performance of each tree of the random forest is evaluated and weighted through out-of-bag error, so that the model can robustly capture fault features in a noisy environment. The output probability of RF is used as a meta-feature, which is input into the XGBoost classifier together with the original sensor features. XGBoost further refines the boundary and improves the classification accuracy through gradient boosting strategy and regularization term. Compared with the mainstream LSTM-CNN and LSTM-DNN methods, the method has obvious advantages in precision and accuracy. The fault diagnosis accuracy of the method for various hydraulic system components can reach 100%. After Staking stacking, the model has the anti-overfitting ability of RF and the high learning speed of XGBoost, and can achieve excellent diagnosis effect under limited labeled samples. The method has strong robustness in the case of few features, so the present application can reduce the dependence on large-scale physical test data, can quickly generalize to new hydraulic fault scenarios, shorten the diagnosis cycle and reduce the maintenance cost. BRIEF DESCRIPTION OF DRAWINGS
[0013] Figure 1 is the method flowchart of the present application.
[0014] Figure 2 is the model learning and verification curve of the present application. DETAILED DESCRIPTION
[0015] For the purposes of the present invention, the technical solutions and advantages will be further described in detail below with reference to the drawings and preferred embodiments. However, it should be noted that many details listed in the description are only to enable the reader to have a thorough understanding of one or more aspects of the present invention, and the aspects of the present invention can be implemented even without these specific details.
[0016] Step one: Establish the hydraulic system state data set, and perform denoising processing.
[0017] To build a data-driven diagnostic model, the state sensor data of the hydraulic system is integrated into a binary tuple with a structure of D, O , wherein D represents the hydraulic system performance parameters, i.e., features, including pressure, motor power, volume flow, temperature, and vibration, O represents the current state of the hydraulic system, such as normal operation of the cooler, slight lag of the valve, and internal pump leakage, etc., as shown in Table 1, the process of integrating feature data from a vector to a feature matrix is completed, and median filtering is performed on the data content. The initial data set is constructed by the filtered data. The data set structure established by the present invention is shown in Table 2, C i represents the i th sample data, i =1, 2, …, n , D j represents the j th hydraulic system performance parameter, j =1, 2, …, m , O k represents the k th current state of the hydraulic system, k =1, 2, …, q .
[0018] Table 1: State features of the hydraulic system Table 2: Hydraulic system data set To eliminate the influence of different dimensions on model training, zero-mean unit variance method is used to standardize all features to obtain , and the formula is: (1) (2) (3) represents the mean value, represents the standard deviation, The standardized data is obtained.
[0019] Step two: fault diagnosis using RF-XGB model The preprocessed data set is divided into a training set, a validation set, and a test set in a ratio of 6:2:2. A random forest (RF) model is used as the base learner. The training set is sampled by bootstrap to form a training data set corresponding to a single tree. The RF model is trained, and the number of bootstrap samples is equal to the number of training set samples. The number of trees in the RF model is M Each decision tree is constructed based on the CART (Classification And Regression Trees) algorithm. The Gini impurity of a node t is defined as: (4) where P i represents the proportion of samples of the t th class in the node i , q and O i is the total number of sample state columns. When the samples in the node all belong to the same class, Gini ( t )= 0, and when the samples are uniformly distributed, the Gini impurity reaches a maximum value. Each tree randomly selects the square root of the total number of features to calculate the Gini impurity when splitting, in order to reduce the repetition of strongly correlated features between different trees and improve the diversity of the random forest model. The purity difference between each child node before and after splitting is calculated, and the feature that produces the maximum Gini impurity difference is selected for splitting. (5) where Gini ( t ) is the Gini impurity of the current node, Gini ( tL ), Gini ( tR ) are the Gini impurities of the left and right child nodes, N t , N L and N R are the sample sizes of the current node and its left and right child nodes, respectively. The node is split by maximizing the difference of Gini impurity to increase the randomness and diversity between different trees, reduce the variance of random forest model, improve the generalization performance, continue to split the left and right child nodes to the next level, until the number of data in the child node is less than the set minimum data number or the depth of the child node reaches the set maximum tree depth, then stop splitting and complete the current tree construction.
[0020] Further, the RF model is improved for the training set, and for a single tree, the samples not extracted are collected as out-of-bag samples to form a matrix shaped as N OOB, k wherein N OOB is the number of samples in the out-of-bag samples, and the formula for the initial RF model to predict the out-of-bag samples is (6) wherein is the probability prediction of the hydraulic system state , the out-of-bag error of the prediction result of the tree is calculated separately for the first i tree, the detection ability of the tree is judged according to the detection performance on the out-of-bag samples, and the error rate of the out-of-bag error test is e i The calculation formula is: (7) wherein represents the out-of-bag prediction value of the sample of the tree, is the true label of the sample; Then, according to the out-of-bag error of the tree, the voting weight weighted calculation is performed to obtain the voting weight i of the tree The calculation formula is: (8) wherein T is a temperature smoothing coefficient, which is used to effectively prevent the phenomenon that the weight is concentrated in a small number of trees with low out-of-bag error, causing excessive concentration of model weight, and ensure that the model still has diversity and stability when the weight is assigned according to the out-of-bag error, and the weight calculation formula is extended to the whole model of the tree, which can be represented as: (9) The weight distribution of each tree in the model is completed by normalization, and the final prediction result of the RF model is represented as: (10) Further, the Staking integration method is adopted, and the improved RF model is used to predict the probability of each fault O i of the current sample B i As a new feature, the original data is combined to construct the meta-learner training set C C i B As shown in Table 3. Here, all variables in the initial dataset are retained to ensure that the meta-learner can access linear and nonlinear information in the initial data.
[0021] Table 3: Dataset for XGBoost The specific process of XGBoost model construction is as follows: by sequentially constructing several weak learners, each new tree fits the residual of the previous model or the negative gradient of the objective function, and the model prediction is accumulated in an additive manner. In classification tasks, the sign or probability after accumulation is taken as the judgment. XGBoost introduces Taylor approximation of second-order derivative information, objective function regularization, column sampling, learning rate and tree structure constraint, automatic handling of missing values, and optimization means such as efficient parallelization and distributed implementation. C As data samples, the XGBoost model is trained, and the objective function of XGBoost is constructed as follows: (11) where represents the complexity regularization term of the i th tree, represents the loss of the current sample. For the current sample, the log loss is defined as: (12) where P i,o represents the probability that the XGBoost model predicts the sample i belongs to class O , is the indicator function, which is equal to 1 when the class of is equal to c, and 0 otherwise. Through the second-order Taylor expansion approximation of the objective function b , the gain O of the candidate split is calculated, and the calculation formula is as follows: Gain (13) where represents the gradient sum of the left and right child nodes, represents the second-order derivative sum of the left and right child nodes, and is calculated according to Gain The calculation result with the maximum value is split until the tree model construction is completed, and the prediction results of each tree model are accumulated to convert into probabilities of comparison of each classification P i,k The final classification result of XGBoost is calculated The calculation formula is as follows: (14) (15) Then, the accuracy of the model on the validation set is evaluated as follows: (16) Among them TP is the number of positive samples that are correctly identified, FP is the number of false negative samples, TN is the number of negative samples that are correctly identified, FN is the number of missed positive samples.
[0022] If the accuracy does not meet the set requirement, the optimal values of the model parameters are further searched through Bayesian optimization, and the training set is diagnosed again with the best parameters to output the prediction probability of each fault of the current sample O i B i .
[0023] Tables 4-8 show the test results of the model constructed based on the application on the public data set. There are 1323 training samples, and the precision, recall and F1 score are calculated as formulas (17), (18) and (19) respectively.
[0024] : (17) (18) (19) Table 4: Chiller state diagnosis table Table 5: Valve state diagnosis table Table 6: Pump state diagnosis table Table 7: Hydraulic accumulator diagnosis table Table 8: System stability state diagnosis table As can be seen from Tables 4-8, the application model has higher accuracy, precision, recall rate and F1 score in the five classification tasks. The fault diagnosis of the cooler, valve, pump and hydraulic accumulator can reach 100% accuracy. The diagnosis accuracy of the system stability state reaches 97.1%, has good diagnosis effect, and can better realize the hydraulic system fault diagnosis. For the training set, the training curve of the application model is drawn to observe the model training effect, as shown in FIG. 3. Figure 2
[0025] According to the learning curve, the application has excellent learning performance. In the diagnosis tasks of the cooler, valve, pump and accumulator, the training curve and the verification curve can converge and stabilize at a faster speed. The cooler stabilizes at 200 samples, and the valve, pump and accumulator can stabilize at 500 samples. For the more complex stability problem, the learning curve and the verification curve fluctuate, and the learning curve stabilizes gradually after 400 samples. The performance comparison results of the average values of the five groups of experiments with accuracy, precision, recall rate and F1 score as indexes are shown in Table 9.
[0026] Table 9 Model performance comparison table As can be seen from the experimental results, the application model has obvious advantages compared with the comparison model, and performs best in the comparison of accuracy, precision, recall rate and F1 score. As can be seen from the learning curve, except for the stability diagnosis, the learning curves of the comparison models such as LSTM-CNN and LSTM-DNN are basically stable, and slightly fluctuate with the increase of iteration times. Based on the training set composed of 1323 samples, deep learning cannot completely master the characteristics of the training set, so it cannot play the advantage of strong nonlinear learning ability in the subsequent diagnosis task, and finally cannot be better than the application model based on the tree model in the performance comparison, which proves that the application also has advantages in reducing the training cost.
[0027] Meanwhile, the model has strong robustness. Table 10 is the average accuracy of fault diagnosis obtained by shielding three pressure sensors according to the feature influence relationship.
[0028] Table 10 Shielding experiment comparison table From the results of Table 10, with the gradual reduction of pressure data input, the accuracy of the improved RF model, the initial RF model, the XGB model, the LSTM-CNN, the LSTM-DNN slightly decreases, and the present application does not appear obvious decrease. After shielding all pressure signals, the accuracy of the initial RF model and the initial RF-XGB increases slightly, the accuracy of the XGB model, the LSTM-CNN model and the LSTM-DNN model decreases, and the accuracy of the present application does not decrease obviously. After shielding all features positively correlated with the pressure signals, the accuracy of all models decreases. Among them, the accuracy of the present application decreases the least, and the comprehensive accuracy decreases by 3.6%, proving that the present application has strong robustness. The details of the present application are known technologies.
[0029] The above only describes the preferred embodiments of the present application, and it should be pointed out that for ordinary skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, and these improvements and refinements should be considered as the protection scope of the present application.
Claims
1. A hydraulic system fault diagnosis method based on a data-driven stacked model, characterized by, The method comprises the following steps: Step 1: Determine the state of the hydraulic system and the hydraulic system performance parameters as the judgment index, construct the hydraulic system performance parameter and hydraulic system state data set, and preliminarily analyze the correlation based on the data and eliminate irrelevant influencing factors; Step 2: Establish an RF-XGB model based on hydraulic system fault diagnosis to realize diagnosis.
2. The hydraulic system fault diagnosis method based on data-driven stacked model according to claim 1, characterized in that: In step 1, to construct a data-driven diagnostic model, the state sensor data of the hydraulic system are integrated into a structure as follows ( D, O The binary pair of ) where D These represent the performance parameters, or characteristics, of a hydraulic system, including pressure, motor power, volumetric flow rate, temperature, and vibration. O This indicates the current state of the hydraulic system: the cooler is operating normally, the valves are slightly lag-free, and there is internal pump leakage. It completes the process of integrating feature data from vectors into a feature matrix, and uses this as a basis to integrate sensor data samples to build a dataset. C i Indicates the first i One sample data, i =1, 2, ..., n , D j Indicates the first j Performance parameters of a hydraulic system j =1, 2, ..., m , O k Representing the k Current status of the secondary hydraulic system k =1, 2, ..., q .
3. The hydraulic system fault diagnosis method based on data-driven stacked model according to claim 1, characterized in that: In step 2, the RF-XGB model takes the random forest as the base learner and the XGBoost as the meta-learner to establish the fault diagnosis model. In order to eliminate the influence of different dimensions on the model training, the zero-mean unit-variance method is used to standardize all features to obtain The formula is: (1) (2) (3) represents the average value, represents the standard deviation, represents the data after normalization; In view of the short-time pulse noise in the hydraulic signal, a sliding window median filter is introduced to smooth the abnormal fluctuations and retain the fault precursor characteristics.
4. The hydraulic system fault diagnosis method based on data-driven stacked model according to claim 3, characterized in that: For the pretreated data set, the proportion of 6:2:2 is divided into training set, validation set, test set, and then the random forest model is used as the base learner, the corresponding training data set of single tree is formed by self-sampling of training set, the RF model is trained, the self-sampling frequency is equal to the sample number of training set, and the number of RF model trees is M Each decision tree is constructed based on the CART algorithm, and in the process of splitting the decision tree node, the impurity of the samples in the node is measured by the Gini impurity, and the feature with the maximum difference of Gini impurity is selected for splitting. To node t The Gini impurity is defined as: (4) In the formula P i Indicates at node t The Middle i The proportion of class samples, q This represents the total number of sample state categories. When all samples in a node belong to the same category... O i =1, at this time Gini ( t When the sample is uniformly distributed, the Gini impurity reaches its maximum value. When splitting each tree, the Gini impurity is calculated by randomly selecting the square root of the total number of features. This reduces the repetition of the same strongly correlated features between different trees and improves the diversity of the random forest model. By calculating the difference in purity of each child node before and after splitting, the feature that produces the largest difference in Gini impurity is selected for splitting. (5) wherein Gini ( t ) is the Gini impurity of the current node, Gini ( t L ), Gini ( t R ) are the Gini impurities of the left and right child nodes, respectively, N t , N L and N R are the number of samples of the current node and its left and right child nodes, respectively. By maximizing the Gini impurity difference to realize the pure split of nodes, the randomness and diversity between different trees are increased, the variance of the random forest model is reduced, the generalization performance is improved, the next level split is continued for the left and right child nodes, and the split is stopped when the data quantity of the child nodes is less than the set minimum data number or the depth of the child nodes reaches the set maximum tree depth, then the current tree construction is completed.
5. The hydraulic system fault diagnosis method based on data-driven stacked model according to claim 4, characterized in that: The RF model is improved for the training set. For a single tree, the samples not extracted are collected as out-of-bag samples to form a matrix shaped as N OOB, k ) where N OOB is the number of samples in the out-of-bag samples, and the formula for the initial RF model to predict the out-of-bag samples is: (6) wherein Pointer to the probability prediction of the hydraulic system state of the first tree, the out-of-bag error of the prediction result of the tree is calculated separately, the detection ability of the tree is judged according to the detection performance on the out-of-bag samples, and the error rate of the out-of-bag error test i e i The calculation formula is: (7) wherein represents the out-of-bag prediction value for the tree sample, is the true label for the sample; Then according to the out-of-bag error of the tree, the voting weight weighted calculation is performed to obtain the voting weight of the tree i The calculation formula is as follows: The calculation formula is as follows: (8) wherein T is a temperature smoothing coefficient, used to effectively prevent the phenomenon of excessive concentration of model weights caused by the fact that weights are concentrated in a small number of trees with out-of-bag error below a set value, ensuring that the model still has diversity and stability according to the out-of-bag error weighting, and the weight calculation formula is extended to the whole model tree, which can be expressed as: (9) The RF model final prediction results by normalizing the weight distribution of each tree in the model is represented as: (10)。 6. The hydraulic system fault diagnosis method based on data-driven stacked model according to claim 5, characterized in that: The improved RF model is used in a Staking integrated manner to predict the probability of each fault of the current sample O i B i The prediction probability of each fault of the current sample is taken as a new feature C C i , B The original data set is combined to construct a meta-learner training set, and all variables in the initial data set are reserved to ensure that the meta-learner can access linear and nonlinear information in the initial data set. 7. The hydraulic system fault diagnosis method based on data-driven stacked model according to claim 3, characterized in that: The specific process of XGBoost model construction is as follows: a plurality of weak learners are constructed in sequence, each new tree fits the residual of the previous model or the negative gradient of the target function, the model prediction is accumulated in an additive manner, the sign or probability is taken after the output is accumulated for judgment in the classification task, XGBoost introduces the Taylor approximation of the second-order derivative information, the regularization of the target function, column sampling, learning rate and tree structure constraint, automatic processing of missing values, and optimization means of efficient parallelization and distributed implementation; With C' As a data sample, the XGBoost model is trained, and the objective function of XGBoost is constructed: (11) In the formula denotes the i complexity regularization term of the tree, denotes the loss of the current sample, for which the log loss is defined as: (12) where P i,o denotes the probability that the XGBoost model predicts the sample i to belong to class O , is an indicator function that equals 1 when the class of the sample equals c and 0 otherwise, O b the gain of a candidate split is computed by a second order Taylor expansion approximation of the objective function Gain , which is given by (13) wherein denotes the gradient sum of the left and right child nodes, denotes the second derivative sum of the left and right child nodes, according to Gain the calculation result of the maximum value is split, until the tree model construction is completed, the prediction results of each tree model are accumulated, and the probabilities of comparing each classification are converted P i,k , the final XGBoost classification result is calculated , and the calculation formula is as follows: (14) (15) Then, the accuracy of the model on the validation set is evaluated, as follows: (16) wherein TP is the number of positive samples that are correctly identified, FP is the number of false positives, TN is the number of negative samples that are correctly identified, FN is the number of missed positive samples; If the accuracy of the model does not meet the requirements, the optimal hyperparameters of RF and XGBoost are determined by Bayesian optimization.