# Predictive Maintenance on the Machining Process and Machine Tool
## 5 Case Study
### Data Processing  
As explained before, there is a huge amount of possibilities, and in this work, reduction, cleaning, and transformation were applied.  
Data reduction is based on extracting characteristics from the original signal to have a smaller amount of data, so the computational cost is reduced and the data are clearer. The first step is to cut the signal so that we can observe the spindle load evolution for each tool. To achieve this aim, the signal, which represents the number of pieces machined, was used, since the piece number is restarted when the tool changes. In addition to this reduction, each machined piece was characterized by the highest spindle load value recorded during its machined time, which was suggested by the expert.  
The obtained characterization (see Figure 3) appeared to have some outliers, which must be removed. To achieve this aim, the three-sigma edit rule technique was applied [17]. This method is based on the difference between each value and the median of the signal:  
\[MADN(p)=\frac{Median\{|S(p)-Median\{S\}|\}}{0.6745}\]  
where \(S\) is the full spindle load signal and \(p\) is the number of machined pieces. The robust three-sigma edit rule establishes that the observation \(S(p)\) is an outlier if: \(|S(p)-Median\{S\}|>r\), where \(r\) is a threshold value. In this case, \(r=3\) is set with expert supervision.  
Figure 2: Data acquisition platform flows and architecture.  
As a second step, and once the outliers were removed, we transformed the series by a smoothing method. The Savitzky-Golay [43] and Wiener [44] smoothing methods were tested. Savitzky-Golay is a smoothing method based on moving average value. In particular, in this work, \(S(p)\) being the value of the series in the \(p^{\text{th}}\) machined piece or point, Savitzky-Golay determined a new \(S_{f}(p)\) by calculating a cubic polynomial with \(n=7\) values around the point \(p\):  
\[S_{f}(p)=C_{p-(n-1)/2}*S(p-(n-1)/2)+\ldots+C_{p}*S(p)+\ldots+C_{p+(n-1)/2}*S(p +(n-1)/2)\,\]  
where \(C_{p}\) is the coefficient associated with the \(p^{\text{th}}\) point on the polynomial approximation.  
The Savitzky-Golay filter was the transformation that obtained a better visualization of the signal and enabled detecting the main trends on the series, which was the main issue of this part of the study.  
Taking into account that some of the signals had different behaviors (see Figure 4), a final step in data processing was carried out. This reduction was obtained by applying an iterative clustering method. This methodology provided a two group classification based on K-means on each iteration, and if one of the groups had less than 10% of the signals, those signals were not considered as normal or regular behavior. The One Class-Support Vector Machine (OC-SVM) [45] classification method was applied as a validation of the clustering method mentioned above. This method generated a hyperplane where the normal behavior was found and separated those abnormal values. Validation was obtained successfully. Finally, with the selected regular series, machine learning techniques were applied to estimate the RUL.  
Figure 3: One time series spindle load before outlier removal.