# Artificial Neural Network Framework for Hybrid Control and Monitoring in Turning Operations
## 3 Results
### Optimized Inverse Model Training  
The purpose was to train a model to estimate cutting force F [daN] based on measured electrical parameters I [A], P [kW], and spindle speed n [rpm].  
Using the same mature model architecture developed for the forward model, the inverse model (Figure 7) is structured as a fully connected neural network with an input layer consisting of three neurons, two hidden layers with 13 and 23 neurons, respectively, and a single-output neuron, forming the 3\(\rightarrow\)13\(\rightarrow\)23\(\rightarrow\)1 architecture.  
\begin{table}
\begin{tabular}{c|c c|c} \hline \hline
**Attribute** & **Value** & **Metric** & **Optimized Value** \\ \hline API Used & PyTorch & Test MSE & 0.035449982 \\ \hline Model Architecture & 2-\textgreater{}21-\textgreater{}43-\textgreater{}2 & MAE I [A] & 0.087329008 \\ \hline Activation Function & LeakyReLU & MAE P [kW] & 0.031210328 \\ \hline Loss Function & Weighted MSE & Best Validation Loss & 0.010697708 \\ \hline Optimizer & Adam & R\({}^{2}\) I [A] & 0.991132147 \\ \hline Batch Processing & Yes, batch size = 32 & R\({}^{2}\) P [kW] & 0.998049491 \\ \hline Early Stopping & Yes, patience = 5000 & & \\ \hline \hline \end{tabular}
\end{table}
Table 5: Forward model attributes and metrics.  
Figure 6: Forward model training and validation loss for 2-\textgreater{}21-\textgreater{}43-\textgreater{}2.  
This design was implemented using PyTorch, with NumPy for numerical operations and Scikit-learn for data preprocessing, particularly for feature scaling. This model was trained to predict the cutting force (F) [daN] based on input features, which included current I [A], power P [kW], and spindle speed n [rpm].  
The weighted mean squared error (WMSE) serves as the loss function, ensuring accurate force estimation while balancing the prediction error across different scales of input data. The training process employs the Adam optimizer with a learning rate of 0.001, maintaining stability in weight updates over 5000 epochs, with an early stopping patience threshold of 5000 epochs to prevent overfitting. The model was trained using a batch size of eight, allowing efficient weight updates and improved generalization according to Table 6.  
The best validation loss achieved was 0.001419, while the weighted MSE on scaled data was 0.002964, highlighting the model's precision. The mean absolute error (MAE) for force prediction was 3.6986 daN, reflecting a low deviation from actual values. Furthermore, the model demonstrates high reliability, as indicated by an R\({}^{2}\) score of 0.997541, which signifies a strong correlation between the predicted and actual cutting force values. This optimized inverse model effectively enables real-time estimation of cutting force, contributing to adaptive machining control strategies (Figure 8).  
\begin{table}
\begin{tabular}{c|c c|c} \hline \hline
**Attribute** & **Value** & **Metric** & **Value** \\ \hline API Used & PyTorch & Test MSE & 0.002964 \\ \hline Model Architecture & 3->13->23->1 & MAE F [daN] & 3.698689 \\ \hline Activation Function & LeakyReLU & Best Validation Loss & 0.001419 \\ \hline Loss Function & Weighted MSE & R\({}^{2}\) F [daN] & 0.997541 \\ \hline Optimizer & Adam & & \\ \hline Batch Processing & Yes, batch size = 8 & & \\ \hline Early Stopping & Yes, patience = 5000 & & \\ \hline \hline \end{tabular}
\end{table}
Table 6: Inverse model attributes and metrics.  
Figure 7: Inverse model architecture.