## 4 Prediction of 3D Printing Process Parameters Based on GA-BP Neural Network
### Bone Density BP Neural Network Prediction Modeling
Given that the input and output data underwent normalization in the preceding section, their values now fall within the range of \([-1,+1]\). This ensures that the sample data entering the hidden layer via the input layer align with the value domain of the chosen activation function, tansig. For the neural network prediction model developed herein, the tansig function has been selected as the activation function for the hidden layer, facilitating the processing of data with a bipolar sigmoidal distribution. Meanwhile, the output layer utilizes the purelin function, allowing for the generation of outputs over a continuous, unbounded range. (4) Selection of training algorithm  
Upon defining the neural network's structure and activation functions, the selection of an appropriate training algorithm becomes crucial. To identify the most suitable training approach for our model, we assessed the primary training methodologies utilized in Back Propagation neural networks. Our evaluations revealed that the trainlm algorithm offers superior performance, characterized by the fewest iterations and the lowest mean square error on the validation set. Consequently, we elected to employ the trainlm algorithm as the training protocol for our neural network model. (5) BP neural network prediction results  
The parameter settings utilized in the BP neural network are detailed in Table 9.  
The comparison between the predicted and actual values of the BP neural network test set, obtained through training, is presented in Figure 12. The relative error of the BP neural network's prediction for the test set is depicted in Figure 13. Upon examining these figures, it becomes evident that the predicted values closely align with the actual test sample values, with a maximum relative error of 0.15% and a minimum relative error of 0.00005% observed in the prediction of cortical bone density. Figure 11: BP neural network model structure. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Number of** & **Learning Rate** & **Training Goal** & **Momentum Factor** & **Training Algorithms** & **Activation Function** \\ \hline
1000 & 0.01 & 0.00001 & 0.01 & trainlm & Tansig, purelin \\ \hline \hline \end{tabular}
\end{table} 
Table 9: BP neural network parameter settings. To further validate the model's reliability, three key performance indicators are employed for the analysis: the Mean Absolute Error (MAE), the Root Mean Square Error (RMSE), and the Mean Absolute Percentage Error (MAPE). For the cortical bone density predictions, the metrics reveal MAE = 0.00035, RMSE = 0.00045, and MAPE = 0.033%. In the case of cancellous bone density predictions, the maximum relative error reaches 0.96% with a minimum of 0.00166%, and the associated error metrics are MAE = 0.00046, RMSE = 0.00063, and MAPE = 0.17255%. Based on these comprehensive data points, it is demonstrable that the established neural network prediction model effectively captures the intricate non-linear relationship between the molding process parameters and the resulting densities.