Engine connecting rod qualified product identification method based on hybrid particle swarm optimization random forest algorithm
Through the hybrid particle swarm optimization of the random forest algorithm and combined with machine learning algorithms, we can identify the working performance of the engine connecting rod in a high temperature and high pressure environment, solving the problem of identifying errors in the existing technology and improving the recognition accuracy and efficiency.
Patent Information
- Application Number
- CN202411246712.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-06
- Publication Date
- 2024-12-13
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art cannot accurately identify the operating performance of the engine connecting rod in a normal environment under normal environment, resulting in identification errors that may lead to engine failure and economic losses.
The engine link qualified product recognition method based on the mixed particle swarm optimization random forest algorithm is adopted. By collecting the data on the connecting rod's size, material, mechanical properties and other attributes, combined with the machine learning algorithm to train the model, it infers its working performance in a high-temperature and high-pressure environment. .
It improves the accuracy of the identification results of qualified engine connecting rods, reduces the detection cost and the risk of identification errors, and improves the identification speed and accuracy.
Smart Images

Figure CN119128591A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of identification technology, in particular to a method for identifying qualified engine connecting rods based on a hybrid particle swarm optimization random forest algorithm. Background Art
[0002] The connecting rod is a mechanical component that connects the engine piston and crankshaft, and is one of the main transmission mechanisms of the engine. In actual operation, the engine connecting rod needs to withstand high temperature, high pressure, high speed and chemical corrosion, but the connecting rod manufacturer cannot simulate the high temperature and high pressure environment of the connecting rod in actual use when identifying qualified products. Therefore, there may be errors between the identification results obtained in a normal environment and the actual situation. Once the identification error of qualified connecting rods is mixed into the engine installation stage, it may cause engine failure, engine damage and other adverse consequences, which will cause serious economic losses and reputation impacts to the connecting rod manufacturer. Summary of the invention
[0003] In view of the above problems, the present invention proposes a method for identifying qualified engine connecting rods based on machine learning. By collecting the attribute detection data of the engine connecting rod such as size, material, mechanical properties, and whether the connecting rod is working normally after three months of actual installation and use, a variety of machine learning algorithm training data are comprehensively used to obtain a connecting rod qualified product identification model, so as to achieve the purpose of inferring the working performance of the connecting rod under high temperature and high pressure environment based on the connecting rod detection data under normal environment, improve the accuracy of the identification results of qualified engine connecting rods, and reduce the detection cost of qualified engine connecting rods and the potential risks caused by identification errors.
[0004] The method for identifying qualified engine connecting rods based on a hybrid particle swarm optimization random forest algorithm proposed in the present invention comprises the following steps:
[0005] S1. Collect data, including the size, material, mechanical properties, surface roughness of the engine connecting rod and whether the connecting rod is qualified after being installed and used for three months;
[0006] S2, data preprocessing, cleaning the collected data and normalizing the cleaned data;
[0007] S3, selecting characteristic indicators, and using a random forest algorithm to select an appropriate number of characteristic indicators of qualified engine connecting rods;
[0008] S4, creating a weighted random forest classifier, randomly setting the number of decision trees, pruning threshold, number of split attributes and number of pre-test samples of the weighted random forest classifier, and calculating the classification results of the test samples;
[0009] S5. Using a hybrid particle swarm algorithm to optimize the number of decision trees, pruning threshold, number of split attributes, and number of pre-test samples of the weighted random forest classifier, and determine the parameters of the final model;
[0010] S6. Identify the engine connecting rod to be tested, input the size, material, mechanical properties, and surface roughness data of the engine connecting rod to be tested into a weighted random forest classifier optimized based on a hybrid particle swarm algorithm, and obtain an identification result of whether the engine connecting rod is qualified.
[0011] Furthermore, the data preprocessing in S2 includes the following steps:
[0012] S21. Data cleaning: Check the consistency of the data, that is, check whether the data meets the requirements. If there is duplicate data, abnormal data, invalid data, and missing data, delete the sample;
[0013] S22. Normalization: In order to eliminate the influence of dimension on the model, the maximum and minimum method is used to normalize the cleaned raw data. The calculation formula is:
[0014] x′ k =(x k -x min ) / (x max -x min ), k = 1, 2, ..., M;
[0015] Among them, x k is the input data of the kth group, x′ k is the normalized k-th group of input data, x max 、x min are the maximum and minimum values in the kth group of input data respectively.
[0016] Furthermore, selecting characteristic indicators in S3 includes the following steps:
[0017] S31, generate a random forest model from the original sample set with N samples and M sample attributes;
[0018] S32. Use out-of-bag samples (OOB) to test model performance and obtain OOB accuracy, estimate the importance of feature attributes and sort them according to their importance. The calculation formula of OOB accuracy is:
[0019]
[0020] Among them, H(x) is the random forest classifier, S is the validation set, P is the number of validation set samples, and I is the indicative function.
[0021] S33, randomly adding noise interference to a certain feature in the OOB data, and using the OOB data after adding noise to test the performance of the random forest model to obtain a new OOB accuracy rate;
[0022] S34, calculating the difference between the original OOB accuracy and the OOB accuracy after adding noise, and using this as the importance measure of the feature;
[0023] S35. Repeat steps S31 to S34 until all important feature attributes are retained.
[0024] Furthermore, creating a weighted random forest classifier in S4 includes the following steps:
[0025] S41, determining the parameters of the random forest algorithm, randomly setting the initial values of the number of decision trees L, the pruning threshold ε, the number of split attributes m, and the number of pre-test samples X;
[0026] S42, using Bootstrap algorithm sampling, randomly generating L training sets, and selecting X pre-test samples in each training set;
[0027] S43, using the remaining samples of each training set to generate L decision trees respectively, during the generation process, before selecting an attribute each time, m attributes are selected from all attributes as decision attributes of the current node;
[0028] S44, when the number of samples contained in the node is less than the pruning threshold ε, the node is regarded as a leaf node, and the mode of its target attribute is returned as the classification result of the decision tree;
[0029] S45. After all decision trees are generated, each decision tree is pre-tested and its accuracy is calculated. The calculation formula is:
[0030]
[0031] Among them, X correct,l The number of samples correctly classified by the lth decision tree.
[0032] S46. The accuracy is used as the weight of the corresponding decision tree to calculate the classification result of the weighted random forest model. The calculation formula is:
[0033]
[0034] Among them, f l (x)=i is the output result of the lth decision tree.
[0035] Furthermore, in S5, optimizing the weighted random forest model using the hybrid particle swarm algorithm includes the following steps:
[0036] S51, initialize the particle swarm and randomly set each particle p i The velocity and position of each particle represents a possible combination of weighted random forest model parameters;
[0037] S52, evaluate the fitness of each particle, that is, substitute the model parameters represented by each particle into the classification result f(p i ), the particle position and fitness value are stored in the particle's individual extreme value p best In the best The individual position and fitness value of the best fitness value in the global extreme value g best middle;
[0038] S53, determine the initial temperature:
[0039] t 0 =f(pi) / ln5;
[0040] S54, determine the current temperature of each particle p i The fitness value of:
[0041]
[0042] Among them, p g is the particle that currently has the global extreme value, and K is the number of particle swarms.
[0043] S55, from all p i Determine the globally optimal replacement value and update the position and velocity of each particle according to the following two formulas:
[0044] x i,j (t+1)=x i,j (t)+v i,j (t+1),j=1,2,…,d,
[0045]
[0046] Among them, c 1 and c 2 is the acceleration factor, r 1 and r 2 are two random numbers on [0,1].
[0047] S56, calculate the fitness values of all particles after the updated position, and update p best and g best , and then perform cooling operation, the cooling formula is:
[0048] t k+1 =λt k ;
[0049] Here, λ is a constant on (0,1).
[0050] S57, determine whether the maximum number of iterations has been reached, if so, set g best Input the weighted random forest model for training, otherwise return to S54 to continue searching.
[0051] Further, identifying the engine connecting rod to be detected in S6 includes the following steps:
[0052] S61. Measure the dimensions, material, mechanical properties, surface roughness and other attribute data of the engine connecting rod to be tested;
[0053] S62, inputting the engine connecting rod to be used into the optimized random forest model trained in step S5, and obtaining a recognition result of whether the engine connecting rod is qualified.
[0054] Compared with the prior art, the present invention has the following beneficial effects:
[0055] (1) The present invention uses a machine learning model to identify qualified connecting rods through attribute data such as engine connecting rod size, material, mechanical properties, and surface roughness, effectively saving the economic cost of engine connecting rod testing and reducing the probability of errors between test results and actual use results;
[0056] (2) The present invention uses the idea of random forest algorithm to select features of engine connecting rod properties, and uses weighted random forest model to preliminarily classify qualified connecting rods, which effectively reduces model training time by eliminating redundant information, improves model training efficiency and the accuracy of recognition results;
[0057] (3) The hybrid particle swarm algorithm based on simulated annealing in the present invention optimizes the selection of the initial values of the number of decision trees, pruning threshold, number of split attributes and number of pre-test samples in the weighted random forest model, making full use of the jump capability of the simulated annealing algorithm in the search process, overcoming the defect that the random forest model is prone to fall into local minima, and improving the stability of the training results of the weighted random forest model, thereby effectively improving the speed and accuracy of identifying qualified engine railings. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] Figure 1 A flow chart of a method for identifying qualified engine connecting rods based on a hybrid particle swarm optimization random forest algorithm provided by an embodiment of the present invention is shown.
[0059] Figure 2 An algorithm flow chart of a weighted random forest model provided by an embodiment of the present invention is shown.
[0060] Figure 3The flowchart of the algorithm of the hybrid particle swarm based on simulated annealing provided by the embodiment of the present invention is shown. DETAILED DESCRIPTION
[0061] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the specific embodiments described here are only used to explain the present invention and are not used to limit the present invention.
[0062] Example:
[0063] like Figure 1 As shown, the present invention provides a mechanical product assembly quality diagnosis method based on machine learning, comprising the following steps:
[0064] S1. Collect data, including the size, material, mechanical properties, surface roughness of the engine connecting rod and whether the connecting rod is qualified after being installed and used for three months.
[0065] The engine railing attribute data collected in the embodiment specifically include the inner diameter and outer diameter of the connecting rod big end, the inner diameter and outer diameter of the connecting rod small end, the length, width and height of the connecting rod shaft, axial clearance, end surface flatness, surface roughness, connecting rod quality, carbon content, phosphorus content, silicon content, manganese content and sulfur content of the connecting rod material, tensile strength and hardness of the railing material, dynamic balance of the railing, and whether the connecting rod is qualified after three months of actual installation and use. A total of 1,000 groups of data were selected, and each group of sample data included 24 input variables and 1 output variable.
[0066] S2, data preprocessing, cleaning the collected data and normalizing the cleaned data;
[0067] (1) Data cleaning: Check the consistency of the data, that is, check whether the data meets the requirements. If there is duplicate data, abnormal data, invalid data, or missing data, delete the sample;
[0068] (2) Normalization: In order to eliminate the influence of dimension on the model, the maximum and minimum method is used to normalize the cleaned raw data. The calculation formula is:
[0069] x′ k =(x k -x min ) / (x max -x min ), k = 1, 2, ..., M;
[0070] Among them, x k is the input data of the kth group, x′ k is the normalized k-th group of input data, x max 、x minare the maximum and minimum values in the kth group of input data respectively.
[0071] S3, selecting characteristic indicators, and using a random forest algorithm to select an appropriate number of characteristic indicators of qualified engine connecting rods;
[0072] (1) Generate a random forest model from the original sample set with 1000 samples and 24 sample attributes;
[0073] (2) Use out-of-bag (OOB) samples to test model performance and obtain OOB accuracy, estimate the importance of feature attributes and sort them according to their importance. The calculation formula of OOB accuracy is:
[0074]
[0075] Among them, H(x) is the random forest classifier, S is the validation set, P is the number of validation set samples, and I is the indicative function.
[0076] (3) Randomly add noise interference to a certain feature in the OOB data, and use the OOB data with added noise to test the performance of the random forest model to obtain a new OOB accuracy rate;
[0077] (4) Calculate the difference between the original OOB accuracy and the OOB accuracy after adding noise, and use it as the importance measure of the feature;
[0078] (5) Repeat steps S31 to S34 until all important feature attributes are retained.
[0079] S4, creating a weighted random forest classifier, randomly setting the number of decision trees, pruning threshold, number of split attributes and number of pre-test samples of the weighted random forest classifier, and calculating the classification results of the test samples;
[0080] (1) Determine the parameters of the random forest algorithm, randomly set the number of decision trees to 500, the pruning threshold to 25, the number of split attributes to 5, and the number of pre-test samples to 500;
[0081] (2) Using Bootstrap algorithm sampling, 500 training sets were randomly generated, and 500 pre-test samples were selected from each training set;
[0082] (3) Use the remaining samples in each training set to generate 500 decision trees. During the generation process, before selecting an attribute each time, five attributes are selected from all attributes as the decision attributes of the current node;
[0083] (4) When the number of samples contained in a node is less than the pruning threshold of 25, the node is treated as a leaf node and the mode of its target attribute is returned as the classification result of the decision tree;
[0084] (5) After all decision trees are generated, each decision tree is pre-tested and its accuracy is calculated using the following formula:
[0085]
[0086] Among them, X correct,l The number of samples correctly classified by the lth decision tree.
[0087] (6) The accuracy rate is used as the weight of the corresponding decision tree to calculate the classification result of the weighted random forest model. The calculation formula is:
[0088]
[0089] Among them, f l (x)=i is the output result of the lth decision tree.
[0090] S5. Using a hybrid particle swarm algorithm to optimize the number of decision trees, pruning threshold, number of split attributes, and number of pre-test samples of the weighted random forest classifier, and determine the parameters of the final model;
[0091] (1) Initialize the particle swarm and randomly set each particle p i The velocity and position of each particle represents a possible combination of weighted random forest model parameters;
[0092] (2) Evaluate the fitness of each particle, that is, substitute the model parameters represented by each particle into the classification result f(p i ), the particle position and fitness value are stored in the particle's individual extreme value p best In the best The individual position and fitness value of the best fitness value in the global extreme value g best middle;
[0093] (3) Determine the initial temperature:
[0094] t 0 =f(pi) / ln5;
[0095] (4) Determine the p of each particle at the current temperature i The fitness value of:
[0096]
[0097] Among them, p g is the particle that currently has the global extreme value, and K is the number of particle swarms.
[0098] (5) From all p iDetermine the globally optimal replacement value and update the position and velocity of each particle according to the following two formulas:
[0099] x i,j (t+1)=x i,j (t)+v i,j (t+1),j=1,2,…,d,
[0100]
[0101] Among them, c 1 and c 2 is the acceleration factor, r 1 and r 2 are two random numbers on [0,1].
[0102] (6) Calculate the fitness values of all particles after the updated position and update p best and g best , and then perform cooling operation, the cooling formula is:
[0103] t k+1 =λt k ;
[0104] Here, λ is a constant on (0,1).
[0105] (7) Determine whether the maximum number of iterations has been reached. If so, set g best Input the weighted random forest model for training, otherwise return to S54 to continue searching.
[0106] S6. Identify the engine connecting rod to be tested, input the size, material, mechanical properties, and surface roughness data of the engine connecting rod to be tested into a weighted random forest classifier optimized based on a hybrid particle swarm algorithm, and obtain an identification result of whether the engine connecting rod is qualified.
[0107] (1) Measure 24 attribute data such as size, material, mechanical properties, surface roughness, etc. of the engine connecting rod to be tested;
[0108] (2) The engine connecting rod to be tested is input into the optimized random forest model trained in step S5 to obtain a recognition result of whether the engine connecting rod is qualified.
[0109] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any technician familiar with the technical field can make equivalent substitutions or changes according to the technical solutions and inventive concepts of the present invention within the technical scope disclosed by the present invention, and all of them should be included in the protection scope of the present invention.
Claims
1. A method for identifying qualified engine connecting rods based on a hybrid particle swarm optimization random forest algorithm, characterized in that: The steps include: S1. Collect data, including the size, material, mechanical properties, surface roughness of the engine connecting rod and whether the connecting rod is qualified after being installed and used for three months; S2, data preprocessing, cleaning the collected data and normalizing the cleaned data; S3, selecting characteristic indicators, and using a random forest algorithm to select an appropriate number of characteristic indicators of qualified engine connecting rods; S4, creating a weighted random forest classifier, randomly setting the number of decision trees, pruning threshold, number of split attributes and number of pre-test samples of the weighted random forest classifier, and calculating the classification results of the test samples; S5. Using a hybrid particle swarm algorithm to optimize the selection of the number of decision trees, pruning threshold, number of split attributes, and number of pre-test samples of the weighted random forest classifier, and determine the parameters of the final model; S6. Identify the engine connecting rod to be tested, input the size, material, mechanical properties, and surface roughness data of the engine connecting rod to be tested into a weighted random forest classifier optimized based on a hybrid particle swarm algorithm, and obtain an identification result of whether the engine connecting rod is qualified.
2. The method for identifying qualified engine connecting rods based on hybrid particle swarm optimization random forest algorithm according to claim 1, characterized in that: The specific steps of data preprocessing in step S2 are: S21. Data cleaning: Check the consistency of the data, that is, check whether the data meets the requirements. If there is duplicate data, abnormal data, invalid data, and missing data, delete the sample; S22. Normalization: In order to eliminate the influence of dimension on the model, the maximum and minimum method is used to normalize the cleaned raw data. The calculation formula is: x′ k =(x k -x min ) / (x max -x min ),k=1,2,…,M; Among them, x k is the input data of the kth group, x′ k is the normalized k-th group of input data, x max 、x min are the maximum and minimum values in the kth group of input data respectively.
3. The method for identifying qualified engine connecting rods based on hybrid particle swarm optimization random forest algorithm according to claim 1, characterized in that: The specific operation steps of selecting characteristic indicators in step S3 are: S31, generate a random forest model from the original sample set with N samples and M sample attributes; S32. Use out-of-bag samples (OOB) to test model performance and obtain OOB accuracy, estimate the importance of feature attributes and sort them according to their importance. The calculation formula of OOB accuracy is: Among them, H(x) is the random forest classifier, S is the validation set, P is the number of validation set samples, and I is the indicative function. S33, randomly adding noise interference to a certain feature in the OOB data, and using the OOB data after adding noise to test the performance of the random forest model to obtain a new OOB accuracy rate; S34, calculating the difference between the original OOB accuracy and the OOB accuracy after adding noise, and using this as the importance measure of the feature; S35. Repeat steps S31 to S34 until all important feature attributes are retained.
4. The method for identifying qualified engine connecting rods based on hybrid particle swarm optimization random forest algorithm according to claim 1, characterized in that: The specific operation steps of creating a weighted random forest classifier in step S4 are: S41, determining the parameters of the random forest algorithm, randomly setting the initial values of the number of decision trees L, the pruning threshold ε, the number of split attributes m, and the number of pre-test samples X; S42, using Bootstrap algorithm sampling, randomly generating L training sets, and selecting X pre-test samples in each training set; S43, using the remaining samples of each training set to generate L decision trees respectively, during the generation process, before selecting an attribute each time, m attributes are selected from all attributes as decision attributes of the current node; S44, when the number of samples contained in the node is less than the pruning threshold ε, the node is regarded as a leaf node, and the mode of its target attribute is returned as the classification result of the decision tree; S45. After all decision trees are generated, each decision tree is pre-tested and its accuracy is calculated. The calculation formula is: Among them, X correct,l The number of samples correctly classified by the lth decision tree. S46. The accuracy is used as the weight of the corresponding decision tree to calculate the classification result of the weighted random forest model. The calculation formula is: Among them, f l (x)=i is the output result of the lth decision tree.
5. The method for identifying qualified engine connecting rods based on hybrid particle swarm optimization random forest algorithm according to claim 1, characterized in that: The specific operation steps of optimizing the weighted random forest model using the hybrid particle swarm algorithm in step S5 are: S51, initialize the particle swarm and randomly set each particle p i The speed and position of each particle represents a possible combination of weighted random forest model parameters; S52, evaluate the fitness of each particle, that is, substitute the model parameters represented by each particle into the classification result f(p i ), the particle position and fitness value are stored in the particle's individual extreme value p best In the best The individual position and fitness value of the best fitness value in the global extreme value g best middle; S53, determine the initial temperature: t0=f(p i ) / ln5; S54, determine the current temperature of each particle p i The fitness value of: Among them, p g is the particle that currently has the global extreme value, and K is the number of particle swarms. S55, from all p i Determine the globally optimal replacement value and update the position and velocity of each particle according to the following two formulas: x i,j (t+1)=x i,j (t)+v i,j (t+1),j=1,2,…,d, Among them, c1 and c2 are acceleration coefficients, and r1 and r2 are two random numbers on [0,1]. S56, calculate the fitness values of all particles after the updated position, and update p best and g best , and then perform cooling operation, the cooling formula is: t k+1 =λt k ; Here, λ is a constant on (0,1). S57, determine whether the maximum number of iterations has been reached, if so, set g best Input the weighted random forest model for training, otherwise return to S54 to continue searching.
6. According to the method for identifying qualified engine connecting rods based on hybrid particle swarm optimization random forest algorithm according to claim 1, the specific steps of identifying the engine connecting rod to be tested in step S6 are: S61. Measure the dimensions, material, mechanical properties, surface roughness and other attribute data of the engine connecting rod to be tested; S62, inputting the engine connecting rod to be used into the optimized random forest model trained in step S5, and obtaining a recognition result of whether the engine connecting rod is qualified.
