## 4 Prediction of 3D Printing Process Parameters Based on GA-BP Neural Network
### GA-BP Neural Network Prediction Method for 3D Printing Process Parameters  
The essence of applying the GA-BP neural network algorithm to predict parameters lies in ensuring that the constructed neural network accurately captures the underlying relationship between the input and output variables. This critical aspect is visually depicted  
Figure 12: Comparison of predicted and actual values of BP neural network test set. (**a**) Comparison of predicted and actual values of cortical bone density test set; (**b**) comparison of actual values of predicted values of cancellous bone density test set. Figure 13: Relative error plots of BP neural network test set prediction. (**a**) Relative error in the prediction of the cortical bone density test set; (**b**) relative error in the prediction of the cancellous bone density test set. in the GA-BP parameter prediction flowchart, as illustrated in Figure 14. The flowchart illustrates the iterative optimization process that refines the network's architecture and parameters to achieve high prediction accuracy. 1. Initial population  
The BP neural network prediction model developed in this study for correlating molding process parameters with cortical bone density features an input layer with three nodes, corresponding to the filling density (%), material flow rate (%), and layer thickness (mm). The hidden layer comprises 14 nodes, and the output layer consists of a single node representing the density of the printed component. For the prediction model concerning cancellous bone density, the hidden layer contains five nodes. The length of the chromosome, which is essential for the genetic algorithm to manipulate during the optimization process, is determined as follows:  
\[S=n\times l+l\times m+l+m, \tag{16}\]  
In this formula, \(n\) represents the number of nodes in the input layer, \(m\) represents the number of nodes in the output layer, and \(l\) represents the number of nodes in the implicit layer, and the length of the chromosome can be found to be 71 and 26 by bringing the corresponding values into the formula. Figure 14: GA-BP parameter prediction flowchart. Determining the population size, a key parameter, significantly impacts the algorithm's performance. In this paper, we set the initial population size, \(M=30\). The initial iteration number is usually set to a lower value, and then adjusted based on repeated trials to determine the ideal number. In this paper, the maximum iteration number, G = 100, is used after multiple rounds of debugging to find the most suitable figure. Adaptation function  
The focal parameter in the process parameter prediction addressed in this paper is bone density. When designing the parameter prediction framework, the objective is to engineer a suitable ensemble of parameter combinations that enable the printed bone density to closely approximate, or ideally coincide with, the pre-established target value. In line with this rationale, the BP neural network prediction model detailed in the preceding section serves as the fitness function, guiding the optimization process toward achieving the desired bone density outcomes. Genetic operator  
In this paper, the roulette method is chosen for the selection operation, in which the probability \(P_{i}\) that individual \(i\) is selected is  
\[P_{i}=F_{i}/\sum_{i=1}^{N}F_{i}=F_{i}/F_{sum}, \tag{17}\]  
In this equation, N is the population size, \(F_{i}\) is the fitness of individual \(i\), \(\sum\limits_{i=1}^{N}F_{i}\) is the total fitness value of the population, and \(P_{i}\) is the selection probability for individual \(i\). The general crossover probability takes the value of [0.4, 0.9]. In this paper, the crossover probability \(P_{c}\) = 0.75.