# Artificial Neural Network Framework for Hybrid Control and Monitoring in Turning Operations
## 3 Results  
### ANN Model Configuration  
The goal of this stage was to systematically refine the ANN model, enhancing its predictive accuracy, computational efficiency, and stability while optimizing key architectural and training parameters for improved generalization. In turning operations, a large variety of ANN models were used based on different learning algorithms, architectures, activation functions and statistical metrics [4]. The development of the ANN model followed a structured and iterative approach, progressing through several stages of refinement to optimize its predictive accuracy and computational efficiency. The evolution of the model can be outlined in four distinct models, each introducing refinements to enhance performance and stability. The main models' characteristics and attributes are presented in Table 2.  
Initially, the first implementation model_v01 established a baseline model using the Keras API 2.13.1 from TensorFlow 2.13.0 [17]. The model was structured as a simple multilayer perceptron (MLP) [18,19] with an input layer of two neurons corresponding to the machining parameters--cutting force F [daN] and spindle speed [rpm]--and an output layer predicting electrical characteristics--current I [A] and power P [kW]. Between these layers, the network incorporated two hidden layers with neurons, employing ReLU activation functions [20] to introduce non-linearity. The Adam optimizer [21] was selected for backpropagation, with mean squared error (MSE) as the loss function. Recognizing the need for improved convergence and more effective weight adjustments, the next iteration, model_v02, replaced the standard gradient-based optimizer with resilient backpropagation (RProp) [22]. This algorithm adapts the learning rate for each parameter independently, adjusting weight updates based on previous gradient signs rather than absolute values, thus mitigating issues related to vanishing or exploding gradients. Further refinements in the third iteration, model_v03, addressed potential activation saturation issues by incorporating LeakyReLU as the activation function. Unlike standard ReLU, which can cause neurons to become inactive for negative inputs, LeakyReLU maintains small negative outputs, ensuring that gradients continue to flow through the network. This change allowed for better information propagation during training, reducing the likelihood of dead neurons and improving generalization capabilities. The final iteration, model_v04, introduced a weighted loss function to differentially prioritize errors in predicting current I [A] and power P [kW]. Since machining processes have varying sensitivities to these parameters, assigning distinct penalties in the loss calculation ensured that the network maintained balanced predictive performance across both outputs. This was achieved by defining a custom weighted MSE loss function, where a weighting factor was applied to the error in predicting and another factor too. The main performance metrics of the four models are presented in Table 3.  
Another step was to identify algorithms and solutions for fine-tuning model parameters suitable for current models [23]. The model parameters were fine-tuned using Bayesian optimization, dynamically selecting optimal hyperparameters such as learning rate, hidden layer sizes, and loss weights. An additional optimization script was developed utilizing Optuna [24], which systematically optimizes the key hyperparameters based on the parameters and their specified ranges provided in Table 4.