# Deep Learning for Anomaly Detection in CNC Machine Vibration Data: A RoughLSTM-Based Approach
## 1 Introduction  
In industrial production, equipment longevity and durability are crucial for ensuring efficient and successful operations. As manufacturing demands evolve, older equipment must be modernized to align with contemporary production requirements. Industry 4.0 has driven significant transformations in production technologies, focusing on modernizing legacy machines to improve efficiency and intelligence. This modernization is essential for integrating advanced digital technologies, such as the Internet of Things (IoT) and big data analytics, into existing industrial infrastructure. Legacy production machines, initially designed without the foresight of modern digital capabilities, often lack inherent support for technologies like IoT and data-driven analytics. Retrofitting these machines with sensors and data collection systems enables real-time data acquisition, optimizing production processes, detecting faults early, and improving product quality [1]. Analyzing these data is crucial for predictive maintenance, process optimization, and operational efficiency. Modernized machines not only provide companies with a competitive edge but also contribute to cost efficiency and sustainability. Among the critical components of this industrial transformation are CNC machines. CNC machines are indispensable in modern manufacturing due to their precision, speed, and ability to perform complex operations [2]. However, these machines are often subjected to various operational challenges, such as vibrations, tool wear, and errors, which can significantly impact production quality and efficiency [3]. In particular, vibrations in milling machines can lead to severe issues, including tool breakage, chip clogging, and improper tool clamping, all of which can disrupt production processes [4]. Therefore, the effective monitoring and analysis of vibration data are essential for maintaining production quality and preventing potential failures. The integration of advanced process monitoring systems and machine learning algorithms has revolutionized the way industrial processes are managed. Machine learning, in particular, has emerged as a powerful tool for analyzing data collected from production machines, enabling the prediction of systematic issues and the implementation of proactive solutions. This approach not only reduces the likelihood of equipment failures but also enhances the overall efficiency and reliability of production processes. In this context, this study introduces a novel approach called rough long short-term memory (RoughLSTM), which combines the strengths of LSTM networks with rough set theory (RST) to address the limitations of traditional anomaly detection methods. LSTM networks, a specialized form of recurrent neural networks (RNNs), are widely used for time series data analysis due to their ability to capture long-term dependencies and model complex sequential relationships. However, LSTM models often rely on fixed classification thresholds, which can lead to false positives or false negatives, especially when dealing with uncertain or ambiguous data. Rough set theory, on the other hand, provides a mathematical framework for handling uncertainty and incompleteness in data, making it particularly suitable for applications where data ambiguity is prevalent. The proposed RoughLSTM model leverages the strengths of both LSTM and RST to enhance anomaly detection in industrial settings. By integrating RST into the LSTM framework, the model can explicitly handle uncertain data and improve the accuracy of classification, particularly for ambiguous cases. This is achieved by defining an uncertainty threshold (\(\varepsilon\)) that divides the model's output into three distinct regions: the upper approach, lower approach, and boundary region. The upper approach and lower approach represent definitive classifications, while the boundary region contains ambiguous samples that require further analysis.