NC Machine Tools Fault Diagnosis Based on Kernel PCA and 𝑘 -Nearest Neighbor Using Vibration Signals

. This paper focuses on the fault diagnosis for NC machine tools and puts forward a fault diagnosis method based on kernel principal component analysis (KPCA) and 𝑘 -nearest neighbor ( 𝑘 NN). A data-dependent KPCA based on covariance matrix of sample data is designed to overcome the subjectivity in parameter selection of kernel function and is used to transform original high-dimensional data into low-dimensional manifold feature space with the intrinsic dimensionality. The 𝑘 NN method is modified to adapt the fault diagnosis of tools that can determine thresholds of multifault classes and is applied to detect potential faults. An experimental analysis in NC milling machine tools is developed; the testing result shows that the proposed method is outperforming compared to the other two methods in tool fault diagnosis.


Introduction
Numerical control (NC) machines are some of the most common classes of machining equipment and play important roles in industry relying on their high automation and stability.However, NC machines generally are subject to failures by inner flimsy tools in practice, which may decrease machinery service performance such as the manufacturing quality and operation safety.Therefore, the demand to fault diagnosis for NC machine tools accurately and reliably has attracted considerable interests.However, it is a challenge to develop and adopt effective signal processing techniques that can discover the crucial damage information from responsive signals.
Tool's damage, such as wear and gap, will occur on the tool's face contacting with the chip or on the flank due to the friction between the tool and the workpiece material.A commonly used effective method is analyzing signals gathered by sensors to reveal fault features with the help of effective signal processing techniques.Traditional signal processing techniques in the fault diagnosis include time-domain analysis [1], frequency-domain analysis [2], time-frequency analysis [3], and wavelet analysis [4].Wavelet analysis method can be viewed as an extension of the conventional spectral technique by an adjustable window size and adds a scale variable through a wavelet basis function with the inner product transform.So far, wavelet analysis has been widely used in machinery fault diagnosis, such as rotor [5], bearing [6], and gear [7].
However, how to choose a suitable wavelet basis function to match the machine signal structure remains an open issue despite many current alternative types.There is still a lack of generally accepted effective methods to solve the issue [8].Although some authors provided multiwavelet transform for fault diagnosis [9,10], these methods also determined the wavelet basis functions previously.In this paper, for overcoming deficiencies of above methods, a fault diagnosis method based on kernel principal component analysis (KPCA) and -nearest neighbor (NN) is put forward.KPCA is used to obtain independent local relevance in parameters.Firstly, the original data set transformed high-dimensional data into low-dimensional manifold feature space with the intrinsic dimensionality by KPCA, and the kernel function of KPCA is constructed with covariance matrix of sample data to avoid the subjectivity of choosing kernel function.The NN technique is applied to low-dimensional manifold feature space to detect potential faults.

Statistical Feature Parameters in Time-Frequency Domain with Tool Vibration Signal
In the manufacturing process, tool vibration is caused by a variety of factors that are main reasons for tool damages, such as cutting force, built up edge, material inhomogeneity, and ambient conditions.Hence, using the vibration signals to identify tool's damage is reasonable [11,12].Both amplitude and distribution of the vibration signals change along with tools' state from sharp to worn.Previous studies [11][12][13] have shown that some time and frequency domain features can indicate tool's damage.Although these mentioned features are indicative of tool's fault from different aspects, they have different importance.In addition, considering that the dimensions of these parameters are different, this paper employs dimensionless feature parameters to analysis.According to previous literatures [14] and our experimental studies, eight impressible dimensionless statistical feature parameters in time and frequency domains are chosen.Brief mathematical descriptions of these features are shown in Table 1.

Data-Dependent Kernel Principal
Component Analysis (KPCA)  [15] has been proposed to tackle the nonlinear problems in recent years.As a nonlinear form of PCA, KPCA can efficiently compute principal components in a highdimensional feature space by the use of integral operators and nonlinear kernel functions [16].
Let  × = (  ,  2 , . . .,   ) ≜ ( 1 ,  2 , . . .,   )  , (  ∈   ,   ∈   ) be the  training samples for KPCA learning.The basic idea of KPCA is first to define a nonlinear map :   → (  ) ∈  ℎ , ( = 1, . . ., ) which represents a high-dimensional feature space  and then to apply PCA to the data in space .However, it is difficult to do so directly because the dimension of the feature space  can be arbitrarily large or even infinite.In implementation, the implicit feature vector in  does not need to be computed explicitly, while it is just done by computing the inner product of two vectors in  with a kernel function.
The mapping of   is simply noted as (  ) =   .Principal components may be extracted by solving the eigenvalue equation of the sample covariance   : ] =   ].By defining the kernel matrix  of dimension  ×  such that Here, (  ,   ) is the calculation of the inner product of two vectors in  with a kernel function.The eigenvalue problem may be put in the form  = , where  identifies the eigenvector  after normalization.Centralize  by Here, matrix The eigenvectors identified in the feature space  can be considered as kernel principal components (KPCs) which characterize the dynamical system.Note that, since the number of eigenvectors (i.e., nonlinear PCs) is the same as the number of samples, it is higher than the number of (linear) PCs given by PCA.The KPCA method is termed "nonlinear" since the feature mapping in the space  is achieved by a nonlinear function.

