A Machine Learning-Based Model and Method for Predicting Hardness and Optimizing Process Parameters of Micro-arc Oxidation Layer on GW63 Magnesium Alloy
By combining the XGBoost model and the particle swarm optimization algorithm, the nonlinear relationship between hardness prediction and process parameter optimization of micro-arc oxidation layer of GW63 magnesium alloy was solved. This achieved high-precision hardness prediction and output of process parameters with multiple feasible solutions, reducing experimental costs and improving optimization efficiency.
Patent Information
- Application Number
- CN202510627833.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-15
- Publication Date
- 2026-11-17
AI Technical Summary
Existing technologies are unable to effectively characterize the complex nonlinear relationship between the micro-arc oxidation process parameters and hardness of GW63 magnesium alloy, resulting in insufficient prediction accuracy. Furthermore, traditional optimization methods are prone to getting trapped in local optima, failing to provide multiple feasible solutions and incurring high experimental costs.
The XGBoost model combined with Bayesian hyperparameter optimization and particle swarm optimization are used to search for a set of solutions that meet the target hardness in the process parameter space. Data augmentation and sample weighting mechanisms are used to improve the model's prediction accuracy, and a diversity screening mechanism is designed to output multiple sets of suboptimal process parameters.
It achieves high-precision hardness prediction and process parameter optimization with a prediction error of less than 3.5%, significantly reducing R&D costs and improving optimization efficiency by more than 60%.
Smart Images

