Intelligent die casting quality prediction method based on SMOTE-ENN and XGBoost
By combining SMOTE-ENN with XGBoost, the problem of category imbalance in die casting production was solved, and a high-precision die casting quality prediction system was built. This system enables high-precision prediction and real-time early warning of die castings, improving the stability of the production process and the efficiency of defect identification.
Patent Information
- Application Number
- CN202511237613.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-01
- Publication Date
- 2025-12-16
AI Technical Summary
The problem of low defect detection accuracy and poor model generalization ability caused by the imbalance of categories in the die casting production process.
The SMOTE-ENN resampling strategy is adopted to balance the data distribution, and the XGBoost algorithm is combined to build a classification model. Through data cleaning and feature selection, the recognition accuracy and generalization ability of the model are improved, and a real-time early warning module is designed for quality control.
It achieves high-precision prediction and real-time early warning of die-cast part quality, significantly improves defect identification capability and model generalization performance, with an F1 score of 0.75 and an AUC of 0.8745.
Smart Images

Figure CN121145035A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of industrial manufacturing quality prediction, and relates to a die casting quality prediction method based on SMOTE-ENN and XGBoost, which is suitable for solving the problems of low defect detection precision and poor model generalization ability caused by class imbalance in the die casting production process. BACKGROUND
[0002] In the field of industrial manufacturing, die casting quality prediction is a key link to ensure product qualification rate and production efficiency. The die casting process involves complex physical and chemical changes, and its quality is affected by multiple parameters such as mold temperature, injection speed, and cooling time. Traditional quality detection methods rely on manual experience or simple statistical models, which are difficult to adapt to high-dimensional and nonlinear characteristics of die casting process data, and are easily affected by class imbalance problems, resulting in low defect detection precision and poor model generalization ability. Therefore, it is of great significance to study intelligent quality prediction algorithms based on innovative sampling methods and machine learning.
[0003] For existing quality online prediction, a die casting defect prediction and diagnosis system of Chinese invention patent CN113486457A has online prediction function, but lacks processing of data imbalance and noise problems, and does not establish a real-time early warning response mechanism. By introducing the SMOTE-ENN resampling strategy to improve the defect sample recognition ability, using the optimized XGBoost to improve the prediction accuracy, and designing a real-time warning module to support the quality control closed loop, the existing technical defects are overcome, and more efficient and reliable intelligent quality prediction and control of die casting are realized.
[0004] The die casting quality prediction system based on SMOTE-ENN and XGBoost can usually be constructed as a classification task. The development of classification algorithms can be divided into two stages: traditional prediction methods based on rules or simple statistical models and intelligent prediction methods based on ensemble learning and data enhancement. Due to the multiple process parameters in the die casting production process, the class distribution of quality defects is seriously unbalanced, and the noise samples and redundant features in the data interfere significantly, so the traditional prediction method is difficult to meet the requirements of defect recognition accuracy and real-time performance in industrial scenarios. Compared with traditional methods, the intelligent prediction method based on SMOTE-ENN hybrid sampling and XGBoost classification model has significant advantages in complex data environment: it dynamically balances the data distribution and removes noise samples, solving the problem of insufficient representation of minority class samples; at the same time, the XGBoost algorithm uses the gradient boosting framework and feature importance analysis technology to efficiently extract high-dimensional nonlinear features, and has millisecond-level real-time prediction capability, which can realize online quality early warning and dynamic adjustment of parameters in the die casting production process. SUMMARY
[0005] The purpose of the present application is to overcome the shortcomings of the prior art and provide a die casting quality prediction system based on SMOTE-ENN and XGBoost, which is suitable for high-noise and class-imbalance industrial manufacturing scenarios and realizes intelligent quality control from data collection, feature modeling to quality warning. Through dynamic balancing of data distribution, optimization of model parameter extraction ability and strengthening of online prediction mechanism, the problems of low defect recognition accuracy, weak model generalization ability and insufficient real-time performance of traditional methods are solved, thereby improving the stability of the die casting production process and reducing the defective rate and production loss caused by abnormal process parameters.
[0006] In order to achieve the above purpose, the technical scheme of the present application is:
[0007] A die casting quality intelligent prediction method based on SMOTE-ENN and XGBoost, which is realized based on a data collection module, a data preprocessing module, a SMOTE-ENN hybrid sampling module and a quality warning module, and specifically includes the following steps:
[0008] Firstly, the production process data set is obtained by the data collection module as the original data, which is as follows:
[0009] Step 1.1, 15 key process parameters are collected in real time from the die casting machine, spraying machine, cooling system and related auxiliary equipment, covering the core control points in the entire die casting production process. These parameters include but are not limited to mold temperature, injection speed, holding time, cooling time, metal liquid pouring temperature, locking force, demolding stroke, spraying time, spraying pressure, smelting temperature, filling time, pressure increasing start time, slow shooting stage time, fast shooting stage pressure, hydraulic system pressure, etc.
[0010] Step 1.2, by high-frequency collection and recording of the 15 key process parameters obtained in step 1.1, a complete production process data set is constructed.
[0011] Secondly, the production process data set obtained in the first step is pretreated based on the data collection module, and is cleaned, converted and feature selected, which is as follows:
[0012] Step 2.1, the missing values, inconsistent records and abnormal points in the production process data set are processed, and invalid samples are removed to obtain the cleaned data set.
[0013] Step 2.2, Key parameter screening on the cleaned dataset to identify the most significant variables affecting product quality from the data, reducing the data dimensionality. The quality assessment records of the final product by human include pass: the product meets the quality standards, no defects; defect: the product has size deviation, surface flaws, performance not up to standard, etc. The quality test results are used as labels to train the classification (pass / defect) model. The present application proposes a method for screening key quality-related parameters based on the principle that the correlation coefficient is greater than a set threshold. As follows:
[0014] Step 2.2.1, First, use the cleaned dataset to ensure data reliability, which reflects the changes in equipment operating status and directly affects the quality characteristics of the final product.
[0015] Step 2.2.2, Next, calculate the correlation coefficient I(Xi) between each parameter and the quality test results. The correlation coefficient calculated can quantify the degree of influence of each parameter on product quality.
[0016] Step 2.2.3, Then, according to the pre-set threshold, select those parameters with a correlation coefficient higher than the threshold as key quality-related parameters. The threshold range is I(Xi)>0.2.
[0017] Finally, through the above preprocessing process, a preprocessed dataset for subsequent sampling and modeling is obtained. This dataset contains cleaned and screened key quality-related parameters and their corresponding quality labels (pass / defect) to support the SMOTE-ENN hybrid sampling module for sample balancing.
[0018] Step 3, Balance the preprocessed dataset based on the SMOTE-ENN hybrid sampling module. Since the number of pass samples is much larger than that of defect samples, there is a significant class imbalance problem. The present application introduces the SMOTE-ENN hybrid sampling strategy in this step to balance and optimize the preprocessed dataset. Specifically as follows:
[0019] Step 3.1, Based on the preprocessed dataset, first apply the SMOTE (Synthetic Minority Over-sampling Technique) algorithm to the defect samples (minority class) for oversampling. The processing method is as follows:
[0020] Step 3.1.1, For each minority class sample, find k nearest neighbor samples in its feature space.
[0021] Step 3.1.2, Randomly select one of the nearest neighbor samples and perform linear interpolation with the current sample.
[0022] Step 3.1.3, new sample points are generated in the interpolation direction until the number of minority class samples is close to that of majority class samples.
[0023] Step 3.1.4, the generated new samples have the same label as the original samples, which are used to expand the training set.
[0024] This processing method can effectively alleviate the class imbalance problem and output the oversampled dataset.
[0025] Step 3.2, after completing the SMOTE oversampling in step 3.1, the majority class samples (qualified samples) in the oversampled dataset are processed using the ENN (Edited Nearest Neighbors) algorithm, as follows:
[0026] Step 3.2.1, for each majority class sample, calculate its n nearest neighbor samples in the feature space.
[0027] Step 3.2.2, determine whether the class of the nearest neighbor is consistent with the current sample;
[0028] Step 3.2.3, if the majority of the nearest neighbor samples are not consistent with the current sample, it is considered that the sample may be noise or located in the boundary region;
[0029] Step 3.2.4, delete such inconsistent samples to reduce noise interference in the training data.
[0030] This processing step improves the overall quality of the dataset, removes abnormal points that may cause misclassification, and outputs a balanced dataset after ENN cleaning.
[0031] Step 3.3, after completing the above two steps of SMOTE and ENN processing, the final balanced and optimized sample dataset is obtained. In this dataset, the number of qualified and defective samples tends to be balanced, noise samples have been effectively removed, and it has stronger representativeness and training value.
[0032] Fourth step, based on the XGBoost classification model module, the balanced and optimized sample dataset obtained in the third step is subjected to high-precision identification and classification, a product quality prediction model is constructed, and a trained XGBoost quality classification model is obtained. The present application adopts the XGBoost (eXtreme Gradient Boosting) algorithm to construct the product quality prediction model. XGBoost is an ensemble learning method based on the Gradient Boosting Decision Tree (GBDT) framework, which has the advantages of fast modeling speed, strong anti-overfitting ability and strong feature importance analysis ability, and is particularly suitable for the complex scenarios in the present application, such as high-dimensional features and class imbalance. The specific model construction process is as follows:
[0033] Step 4.1, accurately convert the balanced and optimized sample dataset output in Step 3 into a trainable format for XGBoost, and complete the preliminary configuration of the model structure. By dividing the training and validation datasets, a foundation is laid for subsequent modeling and parameter tuning.
[0034] Step 4.1.1, use the balanced and optimized sample dataset output in Step 3 as the training input for the XGBoost model, which includes feature variables and corresponding quality labels.
[0035] Step 4.1.2, initialize the XGBoost model framework, and specify the task as a binary classification problem.
[0036] Step 4.1.3, divide the dataset into training and validation sets, and use cross-validation to ensure the model's generalization ability.
[0037] Step 4.2, implement parameter space exhaustive evaluation through grid search to determine the parameter configuration that achieves the best results on the validation set. XGBoost model performance is influenced by multiple hyperparameters, including: learning rate (learning_rate): controls the step size of each iteration; maximum depth of tree (max_depth): controls the model complexity; subsample ratio (subsample): controls the proportion of data used for each tree; regularization coefficients (reg_alpha and reg_lambda): control the model's generalization ability. This invention uses the grid search (Grid Search) method to jointly optimize the above parameters, as follows:
[0038] Step 4.2.1, define the candidate value range of each hyperparameter to form a search grid.
[0039] Step 4.2.2, perform cross-validation on the training set under each parameter combination, and record the performance indicators (such as F1 score);
[0040] Step 4.2.3, select the set of parameters that optimizes the validation set performance as the final model configuration, and output the optimized parameter combination.
[0041] Step 4.3, during the model training process, several optimization mechanisms are introduced to further improve the robustness of the XGBoost model, prevent overfitting, and improve computational efficiency, including sample weight adjustment, regularization term design, and early stopping mechanism, to ensure that the model still has stable performance in complex industrial data environments. To further improve the robustness and training efficiency of the model, the following mechanisms are introduced during the model training process:
[0042] Sample weight dynamic adjustment mechanism: inspired by the adaptive boosting (AdaBoost) idea, higher weights are assigned to misclassified samples to guide the model to pay more attention to difficult-to-classify samples;
[0043] Regularization strategy: L1 and L2 regularization terms are added to the loss function to suppress model complexity and effectively prevent overfitting;
[0044] Early stopping mechanism: when the performance of the validation set does not significantly improve in consecutive iterations, the training is terminated early to save computing resources and prevent overfitting.
[0045] Step 4.4, by applying the optimized model to the validation dataset, complete the prediction task, and classify the prediction results based on the preset threshold. The final output is the trained XGBoost quality classification model, which provides decision basis for subsequent quality early warning mechanism.
[0046] Step 5, based on the output results of the XGBoost quality classification model, construct the quality early warning module for real-time quality evaluation and defect identification; specifically as follows:
[0047] Based on the output results of the XGBoost quality classification model, construct the quality early warning module for early identification and response to potential substandard products in actual production. This module relies on the XGBoost quality classification model trained in Step 4, receives the defect probability value P output by the XGBoost quality classification model for each sample to be judged, and compares it with the preset classification threshold T:
[0048] If the predicted probability P of the sample is greater than or equal to the threshold T, and the XGBoost quality classification model judges it as a defect class, the system automatically marks the sample as a high-quality risk product and triggers a quality warning signal. The warning signal can be prompted through sound and light, system interface pop-up window, MES platform push, etc. It can also be linked to control strategies to adjust process parameters or suspend equipment operation. The module also records each judgment result (including sample number, predicted probability, whether to warn, etc.) into the production log for subsequent quality traceability, model retraining, and parameter optimization analysis. Through the introduction of this module, online monitoring and early warning response of product quality driven by machine learning model are realized, and the identification efficiency and intervention ability of the overall system for substandard products are improved.
[0049] If the predicted probability P is less than the threshold T, the sample is marked as a low-risk product and no quality warning signal is triggered, allowing it to enter the next production link, but the system still records the predicted probability P and quality-related parameters of the sample for subsequent quality traceability and XGBoost quality classification model optimization.
[0050] The threshold value T ranges from 0.1 to 0.2.
[0051] The effects and benefits of the present application are:
[0052] The present application effectively solves the problems of unbalanced data categories, large noise interference and difficult defect identification in the industrial field of die casting, realizes high-precision prediction and real-time warning of die casting product quality, and the technical effects are reflected in significantly improving the defect identification ability and model generalization performance, and the F1 score can reach 0.75 and the AUC can reach 0.8745. The realization of the technical effects benefits from the following key mechanisms: through the SMOTE-ENN hybrid sampling strategy, the data set is balanced and noise is cleaned, the learning ability of the model to the minority class defect sample is improved; using XGBoost to build a high-performance classification model, combining hyperparameter grid optimization, regularization and early stopping mechanism, the stability and adaptability of the model are improved; introducing quality warning rules based on prediction probability, constructing a responsive and traceable intelligent quality control system, so as to realize the early identification and rapid intervention of die casting product quality problems. BRIEF DESCRIPTION OF DRAWINGS
[0053] Figure 1 The figure is the overall architecture diagram of the system of the present application;
[0054] Figure 2 The figure is the effect diagram without using the sampling method;
[0055] Figure 3 The figure is the effect diagram of the SMOTE-ENN hybrid sampling method;
[0056] Figure 4 The figure is the sampling effect comparison diagram;
[0057] Figure 5 The figure is the classification model ROC curve diagram. DETAILED DESCRIPTION
[0058] The technical solutions of the present application will be further described in detail below in combination with the drawings and specific examples, and the specific examples described are only used to explain and illustrate the present application, and do not limit the present application.
[0059] Reference Figure 1 , Figure 1 The present application provides a die casting quality intelligent prediction method based on SMOTE-ENN and XGBoost, which is realized based on a data acquisition module, a data preprocessing module, a SMOTE-ENN hybrid sampling module and a quality warning module, and specifically includes the following steps:
[0060] The first step is to obtain a production process data set through a data acquisition module as raw data, as follows:
[0061] Step 1.1, through the industrial Internet of Things (IoT) technology, 15 key process parameters are collected in real time from the die casting machine, spraying machine, cooling system and related auxiliary equipment, covering the core control points in the entire die casting production process, and the sampling frequency is 100 Hz. These parameters include but are not limited to mold temperature, injection speed, holding time, cooling time, metal liquid pouring temperature, locking force, demolding stroke, spraying time, spraying pressure, smelting temperature, filling time, pressure increase start time, slow shot phase time, fast shot phase pressure, hydraulic system pressure, etc.
[0062] Step 1.2, by high-frequency collection and recording of the 15 key process parameters obtained in step 1.1, a complete production process data set is constructed. So far, a total of 578 effective production records have been collected, of which 433 are qualified product samples, accounting for about 74.9%; 121 are defective samples, accounting for about 20.9%; and 24 are to be determined samples or abnormal data, which have been excluded.
[0063] The second step is to preprocess the production process data set obtained in the first step based on the data acquisition module, including cleaning, conversion and feature selection, as follows:
[0064] Step 2.1, the missing values, inconsistent records and abnormal points in the production process data set are processed, and invalid samples are excluded to obtain the cleaned data set.
[0065] Step 2.2, the key parameters of the cleaned data set are selected to identify the most significant variables affecting product quality from the data, reducing the data dimension. Through manual quality evaluation of the final product, including qualified: the product meets the quality standard and has no defects; defective: the product has size deviation, surface defects, performance not up to standard, etc. The quality test result is used as a label to train the classification (qualified / defective) model. The present application proposes a method for selecting key quality-related parameters based on the principle that the correlation coefficient is greater than a set threshold. As follows:
[0066] Step 2.2.1, first, use the cleaned data set to ensure data reliability, these data parameters reflect the changes in equipment operating status and directly affect the quality characteristics of the final product.
[0067] Step 2.2.2, next, calculate the correlation coefficient I(Xi) between each parameter and the quality test result, which can quantify the influence of each parameter on product quality. Where Xi represents the i-th quality-related parameter, Y0 represents the number of unqualified products, and Y1 represents the number of qualified products. The formula is as follows:
[0068]
[0069] Here, p(x, y0) and p(x, y1) are the joint distribution of xi and y0 y1, respectively, while p(x), p(y0), and p(y1) are the probability distribution of variables xi, y0, and y1, respectively. The correlation coefficient calculated can quantify the degree of influence of each parameter on product quality. Subsequently, according to the preset threshold, those parameters with correlation coefficients higher than the threshold are selected as key quality-related parameters. This method not only simplifies the data analysis process, but also improves the accuracy and efficiency of model training.
[0070] Step 2.2.3, subsequently, according to the preset threshold, those parameters with correlation coefficients higher than the threshold are selected as key quality-related parameters. The threshold range is I(Xi)>0.2.
[0071] Finally, through the above preprocessing process, a preprocessed data set for subsequent sampling and modeling is obtained. The data set contains key quality-related parameters and their corresponding quality labels (qualified / defective) after cleaning and screening, which is used to support the SMOTE-ENN hybrid sampling module for sample balancing processing.
[0072] Third step, based on the SMOTE-ENN hybrid sampling module, the preprocessed data set is balanced, as shown in Figure 2 The effect diagram without using the sampling method. Since the qualified samples are much more than the defective samples, there is a significant class imbalance problem. In this step, the SMOTE-ENN hybrid sampling strategy is introduced to balance and optimize the preprocessed data set. Specifically as follows:
[0073] Step 3.1, based on the preprocessed data set, first apply the SMOTE (Synthetic Minority Over-sampling Technique) algorithm to the defective samples (minority class) in it for oversampling. Refer to Figure 4 Comparison of data set effect diagrams under different sampling methods. The processing method is as follows:
[0074] Step 3.1.1, for each minority class sample, find k nearest neighbor samples in its feature space, k_neighbors=5.
[0075] Step 3.1.2, randomly select one of the nearest neighbor samples and perform linear interpolation with the current sample.
[0076] Step 3.1.3, generate new sample points along the interpolation direction until the number of minority class samples approaches that of majority class samples.
[0077] Step 3.1.4, the new sample after generation has the same label as the original sample, which is used to expand the training set.
[0078] This processing method can effectively alleviate the class imbalance problem and output the oversampled dataset.
[0079] Step 3.2, after SMOTE oversampling in step 3.1, the majority class samples (qualified samples) in the oversampled dataset are processed by ENN (Edited Nearest Neighbors) algorithm, as follows:
[0080] Step 3.2.1, for each majority class sample, calculate its n nearest neighbors in the feature space, n_neighbors = 3.
[0081] Step 3.2.2, judge whether the class of its neighbors is consistent with the current sample;
[0082] Step 3.2.3, if the majority of the neighbor samples are inconsistent with the current sample, it is considered that the sample may be noise or located in the boundary region;
[0083] Step 3.2.4, delete such inconsistent samples to reduce the noise interference in the training data.
[0084] This processing step improves the overall quality of the dataset, removes abnormal points that may cause misclassification, and outputs the balanced dataset after ENN cleaning.
[0085] Step 3.3, after the above two steps of SMOTE and ENN processing, the final balanced and optimized sample dataset is obtained. Figure 3 , the effect diagram of SMOTE-ENN hybrid sampling method. In this dataset, the number of qualified and defective samples tends to be balanced, and the noise samples have been effectively removed, with stronger representativeness and training value.
[0086] Step 4, based on the XGBoost classification model module, the balanced and optimized sample dataset obtained in step 3 is used for high-precision identification and classification, and a product quality prediction model is constructed. The product quality prediction model is constructed by using XGBoost (eXtreme Gradient Boosting) algorithm. XGBoost is an integrated learning method based on Gradient Boosting Decision Tree (GBDT) framework, which has the advantages of fast modeling speed, strong anti-overfitting ability and strong feature importance analysis ability, and is particularly suitable for the complex scenarios in the present invention, such as high-dimensional features and class imbalance. The specific model construction process is as follows:
[0087] Step 4.1, accurately convert the balanced and optimized sample dataset output from the third step into a format that can be trained by XGBoost, and complete the preliminary configuration of the model structure. By dividing the training and validation dataset, lay the foundation for subsequent modeling and parameter tuning.
[0088] Step 4.1.1, use the balanced and optimized sample dataset output from the third step as the training input for the XGBoost model, which includes feature variables and corresponding quality labels.
[0089] Step 4.1.2, initialize the XGBoost model framework, and specify the task as a binary classification problem.
[0090] Step 4.1.3, divide the dataset into training and validation sets, and use cross-validation to ensure the model's generalization ability.
[0091] Step 4.2, realize parameter space exhaustive evaluation through grid search to determine the parameter configuration that can achieve the best effect on the validation set. XGBoost model performance is affected by multiple hyperparameters, including: learning rate (learning_rate): controls the step size of each iteration; maximum depth of tree (max_depth): controls the complexity of the model; subsample ratio (subsample): controls the proportion of data used for each tree; regularization coefficients (reg_alpha and reg_lambda): control the generalization ability of the model. During model training, set the learning rate (learning_rate) to 0.1, the maximum depth (max_depth) to 5, the base learner number (n_estimators) to 100, the subsample ratio (subsample) and the column sample ratio (colsample_bytree) to 0.8; introduce L1 (reg_alpha=0.5) and L2 (reg_lambda=1.0) regularization terms to prevent overfitting; to address the class imbalance problem, set the class weight parameter scale_pos_weight to 3.5 (adjusted according to the class proportion of the training set); use AUC as the evaluation metric, and set early_stopping_rounds=20 as the early stopping condition, if there is no significant performance improvement on the validation set within 20 rounds, terminate the training. The invention uses the grid search (Grid Search) method to jointly optimize the above parameters, as follows:
[0092] Step 4.2.1, define the candidate value range of each hyperparameter to form a search grid.
[0093] Step 4.2.2, cross-validate the training set under each parameter combination, and record the performance indicators (such as F1 score);
[0094] Step 4.2.3. Select the set of parameters that optimizes the performance of the validation set as the final model configuration, and output the optimized parameter combination.
[0095] Step 4.3. In the model training process, to further improve the robustness of the XGBoost model, prevent overfitting, and improve computational efficiency, several optimization mechanisms are introduced in the training strategy, including sample weight adjustment, regularization term design, and early stopping mechanism, to ensure that the model still has stable performance in complex industrial data environments. To further improve the robustness and training efficiency of the model, the following mechanisms are introduced during the model training process:
[0096] Sample weight dynamic adjustment mechanism: inspired by the adaptive boosting (AdaBoost) idea, higher weights are assigned to misclassified samples to guide the model to pay more attention to difficult classification samples;
[0097] Regularization strategy: L1 and L2 regularization terms are added to the loss function to suppress model complexity and effectively prevent overfitting;
[0098] Early stopping mechanism (Early Stopping): when the performance of the validation set does not significantly improve in consecutive iterations, the training is terminated early to save computational resources and avoid overfitting.
[0099] Step 4.4. By applying the optimized model to the validation dataset, the prediction task is completed, and the prediction results are classified based on the pre-set threshold. The final output is the trained XGBoost model, which provides decision-making basis for subsequent quality warning mechanisms.
[0100] In a preferred embodiment of the present application, XGBoost is used to build a multi-classification prediction model, aiming to effectively identify and classify different levels of product quality. To improve the generalization ability of the model, the input dataset is balanced during the model training phase to alleviate the bias problem caused by class imbalance. By introducing a gradient descent optimization strategy, the loss function is minimized, and the decision tree structure is updated iteratively until the model converges.
[0101] In the specific implementation process, the present application combines the K-fold cross-validation (K-Fold Cross Validation) strategy to train and validate each set of hyperparameters multiple times to comprehensively evaluate their generalization performance. Evaluation indicators include but are not limited to accuracy (Accuracy), recall (Recall), F1 score (F1 Score), etc. Finally, the set of hyperparameters that performs best on the validation set is selected as the best configuration of the model.
[0102] The XGBoost model training setting hyperparameters: gamma = 0.2, learning_rate = 0.1, max_depth = 5, n_estimators = 100; use 3-fold stratified cross-validation for model training; dynamically adjust the classification threshold to 0.1652 to improve recall rate.
[0103] Table 1 Comparison of performance results of different models
[0104] Method AUC AP F1 score Best threshold XGBoost 0.8147 0.6490 0.52 0.145 Smote-XGBoost 0.8773 0.6053 0.69 0.321 Smote-Enn-Undersample-XGBoost 0.8401 0.6535 0.57 0.490 Smote-Enn-LogisticRegression 0.6078 0.3584 0.38 0.300 Smote-Enn-RandomForest 0.7512 0.4812 0.56 0.300 Smote-Enn-XGBoost 0.8745 0.7931 0.75 0.1652
[0105] As shown in Table 1, the AUC of the Smote-Enn-XGBoost-based model is 0.8745, the AP is 0.7931, the F1 score is 0.75, and the optimal threshold is 0.1652. Compared with other models, the Smote-Enn-XGBoost-based model has the highest evaluation indicators in each direction, and the reference Figure 5 is the ROC curve of the classification model. Therefore, the Smote-Enn-XGBoost-based model has the best results for product quality prediction.
[0106] In the fifth step, based on the output results of the model, a quality warning module is constructed for real-time quality evaluation and defect identification. The specific steps are as follows:
[0107] Based on the output results of the model, a quality warning module is constructed for early identification and response to potential substandard products in actual production. This module relies on the XGBoost quality classification model trained in the fourth step, receives the defect probability value P output by the model for each sample to be judged, and compares it with the preset classification threshold T (T = 0.1652 in this embodiment). If the predicted probability P of the sample is greater than or equal to the threshold T, and the model judges its category as a defect, the system automatically marks the sample as a high-quality risk product and triggers a quality warning signal. The warning signal can be prompted through sound and light, system interface pop-up, MES platform push, etc. It can also be linked to control strategies to adjust process parameters or suspend equipment operation. The module also records each judgment result (including sample number, predicted probability, whether to warn, etc.) into the production log for subsequent quality traceability, model retraining, and parameter optimization analysis. Through the introduction of this module, online monitoring and early warning response of product quality driven by machine learning model are realized, and the identification efficiency and intervention ability of the overall system for substandard products are improved.
[0108] The above-described embodiments are merely illustrative of the application and do not seek to limit the application to the exact forms described. Numerous modifications are possible in light of the above teachings to the skilled artisan without departing from the underlying conception and principles of the application. The exemplary embodiments were chosen and described in order to explain the principles of the application and its practical application to thereby enable others skilled in the art to understand the application, to reproduce the various exemplary embodiments and its attendant benefits, and to utilize the application in various embodiments and various forms. The scope of the application is to be defined by the claims and their equivalents.
Claims
1. A die casting quality intelligent prediction method based on SMOTE-ENN and XGBoost, characterized in that, The die casting quality intelligent prediction method is realized based on a data acquisition module, a data preprocessing module, an SMOTE-ENN hybrid sampling module and a quality early warning module, and specifically comprises the following steps: In the first step, a production process data set is obtained through the data acquisition module as original data; specifically: Step 1.1, a plurality of key process parameters are acquired in real time from a die casting machine, a spraying machine, a cooling system and related auxiliary equipment, covering core control points in the entire die casting production process; Step 1.2, a complete production process data set is constructed through high-frequency acquisition and recording of the key process parameters obtained in step 1.1; In the second step, the production process data set obtained in the first step is preprocessed based on the data acquisition module to obtain a preprocessed data set for subsequent sampling and modeling; The preprocessing includes cleaning, conversion and key quality-related parameter screening; wherein the key quality-related parameters are screened based on the principle that the correlation coefficient is greater than a set threshold; In the third step, the preprocessed data set is balanced based on the SMOTE-ENN hybrid sampling module, and in this step, an SMOTE-ENN hybrid sampling strategy is introduced to balance and optimize the preprocessed data set; specifically: Step 3.1, based on the preprocessed data set, the defect samples therein are first oversampled by the SMOTE algorithm; Step 3.2, the qualified samples in the oversampled data set obtained are cleaned by the ENN algorithm; Step 3.3, after the two steps of SMOTE and ENN are completed, a final balanced and optimized sample data set is obtained; in the balanced and optimized sample data set, the number of qualified and defect samples tends to be balanced; In the fourth step, the balanced and optimized sample data set obtained in the third step is identified and classified with high precision based on an XGBoost classification model module, a product quality prediction model is constructed, and a trained XGBoost quality classification model is obtained; specifically: Step 4.1, the balanced and optimized sample data set output in the third step is accurately converted into an XGBoost trainable format, and the preliminary configuration of the model structure is completed; Step 4.2, the grid search is used to realize the exhaustive evaluation of the parameter space, so as to determine the hyperparameter configuration that can obtain the best effect on the validation set; Step 4.3, in the model training process, a plurality of optimization mechanisms are introduced in the training strategy; Step 4.4, the optimized model is applied to the validation data set to complete the prediction task, and the prediction result is classified and judged based on a preset threshold, and finally the trained XGBoost quality classification model is output; In the fifth step, based on the output result of the XGBoost quality classification model, a quality early warning module is constructed to perform real-time quality evaluation and defect identification.
2. The SMOTE-ENN and XGBoost-based die casting quality intelligent prediction method according to claim 1, characterized in that, In step 1.1, the key process parameters include but are not limited to mold temperature, injection speed, holding time, cooling time, metal liquid pouring temperature, locking force, demolding stroke, spraying time, spraying pressure, smelting temperature, filling time, pressure increase start time, slow shooting stage time, fast shooting stage pressure and hydraulic system pressure.
3. The SMOTE-ENN and XGBoost-based die casting quality intelligent prediction method according to claim 1, characterized in that, The second step specifically comprises: Step 2.
1. In the production process data set, missing values, inconsistent records and outliers are processed, and invalid samples are removed to obtain a cleaned data set. Step 2.
2. The key parameters of the obtained cleaned data set are screened, the variables that have the most significant impact on product quality are identified from the data, and the data dimension is reduced. Finally, the records of the final product quality evaluation are obtained, and the quality detection results are used as labels for training the classification model, including two categories of qualified and defective.
4. The SMOTE-ENN and XGBoost-based die casting quality intelligent prediction method according to claim 1, characterized in that, In the second step: the method for screening key quality-related parameters based on the principle that the correlation coefficient is greater than a set threshold is as follows: Step 2.2.
1. Use the data set after data cleaning to ensure data reliability; Step 2.2.
2. Calculate the correlation coefficient I(Xi) between each parameter and the quality detection result, and quantify the influence of each parameter on product quality through calculation; Step 2.2.
3. According to the pre-set threshold, parameters with a correlation coefficient higher than the threshold are selected as key quality-related parameters; the threshold range is I(Xi)>0.
2. The pre-processed data set contains key quality-related parameters and their corresponding quality labels after cleaning and screening, which are used to support the SMOTE-ENN hybrid sampling module for sample balancing processing, where the quality labels include qualified and defective.
5. The SMOTE-ENN and XGBoost-based die casting quality intelligent prediction method according to claim 1, characterized in that, The step 3.1 is as follows: Step 3.1.
1. For each minority class sample, find k nearest neighbor samples in its feature space; Step 3.1.
2. Randomly select one of the nearest neighbor samples and perform linear interpolation with the current sample; Step 3.1.
3. Generate new sample points along the interpolation direction until the number of minority class samples approaches that of majority class samples; Step 3.1.
4. The generated new sample has the same label as the original sample and is used to expand the training set.
6. The SMOTE-ENN and XGBoost-based die casting quality intelligent prediction method according to claim 1, characterized in that, The step 3.2 is as follows: Step 3.2.
1. For each majority class sample, calculate n nearest neighbor samples in its feature space; Step 3.2.
2. Determine whether the class of the nearest neighbor is consistent with the current sample; Step 3.2.
3. If the majority of the nearest neighbor samples are not consistent with the current sample, it is considered that the sample may be noise or located in the boundary region; Step 3.2.
4. Delete such inconsistent samples to reduce noise interference in the training data.
7. The SMOTE-ENN and XGBoost-based die casting quality intelligent prediction method according to claim 1, characterized in that, The step 4.1 is as follows: Step 4.1.
1. Use the balanced and optimized sample data set output in the third step as the training input of the XGBoost model, which includes feature variables and corresponding quality labels; Step 4.1.
2. Initialize the XGBoost model framework and specify the task as a binary classification problem; Step 4.1.
3. Divide the data set into training set and validation set, and use cross-validation to ensure the generalization ability of the product quality prediction model. In step 4.2: the hyperparameters of the XGBoost model are jointly optimized using the grid search method to obtain the best hyperparameter configuration; the details are as follows:
8. The SMOTE-ENN and XGBoost-based die casting quality intelligent prediction method according to claim 1, characterized in that, Step 4.2.
1. Define the candidate value range of each hyperparameter to form a search grid; Step 4.2.2, cross-validation is performed on the training set under each combination of parameters, and the performance indicators are recorded; Step 4.2.3, select the set of parameters that optimizes the performance of the validation set as the final model configuration, and output the optimized parameter combination.
9. The SMOTE-ENN and XGBoost-based die casting quality intelligent prediction method according to claim 1, characterized in that, In the step 4.3, the optimization mechanism includes sample weight adjustment, regularization term design, and early stopping.
10. The SMOTE-ENN and XGBoost-based die casting quality intelligent prediction method according to claim 1, characterized in that, The fifth step is specifically: Based on the output results of the XGBoost quality classification model, a quality early warning module is constructed for early identification and response to potential substandard products in actual production; The quality early warning module relies on the XGBoost quality classification model trained in the fourth step, receives the defect probability value P output by the XGBoost quality classification model for each sample to be judged, and compares it with the preset classification threshold T: If the predicted probability P is greater than or equal to the threshold T, and the XGBoost quality classification model judges that it belongs to the defect class, the sample is marked as a high-quality risk product, and a quality early warning signal is triggered; If the predicted probability P is less than the threshold T, the sample is marked as a low-risk product, no quality early warning signal is triggered, and it is allowed to enter the next production link, but the system still records the predicted probability P and quality-related parameters of the sample for subsequent quality traceability and XGBoost quality classification model optimization; The threshold T ranges from 0.1 to 0.2.
Citation Information
Patent Citations
Die casting defect prediction and diagnosis system
CN113486457A
Cited By
Precision casting hot spot identification and optimization method based on machine learning
CN121743881A