## 3 Results
### Surface Free Energy (SFE) after Milling  
Figure 17 shows the energy state of the surface layer of the AZ31 and AZ91D Mg alloys. Figure 16: 3D area roughness parameters after trochoidal milling (effect of \(\rm s_{tr}\)): (a) Sa; (b) Sz; (c) Sku; (d) Ssk. Figure 17: _Cont._  
The results from the experiments indicate that the machining parameters affect the surface free energy and its polar component. The largest increase in the value of the SFE was observed for the AZ91D alloy at the \(\mathrm{s_{tr}}\) parameter modification. The said increase amounted to 16% when machining with \(\mathrm{s_{tr}}=30\%\), compared to the specimens machined at \(\mathrm{s_{tr}}=5\%\). The maximum increase in the polar component of the SFE was a 96% increase observed in the AZ91D alloy. The cutting speed was similarly found to impact the SFE of the analyzed Mg alloys. Numerical Modelling of Rz Surface Roughness Parameters with Artificial Neural Networks after Trochoidal Milling and Brushing  
The experimental data from the measurements of Rz, the maximum height of the profile, after milling and brushing of the tested Mg alloys, AZ31 and AZ91D, served as input for the simulation of Rz with the use of ANNs. The simulations were performed by means of the Statistic Neural Networks software and with the use of MLP and RBF networks. There are several network quality indicators, including learning quality, validation quality, learning error, and validation error, derived from the least-squares method. In the study, 500 networks were developed for each modelled scenario; subsequently, the quality of networks was evaluated with the aforementioned indicators to select the most suitable network type--MLP or RBF. The obtained network parameters for AZ31 and AZ91D alloys and Rz surface roughness after milling are given in Table 3. Analyzing the networks obtained from the simulation of the surface roughness following milling and brushing for AZ31 alloy, it was found that network 3, MLP 2-8-1, is the most suitable. The said ANN contains 8 hidden neurons and was obtained after 150 iterations. The activation function of the neuron in the hidden layer into the output signal is logistic, and in the output layer it is linear. In the case of the AZ91D alloy, the best results were also obtained for the MPL network with eight hidden neurons (MLP 2-8-1), whose activation function in the hidden layer is tanh, and in the output layer, it was logistic. The network was produced after 168 iterations. The results of the surface roughness parameters, Rz, for the AZ31 and AZ91D alloys after brushing are presented in Table 4. The comparative analysis of the neural network models leads to the conclusion that for the AZ31 alloy, it was the RBF 2-8-1 network with eight neurons that provided better results. In the case of brushing treatment, the results of the simulated surface roughness parameters, Rz, for the AZ31 and AZ91D alloy are presented in Table 4.  
Figure 17: The surface layer energy state of Mg alloys depending on the trochoidal step \(\mathrm{s_{tr}}\): (**a**) Surface free energy (SFE); (**b**) the polar component of SFE, and depending on the cutting speed, \(\mathrm{v_{c}}\): (**c**) SFE; (**d**) the polar component of SFE. The comparative analysis of the neural network models shows the superiority of the RBF 2-8-1 network with eight neurons, as it provides better fitting results for the AZ31 alloy. It was, moreover, only in this case that the RBF network performed better in determining the surface roughness parameter, Rz, both after milling and brushing. This network has one hidden layer containing radial neurons, each modelling the Gaussian response surface, whereas, in the output layer, it contains linear neurons with a linear activation function. In the modelling of the surface roughness parameter, Rz, after the milling and brushing of the AZ91D alloy, comparable results were obtained for networks 4 (MLP 2-5-1) and 6 (MLP 2-4-1).