Data-Dependent Kernel
Function.For a given data set, the key step is to select a corresponding optimal kernel function in order to obtain the optimal nonlinear feature transformation.There are several kernel functions can be chosen, such as Gaussian, Quadratic, Radial basis function, and polynomial.It is worth noting that the above kernel functions give different results if inappropriate parameters are chosen.However the selection of parameters in these kernel functions is arbitrary and does not have theoretical rules for reference.Since the geometric structure of data in the kernel feature space  is determined by the kernel function, it is desirable to choose the target kernel function to be datadependent.
In this paper, a data-dependent kernel based on the Gaussian kernel is designed.The Gaussian kernel function is where  is a measure of the data spread, and it implicitly assumes the same variance for each entry of the sample vector (i.e., the data is isotropic), which cannot be satisfied in many practice situations.We consider the generalized Gaussian kernel: where  is a transformation matrix.In cases where certain input transformations are known to leave function values unchanged, the use of  can also allow such invariance to be incorporated into the kernel function.
Where   is a signal series for  = 1, 2, . .., ,  is the number of data points Frequency Stabilization ratio Where   is the frequency signal with   by Fast Fourier Transform (FFT) and   is the power spectrum of   A choice for  is the  ×  covariance matrix: where  is the data vector and   is the corresponding mean vector.By assuming that the entries of the sample vector are independent, it can be simplified by dropping the offdiagonal elements as Here, diag(⋅) extracts the diagonal elements of covariance matrix , which are then used to construct a diagonal matrix by diag(⋅), and the obtained kernel by this matrix  is called independent DDK [17].While (3) implicitly assumes all sample vectors have the same variance, this is not necessary for the generalized Gaussian kernel.And if all sample vectors have the same variance  2 , then  =  2  and the generalized Gaussian kernel (4) will reduce to the conventional Gaussian kernel (3).Using the kernel function (4) with covariance matrix of sample data, the local geometric structure of data can remain in the kernel feature space .(3) Reduce dimension of  by KPCA described in Section 3. In the operation of KPCA, take (4) as the kernel function and the covariance matrix of  as the matrix  to transform  into new data   .

Algorithm of
(4) Compute the 8 × 8 kernel matrix  and centralize  to   using (2).Solve the eigenvalue problem of   , obtain the eigenvalues   and eigenvectors V  of   .Set Λ as the eigenvalue list sort by decreasing order, choose the number of kernel principal components  with the principle of the minimum value that the cumulative contribution rate is above 75% [18,19].

Multiclasses Fault Diagnosis 𝑘-Nearest Neighbor
The NN method is the simplest, yet most useful approach to general pattern classification, and has been widely applied in pattern classification.Its principle is based on an intuitive concept that data points of the same class should be closer in the feature space.Specifically, for a given unlabeled sample, NN finds the -nearest labeled samples in the training data set and assigns to the class that appears most frequently within the -subset (i.e., -nearest neighbors).NN's error rate has been proven to be asymptotically at most twice that of the Bayesian error rate [20].NN has been used for image clustering [21] and cardiac arrhythmia diagnosis [22], and so forth, but few published researches can be found in machine fault detection.In this paper, the NN classifier is used to evaluate the reduced feature vectors by KPCA for avoiding relatively local relevance between parameters and reducing computation complexity.
He and Wang provided a fault detection method using the -nearest neighbor method for semiconductor manufacturing processes, named FD-NN [23].It is based on the idea that the trajectory of a normal sample is similar to the trajectories of normal samples in the training data, and the trajectory of a fault sample must exhibit some deviation from the trajectories of normal training samples.However, FD-NN just determines two classes (normal and abnormal) which cannot be applied directly in NC machine tools, because they have several fault classes (normal, wear, gap, etc.) that we want to determine.In this paper, a multiclasses fault diagnosis NN method (MFD-NN) is proposed based on FD-NN.
The proposed MFD-NN method consists of three steps for model training.
(1) For the th fault class  () in training data, finding  nearest neighbors for each sample  ()  in the same class,  ()   denotes the th sample in the th fault class.(2) Calculate the NN squared distance for each sample: ( ()  ) = √(1/) ∑  =1 ( ()  ) 2 , where  ()  denotes squared Euclidean distance from sample  ()   to its th nearest neighbor in the th fault class.
(3) Determine the corresponding control limit  ()   of the th fault class  () .The threshold  ()   with a significance level  can be determined by an assumption that ( ()  ) 2 following a noncentral  2 distribution, which can be estimated using the Matlab function chilimit in the PLS Toolbox.
The choice of  is usually uncritical [23].In general, the value of  is greater and the effect of noise is fewer, but the boundary between normal and faults is less distinct.The value of  can be set to be a modest number, such as 5, 7, and 10, based on the sample size.

