A method for predicting the size of injection molded products based on custom LightGBM model loss
By customizing the LightGBM model loss function, combining historical SPC data and high-frequency sampling data, high-frequency features are extracted and the model is trained, which solves the problem of misjudgment and misjudgment in the size prediction of injection molded products, and improves the reliability of product quality.
Patent Information
- Application Number
- CN202111337443.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-09
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2041-11-09
AI Technical Summary
The prior art has problems of misjudgment and misjudgment in the size prediction of injection molded products, resulting in unreliable product quality.
The injection molded product size prediction method based on the loss of a custom LightGBM model is adopted. By obtaining historical SPC data and high-frequency sampling data, high-frequency features are extracted and data preprocessed, the custom loss LightGBM model is trained, and the prediction effect is verified on the test set.
This significantly reduces the missed judgment and misjudgment rate in the prediction results, improves the comprehensive prediction performance of the model, and ensures product quality reliability.
Smart Images

Figure CN114239378B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of machine learning, and in particular relates to a method for predicting the size of injection molded products based on a custom LightGBM model loss. Background Art
[0002] The quality of products is one of the most concerned issues in the manufacturing process. It is a key link in the company's market strategy and the core driving force that determines the company's competitive advantage. Traditional product quality control methods are basically based on offline testing of product quality. However, offline testing is a post-test with a time lag. In addition, due to the limitation of testing costs and the difficulty of matching the testing speed with the production efficiency of the product, it is difficult to achieve full inspection of the product, which makes the reliability of product quality unable to be guaranteed.
[0003] In recent years, with the continuous development of technologies such as big data and artificial intelligence, data-driven quality prediction technology has gradually matured, which has enabled the real-time and comprehensive nature of product inspections to be met, and has led to a change in the way companies control product quality. At present, machine learning algorithms such as random forests, support vector machines, XGBoost, LightGBM, and deep learning algorithms such as neural networks have been widely used in product quality prediction, but no one has yet proposed a solution to the problems of missed and misjudgment in quality prediction, which has brought difficulties and challenges to the final product quality judgment problem, such as the problem of missed and misjudgment of dimensions in injection molded product prediction. Summary of the invention
[0004] The main purpose of the present invention is to overcome the shortcomings and deficiencies of the prior art, propose a method for predicting the size of injection molded products based on a custom LightGBM model loss, and solve the problems of missed judgment and misjudgment in the prediction of the size of injection molded products in the prior art.
[0005] In order to achieve the above object, the present invention adopts the following technical solutions:
[0006] A method for predicting the size of injection molded products based on a custom LightGBM model loss, comprising the following steps:
[0007] S1. Obtain the historical SPC data of the injection molding process and the historical high-frequency sampling data of the state detection sensor of the mold filling process and perform preprocessing;
[0008] S2, extracting high-frequency features from the historical high-frequency sampling data of the mold filling process state detection sensor, and splicing it with the historical SPC data of the injection molding process to form a data set;
[0009] S3, perform variance filtering on the data set;
[0010] S4, divide the data set into training set and test set;
[0011] S5. Use the training set to train the LightGBM model with custom loss, and verify the prediction effect on the test set. Finally, the LightGBM model is used to predict the size of injection molded products.
[0012] Furthermore, step S1 specifically includes:
[0013] S11. Mean filling of missing values in the historical SPC data of the injection molding process;
[0014] S12. Perform mean filling on the missing values in the historical high-frequency sampling data of the mold filling process state detection sensor.
[0015] Furthermore, in step S2, the high-frequency feature is the minimum value of each column of features in the historical high-frequency sampling data of the mold filling process state detection sensor.
[0016] Furthermore, step S3 specifically includes:
[0017] S31, calculate the variance of each column feature of the data set;
[0018] S32. Eliminate features with zero variance.
[0019] Furthermore, step S5 specifically includes:
[0020] S51. Introduce a penalty factor into the loss function of LightGBM;
[0021] S52. Use the training set to train the LightGBM model, and perform size prediction of injection molded products on the test set. Calculate the mean square error (MSE), missed judgment rate, and false judgment rate of the prediction results to verify the prediction results.
[0022] Furthermore, the loss function is specifically:
[0023]
[0024] Where N is the number of samples, y i is the true value of the i-th sample, is the predicted value of the i-th sample, Ω is the structural loss associated with the regular term, is the target penalty factor, and its value is as follows:
[0025]
[0026] Among them, ω1 is the target penalty factor in the case of misjudgment, ω2 is the target penalty factor in the case of missed judgment, LL is the lower limit of size, UL is the upper limit of size, y iis the true value of the i-th sample, is the predicted value of the i-th sample.
[0027] Furthermore, the missed detection rate is:
[0028] Missed detection rate = number of missed detections of predicted samples / total number of predicted samples
[0029] The specific misjudgment rate is:
[0030] False positive rate = number of false positives in predicted samples / total number of predicted samples
[0031] The number of missed prediction samples is specifically the number of samples where the true value of the injection molded product size is greater than the upper size limit UL or less than the lower size limit LL, but the predicted value is greater than or equal to the lower size limit LL and less than or equal to the upper size limit UL;
[0032] The number of misjudgments of the predicted samples is specifically the number of samples where the true value of the injection molded product size is greater than or equal to the size lower limit LL and less than or equal to the size upper limit UL, but the predicted value is greater than the size upper limit UL or less than the size lower limit LL.
[0033] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0034] 1. Compared with the traditional offline detection method, the online detection method based on machine learning in the present invention greatly improves the detection efficiency and enables full inspection of the product.
[0035] 2. Compared with the traditional offline detection method, the online detection method based on machine learning in the present invention reduces the labor intensity and effectively reduces the detection cost.
[0036] 3. Compared with the existing machine learning online detection algorithm, the present invention introduces a corresponding penalty factor into the loss function of the LightBGM model, which reduces the missed judgment and misjudgment in the prediction results and improves the comprehensive prediction performance of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 is a flow chart of the method of the present invention;
[0038] Figure 2 This is a comparison chart of the predicted size distribution of missed and misjudged samples of the LightGBM model with custom loss in the embodiment and the LightGBM model. DETAILED DESCRIPTION
[0039] The present invention is further described in detail below in conjunction with embodiments and drawings, but the embodiments of the present invention are not limited thereto.
[0040] Example
[0041] like Figure 1 As shown, the present invention provides a method for predicting the size of injection molded products based on a custom LightGBM model loss, comprising the following steps:
[0042] S1. Obtain the historical SPC data of the injection molding process and the historical high-frequency sampling data of the mold filling process state detection sensor and perform preprocessing, including the following sub-steps:
[0043] S11. Mean filling of missing values in the historical SPC data of the injection molding process;
[0044] S12. Perform mean filling on the missing values in the historical high-frequency sampling data of the mold filling process state detection sensor.
[0045] In this embodiment, the historical SPC data of the injection molding process and the historical high-frequency sampling data of the state detection sensor of the mold filling process in the data set of the Fourth Industrial Big Data Innovation Competition are used. The dimensions of the historical SPC data of the injection molding process are (20553, 86), 20553 is the total number of molds of the product, and 86 is the number of features. The dimensions of the historical high-frequency sampling data of the state detection sensor of the mold filling process are (20533, 19, 1500±200), 20553 is the total number of molds of the product, 19 is the number of features, and 1500±200 is the number of data records collected by the high-frequency transmitter in each mold.
[0046] S2. Extract high-frequency features from the historical high-frequency sampling data of the mold filling process state detection sensor, and splice them with the historical SPC data of the injection molding process to form a data set; wherein the high-frequency feature is the minimum value of each column of features in the historical high-frequency sampling data of the mold filling process state detection sensor.
[0047] In this embodiment, the dimension of the data set formed by splicing is (20553, 105).
[0048] S3. Perform variance filtering on the data set, including:
[0049] S31, calculate the variance of each column feature of the data set;
[0050] S32. Eliminate features with zero variance.
[0051] S4. Divide the data set into a training set and a test set. In this embodiment, the dimensions of the divided training set are (16600, 105) and (3953, 105).
[0052] S5. Use the training set to train the LightGBM model with custom loss, and verify the prediction effect on the test set. Finally, the LightGBM model is used for injection molded product size prediction; specifically:
[0053] S51. Introduce a penalty factor into the loss function of LightGBM; the specific loss function is:
[0054]
[0055] Where N is the number of samples, y i is the true value of the i-th sample, is the predicted value of the i-th sample, Ω is the structural loss associated with the regular term, is the target penalty factor, and its value is as follows:
[0056]
[0057] Among them, ω1 is the target penalty factor in the case of misjudgment, ω2 is the target penalty factor in the case of missed judgment, LL is the lower limit of size, UL is the upper limit of size, y i is the true value of the i-th sample, is the predicted value of the i-th sample.
[0058] In this embodiment, the value of ω1 is 10, the value of ω2 is 10, the lower limit LL is 199.925 mm, and the upper limit UL is 200.075.
[0059] S52. Use the training set to train the LightGBM model, and perform size prediction of injection molded products on the test set. Statistically calculate the mean square error (MSE), missed judgment rate, and false positive rate of the prediction results to verify the prediction results. The specific missed judgment rate is:
[0060] Missed detection rate = number of missed detections of predicted samples / total number of predicted samples
[0061] The specific misjudgment rate is:
[0062] False positive rate = number of false positives in predicted samples / total number of predicted samples
[0063] The number of missed prediction samples is specifically the number of samples whose actual size of the injection molded product is greater than the upper size limit UL or less than the lower size limit LL, but whose predicted value is greater than or equal to the lower size limit LL and less than or equal to the upper size limit UL;
[0064] The number of misjudgments of the predicted samples is specifically the number of samples where the true value of the injection molded product size is greater than or equal to the size lower limit LL and less than or equal to the size upper limit UL, but the predicted value is greater than the size upper limit UL or less than the size lower limit LL.
[0065] In this embodiment, the model is trained using the training set, and the hyperparameters of the model are as follows: the boosting type boosting_type is set to gbdt, the number of leaves num_leaves of the tree is set to 25, the learning rate learning_rate is set to 0.3, the number of CART numbers n_estimators is set to 42, the feature selection ratio feature_fraction for tree building is set to 0.9, the sample sampling ratio bagging_fraction for tree building is set to 0.8, and bagging is performed every k iterations bagging_freq is set to 5.
[0066] The statistical results of mean square error (MSE), missed detection rate and false positive rate are shown in Table 1.
[0067]
[0068] Table 1
[0069] It can be seen from Table 1 that a method for predicting the size of injection molded products based on a custom LightGBM model loss greatly improves the problems of missed judgment and misjudgment in size prediction when the MSE is not much different. Compared with the traditional LightGBM model with mean square error as the loss function, the missed judgment rate is reduced by 46.8% and the misjudgment rate is reduced by 24.4%.
[0070] In order to more intuitively show the improvement of the comprehensive prediction performance of the model after using the custom loss function, the distribution of all missed and misjudged samples in the prediction results of the two prediction models is visualized. The results are as follows: Figure 2 shown.
[0071] from Figure 2 It can be seen that for these sample data with missed or misjudged detections, after using the custom loss function, the predicted size of the model is closer to the actual measured size as a whole, and the obtained model has better product size prediction performance. Finally, the LightGBM model is used for injection molded product size prediction.
[0072] It should also be noted that in this specification, terms such as "comprises", "includes" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of more restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0073] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for predicting the size of injection molded products based on a custom LightGBM model loss, characterized in that: The following steps are involved: S1. Obtain the historical SPC data of the injection molding process and the historical high-frequency sampling data of the state detection sensor of the mold filling process and perform preprocessing; S2, extracting high-frequency features from the historical high-frequency sampling data of the mold filling process state detection sensor, and splicing it with the historical SPC data of the injection molding process to form a data set; S3, perform variance filtering on the data set; S4, divide the data set into training set and test set; S5. Use the training set to train the LightGBM model with custom loss, and verify the prediction effect on the test set. Finally, the LightGBM model is used for injection molded product size prediction; specifically: S51. Introduce the target penalty factor into the loss function of LightGBM; S52. Use the training set to train the LightGBM model, and perform size prediction of injection molded products on the test set. Statistically calculate the mean square error (MSE), missed judgment rate, and false judgment rate of the prediction results to verify the prediction results. The loss function is specifically: Where N is the number of samples, y i is the true value of the i-th sample, is the predicted value of the i-th sample, Ω is the structural loss associated with the regularization term, is the target penalty factor, and its value is as follows: Among them, ω1 is the target penalty factor in the case of misjudgment, ω2 is the target penalty factor in the case of missed judgment, LL is the lower limit of size, UL is the upper limit of size, y i is the true value of the i-th sample, is the predicted value of the i-th sample.
2. The method for predicting the size of injection molded products based on the loss of a custom LightGBM model according to claim 1, characterized in that: Step S1 specifically includes: S11. Mean filling of missing values in the historical SPC data of the injection molding process; S12. Perform mean filling on the missing values in the historical high-frequency sampling data of the mold filling process state detection sensor.
3. The method for predicting the size of injection molded products based on the loss of a custom LightGBM model according to claim 1, characterized in that: In step S2, the high-frequency feature is the minimum value of each column of features in the historical high-frequency sampling data of the mold filling process state detection sensor.
4. The method for predicting the size of injection molded products based on the loss of a custom LightGBM model according to claim 1, characterized in that: Step S3 specifically includes: S31, calculate the variance of each column feature of the data set; S32. Eliminate features with zero variance.
5. The method for predicting the size of injection molded products based on the loss of a custom LightGBM model according to claim 1, characterized in that: The specific missed judgment rate is: Missed detection rate = number of missed detections of predicted samples / total number of predicted samples The specific misjudgment rate is: False positive rate = number of false positives in predicted samples / total number of predicted samples The number of missed prediction samples is specifically the number of samples whose actual value of the injection molded product size is greater than the upper limit UL and whose predicted value is less than or equal to the upper limit UL, and the number of samples whose actual value of the injection molded product size is less than the lower limit LL and whose predicted value is greater than or equal to the lower limit LL. The number of misjudgments of the predicted samples is specifically the number of samples where the true value of the injection molded product size is greater than or equal to the size lower limit LL and less than or equal to the size upper limit UL, but the predicted value is greater than the size upper limit UL or less than the size lower limit LL.