## 2 Materials and Methods
### Data Analysis and Pipeline Creation
Then, the data were divided into training and testing sets using an 80/20 ratio, meaning 80% of the data was used to train the models, while the remaining 20% was reserved for testing their performance. Because different features can have different ranges and units, scaling was necessary. A standard scaler was used to normalize the feature values. The scaler transformed the data such that each feature had a mean of 0 and a standard deviation of 1. This step is critical for neural networks because it ensures that all inputs are treated equally by the model, helping to prevent any one feature from dominating the learning process. 2. Pipeline and Model Architecture Designs. A comprehensive Machine Learning pipeline was developed incorporating ensemble models and an LSTM (Long Short-Term Memory) network to enhance the accuracy of tool wear prediction. The pipeline consisted of data preprocessing, ensemble modeling, temporal modeling with LSTM, and model evaluation. Two ensemble models--Random Forest and Gradient Boosting--were employed to leverage the strength of multiple decision trees. * **Random Forest**: Consisting of 100 decision trees, the model uses multiple random samples and averages predictions to reduce variance. * **Gradient Boosting**: This model sequentially improves predictions by focusing on areas where previous models performed poorly, capturing complex data patterns. Additionally, to capture temporal dependencies in the data, an LSTM network was implemented to model time-series behavior, which is useful for sequential dependencies like tool wear progression. A time window of 5 was set, allowing the model to predict tool wear based on the previous five time steps. * **LSTM Architecture**: The LSTM layer, containing 64 units, captures sequential data patterns, while a dropout layer with a 20% rate helps prevent overfitting. The model's output layer consists of a single neuron, reflecting the regression task. * **Early Stopping**: To avoid overfitting, early stopping was implemented, halting training once validation loss stopped improving. 3. Model Validation with Cross-Validation. To evaluate the models' generalization performance, K-Fold cross-validation with five splits was used. This approach divided the training data into five equally sized subsets. The models were iteratively trained on four of these subsets and validated on the remaining one, cycling through each fold to ensure the models were tested on all portions of the data. By doing so, every data point in the dataset was used for both training and validation, providing a comprehensive assessment of the model's performance. This method reduces the variability that might result from relying on a single train-test split and ensures a more reliable estimation of the model's predictive capabilities. The results from the cross-validation process were calculated using the MSE, which measures how well the models fit the training data. The average MSE across the folds was reported, along with the standard deviation, which gave an idea of how consistent the models' performances were across different subsets of the data. Early Stopping Mechanism. To prevent overfitting, an early stopping mechanism was implemented during training. Early stopping monitors the models' losses during training and halts the process if the losses fail to improve for a set number of epochs (in this case, 10). Additionally, the best weights of the models are restored once training stops, ensuring the best possible model is used for predictions. Model Testing and Final Evaluation. Once the models were trained and cross-validated, they were tested on the unseen test set. The test data were scaled using the same scaler fitted on the training data to ensure consistency. The model's performances on the test set were evaluated using the MSE, which provided an estimate of how well the models generalize to new, unseen data. This final MSE score gave a clear indication of the model's predictive accuracy.