Fault Diagnosis Approach for NC Machine Tools Based on KPCA and MFD-𝑘NN
The fault diagnosis approach for NC machine tools in this paper includes two phases.The first phase focuses on model training, reducing dimension of feature parameters by datadependent KPCA, and determining thresholds of different fault classes using MFD-NN method.The second phase is fault detection for unknown working tools.The specific procedure is constructed through the following main steps as shown in Figure 1.

Model Training
Step Step 2. For the normal class (all tools are normal), calculate the average   and standard deviation   of feature vectors, and extract nonlinear features using the data-dependent KPCA algorithm provided in Section 3, obtain the kernel principal components , and load matrix .
Step Step 4. For every fault class  () , determine the corresponding control limit  ()  using the MFD-NN method proposed in Section 4.

Fault Detection
Step 5. Collect continuous  vibration time-domain signals data  of NC machine under operating condition periodically while the state of tools is unknown and to identify, transform signals data of  to frequency-domain signals by FFT.
Step 7. Identify ()'s  nearest neighbors for each fault class  () in the training data set.
Step 8. Calculate ()'s NN squared distance  () Step 9. Calculate  ()  =  ()  / ()  , and compare  ()  with the number 1, if  ()   ≤ 1,  can be considered as a sample of the th fault class.Otherwise, it is not belong to the th fault class.
Step 10.Three results could possibly be obtained by Step 9.One result is that  belongs to a single class; it can be determined that  belongs to the corresponding class distinctly.The second result is that  does not belong to any known class, in other words,  ()  > 1 for all .In this case, they have to stop working and check tools for a possible unknown damage, handle it, and update the diagnosis model.And x and D (i) x r (i) x the last result is that  belongs to several classes.This situation could happen despite very small probability.In this case, calculate the confidence level cl () of  ()  using the Matlab function chilimit with scaling value and degrees of freedom calculated in Step 4.  belongs to the class :  = max{ | cl () × (1 −  ()  )}.

Experiment Design
The FV-2215 horizontal Longmen machining center (see Figure 2) is used for the experimental test, in which characteristics are illustrated in Table 2.The cutting tools used in this test are carbide tools #RPMW1003# in a face milling cutter #EMR 5R160-40-8T# with four teeth, its shape and different tool state are shown in Figure 3.The experimental setup for the in-process detection of tool fault is illustrated in Figure 4.The tool vibration signals are monitored by a uniaxial accelerometer (PCB352C22) which was placed at the tool rest in the direction perpendicular to tool face, and sent to a data acquisition instrument (ECON Avant (MI-7016)) and a portable computer.Tool states in this experiment are alternatively three situations: normal, single tool wear, and single tool gap, and tool gap is cut with approximately 4 mm depth using electrodischarge machining.Aluminum alloy samples #7075-T351# of size (150 mm, 100 mm, 500 mm) are fixed on the machining center.In this experiment, cutting speed and depth are 500 rpm and 2 mm respectively.

