## 5 Construction and Validation of Surface Roughness Prediction Model for Grind-Hardening
### Response Surface-BP Neural Network Prediction Model Construction and Validation  
BP neural network, also known as error-back propagation network (EBPN), was proposed and developed by a group of scientists led by [PERSON] and [PERSON] in 1986. As a feed-forward network composed of nonlinear transform units, it systematically solved the problem of learning connection weights in multilayer networks and proved to be particularly suitable for fuzzy, nonlinear and ill-defined pattern characteristics [18]. In grind-hardening, there are complex nonlinear mapping relationships between grinding parameters (grinding line speed, cutting depth and workpiece feed speed) and surface roughness. Therefore, this paper proposed a BP neural network grind-hardening surface roughness prediction model based on response surface experimental design. The prediction model was be constructed in MATLAB software. The BP neural network surface roughness prediction model developed in this paper has a three-layer structure, as shown in Figure 9, i.e., an input layer, a hidden layer and an output layer. The input samples are the three parameters of workpiece feed speed \(v_{w}\), cutting depth \(a_{p}\) and grinding line speed \(v_{s}\); i.e., the number of input nodes is 3. The output sample is the surface roughness \(Ra\); i.e., the number of output nodes is 1. The number of nodes in the hidden layer of the BP neural network has a significant impact on its prediction accuracy. Too few nodes may lead to low learning efficiency of the network (which requires increasing the number of training sessions) and affect the accuracy of training. Too many nodes increase the training time and could easily cause overfitting. The optimal number of hidden layer nodes can be determined by referring to the empirical formula [19]:  
\[\text{p}=\left|\sqrt{n}\right|+a \tag{1}\]  
where p is the number of neurons in the hidden layer, n represents the number of input layers, and \(a\) represents a random value. The number of nodes in the hidden layer was finally determined to be 11 according to Equation (1) and the error calculation results, i.e., the BP neural network had a 3-11-1 structure. Specifically, the 1 st to 11 th neuron of the hidden layer were denoted as W\({}_{1}\) to W\({}_{11}\), the weights between the input layer nodes and the hidden layer nodes were denoted as A\({}_{\text{ij}}\) and the weights between the hidden layer and the output layer nodes were denoted as B\({}_{\text{jk}}\). The BP neural network model flow chart is shown in Figure 10.  
The above experimental results (in Table 6; Surface roughness \(Ra\) measurements of the test based on response surface methodology) were used as sample data for the BP neural network. Of these, 70% were randomly selected as the training set, 15% as the validation set and 15% as the test set. The data samples were normalized to eliminate the effect of magnitudes between sample parameters. The model expression is as follows. \[\text{x}_{i}^{*}=(\text{x}_{i}-\text{x}_{\text{min}})/(\text{x}_{\text{max}}- \text{x}_{\text{min}}) \tag{2}\]  
In the equation, xi is the initial data, xi\({}^{*}\) is the data after normalization, i is the test number, and x\({}_{\text{max}}\) and x\({}_{\text{min}}\) are the maximum and minimum values, respectively, in the initial data. After several tests and training, the training process of the BP neural network is shown in Figure 11. The mean square error (MSE) of BP training is 0.00855 and the correlation coefficient (R) is 0.9697. The surface roughness \(Ra^{\prime}\) was predicted using the proposed  
Figure 9: BP neural network structure. model. The predictions, test values and prediction errors are shown in Table 7. According to the prediction results, only one prediction has a relative error of 10.78% and the rest of the predictions have relative errors below 10%, with a mean relative error of 2.86%. A comparison of the measured and predicted values is shown in Figure 12.