Figure CN123116758A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of metal surface treatment technology and machine learning technology, and in particular to a machine learning-based model and method for predicting the hardness of micro-arc oxidation layer of GW63 magnesium alloy and optimizing process parameters. Background Technology
[0002] GW63 magnesium alloy, due to its lightweight and high specific strength, has wide applications in aerospace, automotive manufacturing, and other fields. However, its low surface hardness and poor corrosion resistance limit its further application. Micro-arc oxidation (MAO) is a technology that generates a ceramic oxide layer on the surface of magnesium alloys through electrochemical methods. The hardness of this layer directly affects wear resistance and corrosion resistance. However, the relationship between process parameters (duty cycle, current, time) and oxide layer hardness is highly nonlinear, and traditional optimization methods have the following limitations: Insufficient accuracy of empirical models: Existing studies mostly use linear regression or simple neural networks, which are difficult to capture the complex coupling effects between parameters, and the prediction error often exceeds 10%; High experimental costs: Verification of a single set of process parameters is time-consuming, and the exploration of parameters in the high-hardness region (>140HV) relies on a lot of trial and error; Lack of multi-solution optimization capability: Traditional optimization algorithms (such as gradient descent) are prone to getting trapped in local optima and cannot provide multiple feasible solutions for engineering selection.
[0003] While existing technologies include research on material property prediction based on machine learning, most focus only on single-parameter optimization or simple model training. This makes it difficult to comprehensively characterize the complex nonlinear relationship between process parameters and hardness, and lacks global search capabilities for multi-objective parameter optimization, easily getting trapped in local optima. Furthermore, existing methods lack the ability to handle data noise and ensure model stability, resulting in insufficient prediction accuracy and difficulty in directly guiding actual production. Therefore, there is an urgent need for an intelligent prediction and optimization method specifically tailored to the characteristics of micro-arc oxidation processes. Summary of the Invention
[0004] The purpose of this invention is to propose a model that integrates data augmentation, ensemble learning, and intelligent optimization to achieve hardness prediction and process parameter optimization of the micro-arc oxidation layer of GW63 magnesium alloy.
[0005] To achieve the above objectives, this invention proposes a machine learning-based model for predicting the hardness of the micro-arc oxidation layer of GW63 magnesium alloy and optimizing process parameters. The model adopts the XGBoost model and is trained by combining Bayesian hyperparameter optimization. Based on the particle swarm optimization algorithm, the solution set that satisfies the target hardness is searched in the process parameter space.
[0006] Furthermore, the Bayesian hyperparameter optimization range includes: number of trees: 200-1200, maximum depth: 3-7, learning rate: 0.001-0.1, L2 regularization coefficient: 0.5-5.0, and column sampling ratio: 0.6-1.0.
[0007] Furthermore, the parameters of the particle swarm optimization algorithm are conveniently constrained: duty cycle 40%-80%, current 1-10A, time 1-15min; a diversity screening mechanism is designed, requiring that each parameter combination in the solution set meets the following difference thresholds: duty cycle difference ≥1.0%, current difference ≥0.5A, time difference ≥1.0min; and three sets of suboptimal process parameter combinations are output.
[0008] Furthermore, the XGBoost model introduces a sample weighting mechanism, assigning double the weight to samples in medium and high hardness regions, thereby enhancing the model's prediction accuracy in real-world application scenarios.
[0009] This invention also proposes a machine learning-based method for predicting the hardness of the micro-arc oxide layer of GW63 magnesium alloy and optimizing process parameters. The method is characterized by training the machine learning-based model for predicting the hardness of the micro-arc oxide layer of GW63 magnesium alloy and optimizing process parameters according to any one of claims 1-4, thereby achieving the prediction of the hardness of the micro-arc oxide layer of GW63 magnesium alloy and optimizing process parameters, including the following steps:
[0010] S1: Data Acquisition and Feature Construction: Data sets of micro-arc oxidation process parameters for GW63 magnesium alloy were collected using experimental equipment for model training;
[0011] Input features include duty cycle, current, and time; output feature is the Vickers hardness value of the oxide layer.
[0012] S2: Data Augmentation and Preprocessing: The original data is stratified and divided into 3 intervals according to the hardness value. Samples are randomly drawn from each interval and the data distribution is balanced.
[0013] Gaussian noise is applied to the input features; the LOESS smoothing algorithm is used to reduce the noise in the enhanced hardness values.
[0014] S3: Model Training and Optimization: The XGBoost regression model is adopted, with mean squared error as the loss function. The hyperparameter range is optimized through Bayesian search. A sample weighting mechanism is introduced to give samples in medium and high hardness regions double the weight. Overfitting is prevented through 5-fold cross-validation, and the optimal model parameters are selected.
[0015] S4: Based on the particle swarm optimization (PSO) algorithm, search for a set of solutions that satisfy the target hardness in the process parameter space.
[0016] Furthermore, in S2, Gaussian noise is applied to the input features, with the noise amplitude being 10%-20% of the standard deviation of each feature, generating 5x enhanced data;
[0017] The LOESS smoothing algorithm, with a smoothing coefficient set to 0.5, retains a weighted result of 70% original data and 30% smoothed data.
[0018] Furthermore, the mathematical expression for LOESS smoothing is:
[0019] Y smoothed =lowess(y augmented ,x index (frac=0.5, it=3)
[0020] Among them, y augmented For the enhanced hardness value sequence, x index For data indexing, the smoothing window ratio is 50%, and the number of iterations is 3.
[0021] Furthermore, the fitness function of the particle swarm optimization algorithm is defined as:
[0022] f(duty,current,time)=|H pred -H target ∣+λ1·current_penalty+λ2·time_penalty+λ3·boundary_penalty
[0023] Wherein, λ1=0.5, λ2=0.3, and λ3=5 correspond to the penalty coefficients for current deviation, time deviation, and boundary crossing, respectively.
[0024] Compared with the prior art, the advantages of the present invention are:
[0025] 1. The model of this invention is trained by combining the XGBoost model with Bayesian hyperparameter optimization, and the process constraint conditions are fused by the particle swarm optimization (PSO) algorithm to achieve multi-solution process parameter search for target hardness, thereby realizing multi-objective parameter optimization and diverse solution set output; a dynamic closed-loop optimization system is constructed to feed the optimal parameters back to the actual production process.
[0026] 2. The method of this invention solves the problems of low efficiency and poor generalization of prediction models in traditional trial and error methods by using data augmentation and model integration technology. It achieves high-precision hardness prediction and global optimization of process parameters. Experimental verification shows that the prediction error is less than 3.5%, the efficiency of process parameter optimization is improved by more than 60%, and the R&D cost is significantly reduced. Attached Figure Description
[0027] Figure 1 This is a scatter plot comparing the predicted hardness of the XGBoost model with the actual value in Embodiment 3 of the present invention.
[0028] Figure 2 Feature importance analysis of the XGBoost model in Embodiment 3 of the present invention;
[0029] Figure 3 This is the distribution of hardness data cloud and recommended parameter combination in Embodiment 3 of the present invention. Detailed Implementation
[0030] To make the objectives, technical solutions, and advantages of the present invention clearer, the technical solutions of the present invention will be further described below.
[0031] Example 1:
[0032] This invention proposes a machine learning-based model for predicting the hardness of micro-arc oxidation layers of GW63 magnesium alloy and optimizing process parameters. The model uses the XGBoost model and is trained using Bayesian hyperparameter optimization. A sample weighting mechanism is introduced, assigning double the weight to samples in the medium and high hardness regions to enhance the prediction accuracy of the model in practical application scenarios. Based on the particle swarm optimization algorithm, the solution set that satisfies the target hardness is searched in the process parameter space.
[0033] Among them, the XGBoost model: adopts the gradient boosting tree algorithm, captures nonlinear relationships by integrating multiple trees, and sets an early stopping mechanism (patience=10) to prevent overfitting;
[0034] Bayesian hyperparameter optimization: Define the hyperparameter search space, iterate 50 times using a Gaussian process surrogate model, and select the parameter combination that minimizes the mean squared error of the validation set; Bayesian search optimizes the following hyperparameter ranges: number of trees (n_estimators): 200-1200; maximum depth (max_depth): 3-7; learning rate (learning_rate): 0.001-0.1 (log-uniform distribution); L2 regularization coefficient (reg_lambda): 0.5-5.0; column sampling ratio (colsample_bytree): 0.6-1.0;
[0035] Sample weighting strategy: Give higher weights to samples in the intermediate hardness region (100-120HV) and the high hardness region (>140HV) to improve the prediction accuracy of commonly used ranges in actual production.
[0036] The fitness function of the particle swarm optimization algorithm is defined as:
[0037] f(duty,current,time)=|H pred -H target ∣+λ1·current_penalty+λ2·time_penalty+λ3·boundary_penalty
[0038] Wherein, λ1=0.5, λ2=0.3, and λ3=5 correspond to the penalty coefficients for current deviation, time deviation, and boundary crossing, respectively.
[0039] Example 2:
[0040] To predict the hardness of the micro-arc oxidation layer of GW63 magnesium alloy and optimize process parameters, the model in Example 1 needs to be trained. The data processing and model training steps are as follows:
[0041] S1: Data Acquisition and Feature Construction: Data set of micro-arc oxidation process parameters of GW63 magnesium alloy was acquired through experimental equipment. Input features included duty cycle, current, and time, and output features were Vickers hardness values of the oxide layer.
[0042] S2: Data Augmentation and Preprocessing: The original data is stratified and divided into three intervals based on hardness value: low (<100HV), medium (100-120HV), and high (>140HV). Samples are randomly drawn from each interval and the data distribution is balanced. Gaussian noise is applied to the input features, with the noise amplitude being 10%-20% of the standard deviation of each feature, generating 5x augmented data. The LOESS smoothing algorithm is used to denoise the augmented hardness values, with the smoothing coefficient set to 0.5, retaining the weighted result of 70% of the original data and 30% of the smoothed data. Synthetic data is generated based on process knowledge, including high hardness regions (duty cycle 70%-80%, current 6.0-6.5A) and low current compensation strategies (current 2-3A, duty cycle 65%-75%).
[0043] The mathematical expression for LOESS smoothing is:
[0044] Y smoothed =lowess(y augmented ,x index (frac=0.5, it=3);
[0045] y augmented For the enhanced hardness value sequence, x index For data indexing, the smoothing window ratio is 50%, and the number of iterations is 3.
[0046] S3: Model Training and Optimization: An XGBoost regression model is used with mean squared error (MSE) as the loss function. The following hyperparameters are optimized via Bayesian search: number of trees (n_estimators): 200-1200; maximum depth (max_depth): 3-7; learning rate (learning_rate): 0.001-0.1 (log-uniform distribution); L2 regularization coefficient (reg_lambda): 0.5-5.0; column sampling ratio (colsample_bytree): 0.6-1.0. A sample weighting mechanism is introduced, assigning double weight to samples in medium and high hardness regions to enhance the model's prediction accuracy in real-world applications. Five-fold cross-validation is used to prevent overfitting, and the optimal model parameters are selected.
[0047] S4: Based on the particle swarm optimization (PSO) algorithm, search for a solution set that satisfies the target hardness in the process parameter space. Set the following parameter boundary constraints: duty cycle ∈ [40, 80]%, current ∈ [1, 7]A, time ∈ [1, 15]min; design a diversity screening mechanism, requiring that each parameter combination in the solution set meets the following difference thresholds: duty cycle difference ≥ 1.0%, current difference ≥ 0.5A, time difference ≥ 1.0min; output 3 sets of suboptimal process parameter combinations for flexible selection in actual production.
[0048] Example 3:
[0049] Based on Example 2 above, the following specific examples will illustrate the model's results in predicting the hardness of the GW63 magnesium alloy micro-arc oxidation layer and optimizing process parameters. This includes the following steps:
[0050] S1: Data Acquisition: Collected 75 sets of experimental data on micro-arc oxidation of a certain type of GW63 magnesium alloy, with hardness values ranging from 90 to 170 HV.
[0051] S2: Data Augmentation and Preprocessing
[0052] S2.1: Data preprocessing: After stratified sampling, the amount of data increased to 240 sets;
[0053] S2.2: Add Gaussian noise (standard deviation is 15% of the eigenvalue), LOESS smoothing reduces the standard deviation of hardness fluctuation from 5.7HV to 4.3HV;
[0054] S2.3: Optimal hyperparameters for model training: n_estimators = 850, max_depth = 5, learning_rate = 0.03, reg_lambda = 2.5;
[0055] S2.4: Model test set performance: R 2 =0.9, RMSE=4.3HV, MAPE=1.6%, such as Figure 1 As shown;
[0056] S2.5: Feature importance ranking: Time (weight 0.60) > Current (0.31) > Duty cycle (0.09), such as Figure 2 As shown.
[0057] S3: Process Parameter Optimization
[0058] S3.1: Input target value 150HV;
[0059] S3.2: PSO optimized output:
[0060] Combination 1: Duty cycle 74.3%, current 4.3A, time 9.3min, predicted hardness 154.8HV;
[0061] Combination 2: Duty cycle 60.9%, current 5A, time 9.2min, predicted hardness 147.7HV;
[0062] Combination 3: Duty cycle 49.6%, current 5.5A, time 9.4min, predicted hardness 145.1HV;
[0063] S3: Actual verification: The measured hardness of the three sets of parameters were 152.6HV, 149.2HV, and 149.3HV, with an average error of 1.8%.
[0064] This invention provides a method and system for predicting the hardness of the micro-arc oxidation layer of GW63 magnesium alloy and optimizing process parameters based on machine learning. By integrating data augmentation, machine learning models and intelligent optimization algorithms, it achieves accurate prediction and dynamic control of micro-arc oxidation process parameters.
[0065] To further illustrate the technical effects of this invention, the performance and feature importance of the model test set in Embodiment 1 are ranked, and compared with the recommended parameter combination in Embodiment 2 and the actual hardness data cloud. Figure 1-3 As shown: These three figures collectively illustrate the performance and application of the XGBoost model in hardness prediction tasks. Feature importance analysis indicates that the three parameters—time, current, and duty cycle—have varying degrees of importance in hardness prediction, with time being the most important. The hardness prediction performance graph shows a strong correlation between the predicted and experimental values of the XGBoost model (R²). 2 =0.900), with relatively small errors (RMSE 4.3HV, MAPE 1.6%), indicating that the model has high prediction accuracy. The hardness data cloud and its recommended solution map show the distribution of hardness data under different combinations of process parameters and identify the recommended solution points. These points may represent the optimal combination of process parameters to achieve the expected hardness under specific conditions. In summary, the XGBoost model can effectively predict hardness and provide a reference for the selection of actual process parameters.
[0066] The above are merely preferred embodiments of the present invention and do not constitute any limitation on the present invention. Any equivalent substitutions or modifications made by those skilled in the art to the technical solutions and content disclosed in the present invention without departing from the scope of the present invention shall be deemed to have remained within the scope of protection of the present invention.
Claims
1. A machine learning-based GW63 magnesium alloy micro-arc oxidation layer hardness prediction and process parameter optimization model, characterized in that, The model is trained using the XGBoost model combined with Bayesian hyperparameter optimization; and the particle swarm optimization algorithm is used to search for a set of solutions that satisfy the target hardness in the process parameter space.
2. The machine learning-based GW63 magnesium alloy micro-arc oxidation layer hardness prediction and process parameter optimization model according to claim 1, characterized in that, The Bayesian hyperparameter optimization range includes: number of trees: 200-1200, maximum depth: 3-7, learning rate: 0.001-0.1, L2 regularization coefficient: 0.5-5.0, and column sampling ratio: 0.6-1.
0.
3. The machine learning-based GW63 magnesium alloy micro-arc oxidation layer hardness prediction and process parameter optimization model according to claim 1, characterized in that, The particle swarm optimization algorithm has the following parameter constraints: duty cycle 40%-80%, current 1-10A, and time 1-15min; a diversity screening mechanism is designed, requiring that each parameter combination in the solution set meets the following difference thresholds: duty cycle difference ≥1.0%, current difference ≥0.5A, and time difference ≥1.0min; and three sets of suboptimal process parameter combinations are output.
4. The machine learning-based GW63 magnesium alloy micro-arc oxidation layer hardness prediction and process parameter optimization model according to claim 1, characterized in that, The XGBoost model incorporates a sample weighting mechanism, assigning double the weight to samples in medium and high hardness regions to enhance the model's prediction accuracy in real-world application scenarios.
5. A method for predicting the hardness of a GW63 magnesium alloy micro-arc oxidation layer and optimizing process parameters based on machine learning, characterized in that, By training the machine learning-based model for predicting the hardness and optimizing the process parameters of the micro-arc oxide layer of GW63 magnesium alloy as described in any one of claims 1-4, the hardness prediction and process parameter optimization of the micro-arc oxide layer of GW63 magnesium alloy are achieved, including the following steps: S1: Data Acquisition and Feature Construction: Data sets of micro-arc oxidation process parameters for GW63 magnesium alloy were collected using experimental equipment for model training; Input features include duty cycle, current, and time; output feature is the Vickers hardness value of the oxide layer. S2: Data Augmentation and Preprocessing: The original data is stratified and divided into 3 intervals according to the hardness value. Samples are randomly drawn from each interval and the data distribution is balanced. Gaussian noise is applied to the input features; the LOESS smoothing algorithm is used to reduce the noise in the enhanced hardness values. S3: Model Training and Optimization: The XGBoost regression model is adopted, with mean squared error as the loss function. The hyperparameter range is optimized through Bayesian search. A sample weighting mechanism is introduced to give samples in medium and high hardness regions double the weight. Overfitting is prevented through 5-fold cross-validation, and the optimal model parameters are selected. S4: Based on the particle swarm optimization (PSO) algorithm, search for a set of solutions that satisfy the target hardness in the process parameter space.
6. The method of claim 5, wherein the method is based on machine learning of GW63 magnesium alloy micro-arc oxidation layer hardness prediction and process parameter optimization. In S2, Gaussian noise is applied to the input features, with the noise amplitude being 10%-20% of the standard deviation of each feature, to generate 5x enhanced data. The LOESS smoothing algorithm has a smoothing coefficient of 0.5, retaining a weighted result of 70% original data and 30% smoothed data.
7. The method of claim 6, wherein the method is based on machine learning of GW63 magnesium alloy micro-arc oxidation layer hardness prediction and process parameter optimization. The mathematical expression for LOESS smoothing is: Y smoothed = lowess(y augmented , x index , frac = 0.5, it = 3) where y augmented is the enhanced hardness value sequence, x index is the data index, the smoothing window ratio is 50%, and the iteration number is 3 times.
8. The method of claim 5, wherein the method is based on machine learning of GW63 magnesium alloy micro-arc oxidation layer hardness prediction and process parameter optimization. The fitness function of the particle swarm optimization algorithm is defined as: f(duty, current, time) = |H pred - H target + λ1 · current_penalty + λ2 · time_penalty + λ3 · boundary_penalty Wherein, λ1=0.5, λ2=0.3, and λ3=5 correspond to the penalty coefficients for current deviation, time deviation, and boundary crossing, respectively.