Result and Discussion
In this experiment, three tool fault classes were measured including (1) all tools normal ( 1 ), (2) single tool wear ( 2 ),   1) and dimensionality reduction by KPCA, and determine the control limit of three fault classes by the MFD-NN method.First in all, 40 group vibration signals in class ( 1 ) (all tools are normal) are employed to reduce dimension by data-dependent KPCA.The cumulative eigen contribution rate with the first three eigenvalues is 94.3%, which is above the down limit CPV (= 75%).Hence the number of kernel principal components  = 3, and kernel principal components  (1) and the load matrix  are obtained in KPCA.Then, the other two classes' vibration signals are standardized by the average and the standard deviation of the normal class signals, and transformed into kernel principal components  (2) and  (3) which are multiplied by the load matrix .
For every fault class   ( = 1, 2, 3), determine the corresponding control limit  ()   using the MFD-NN method proposed in which the value of  is set to be 5.Take  1 as an example, find  nearest neighbors for each sample  (1)   in the  1 class, and calculate the NN squared distance for each sample  (1)   : where  (1)   and  (1)   denote the vector of the th sample and its th nearest neighbor.
The threshold  (1)   ( = 0.01) is calculated using the chilimit function in the Matlab PLS Toolbox.
The values of threshold  () 0.01 of three fault classes are shown in Table 3.
For validating the effectiveness of this proposed approach, the remaining 10 times vibration signals in each fault class are used as testing set.Firstly, calculate the testing signals' time-frequency statistical parameters (shown in Table 1), and then these statistical parameters where  (1)   and  (1)   denote the vector of the th testing data and its th nearest neighbor.
Finally, the value of  ()  = ( ()  )/ () 0.01 is compared with 1, the result is shown in Figure 6. Figure 6(a) is the testing result with  1 (all tools normal) training set, all points of  1 testing set located below the threshold and the testing data of other two classes are above the threshold.Figure 6(b) is the testing result with  2 (single tool wear) training set; the second data of  2 testing set is above the threshold which should be below it, so this point is not determined to  2 .Figure 6(c) is the testing result with  3 (single tool gap) training set, the second data of  2 testing set is below the threshold which should be above it, so this point is determined to  3 .In brief, there is one fault detection error by the proposed method.
PCA-MFD-NN method and standard KPCA-MFD-NN method with the same vibration signals are used for comparison, the standard KPCA take the conventional Gaussian kernel (3) as the kernel function.Despite the cumulative eigen contribution rate with the first three values by PCA and standard KPCA being 77.19% and 88.35% which are above the down limit CPV, they are both less than that value of the proposed method.The testing results with PCA-based method are shown in Figure 7.It can be observed that ten points are judged erroneously in Figure 7

Conclusion
The present study proposes a fault detection approach to NC machine tools, which is based on data-dependent kernel principal component analysis (DKPCA) and multiclasses fault diagnosis -nearest neighbor (MFD-NN).Firstly, the original data set are transformed high dimensional data into Data-Dependent KPCA.The description of feature extraction process of NC tools with data-dependent KPCA is as follows.(1) Gain  groups vibration time-domain signals data of NC machine, and transform every group data to frequency-domain signals by FFT.(2) Calculate eight feature parameters  1 - 8 of each group, respectively, to compose observed data set  = { V } ×8 , define the average and standard deviation of column vectors as   = {  } 1×8 ,   = {  } 1×8 , and normalize data set .

Figure 1 :
Figure 1: Sketch of fault diagnosis process for NC machine tools based on KPCA and MFD-NN.

Figure 3 :Figure 4 :
Figure 3: Samples of milling cutter shape and different tools.
are standardized by the average and the standard deviation of the normal class signals in the training phase and transformed into kernel principal components multiplied by the load matrix .Sequentially, find  (= 5) nearest neighbors for each testing data   by calculating its distance with training data, Frequency-domain waveform with single tool wear

Figure 5 :
Figure 5: Time-frequency domain waveform sample of normal and single tool wear classes.
, one point of  1 class and one point of  3 class in training set are excluded from their class, and in the aspect of testing set, two points of  1 class are determined to  2 class, three points of  2 class and one point of  3 class are determined to  1 class, and two points of  3 class are determined to  2 class.The testing results with standard KPCA-based method are shown in Figure 8.It can be observed that five points are judged erroneously in Figure 8, one point of  3 class in training set is excluded from its class, and in the aspect of testing set, two points of  2 class are determined to  1 class, two points of  3 class are determined to  2 class.It is clear that the proposed method is outperforming than the PCA-MFD-NN and standard KPCA-MFD-NN methods in tool fault diagnosis.
1. Gain vibration time-domain signals of NC machine in several fault classes  () , such as all tools normal, single tool wear, and single tool gap.Then divide signals of each fault class into  groups which include continuous  signals data, respectively; transform every group data to frequencydomain signals by FFT.

Table 3 :
The values of threshold  () 0.01 of three fault classes.