# A Tutorial for Feature Engineering in the Prognostics and Health Management of Gears and Bearings
## 3 Feature Extraction
### Features for Gears
NA4 is obtained by dividing the fourth statistical moment of the residual signal (_res_) by the averaged variance of the residual signal over the last \(M\) revolutions, raised to the second power:  
\[NA4=\frac{\frac{1}{N}\sum_{i=1}^{N}\left(\textit{res}_{i}-\overline{\textit{ res}}\right)^{4}}{\left\{\frac{1}{M}\sum_{j=1}^{M}\left[\frac{1}{N}\sum_{k=1}^{N} \left(\textit{res}_{jk}-\overline{\textit{res}_{j}}\right)^{2}\right]\right\}^ {2}}, \tag{3}\]  
where \(N\) is the number of data points in one revolution, and \(\overline{\textit{res}}\) is the mean of _res_. NB4 is similar to NA4 except that instead of the residual signal, NB4 uses the envelope of band-pass filtered (BPF) signal centered at the GMF. The BPF is to leave the signals in the band while removing those outside. The feature was devised from the idea that a few damaged gear teeth will cause transient load fluctuations different from the normal fluctuations, which can be identified by the envelope (s) of BPF signal. NB4 is given by  
\[NB4=\frac{\frac{1}{N}\sum_{i=1}^{N}\left(s_{i}-\overline{s}\right)^{4}}{\left\{ \frac{1}{M}\sum_{j=1}^{M}\left[\frac{1}{N}\sum_{k=1}^{N}\left(s_{jk}-\overline {s_{j}}\right)^{2}\right]\right\}^{2}}. \tag{4}\]  
Regarding the envelope, more detail is given in the next section for the bearing features extraction. The third step is to obtain the difference signal by further removing the sideband frequencies of the GMF from the residual signal. From the difference signal, FM4, M6A, M8A, and energy ratio (ER)  
Figure 4: Normalized time domain features of high speed (HS) gears. are extracted. FM4 is the feature to detect the pattern changes resulting from the damage on a few gear teeth. FM4 is defined as the kurtosis of the difference signal (\(diff\)):  
\[FM4=\frac{N\sum_{i=1}^{N}\left(diff_{i}-\overline{diff}\right)^{4}}{\left(\sum_{i =1}^{N}\left(diff_{i}-\overline{diff}\right)^{2}\right)^{2}}. \tag{5}\]  
This indicates that if \(diff\) is from the normal gear, it will follow Gaussian noise so that the FM4 should be 3, whereas it will be greater than 3 if defective. M6A and M8A were developed to detect surface damage on machinery components. They are similar to FM4 except that M6A and M8A are more sensitive to peaks of the \(diff\) signal with higher power with 6 and 8, respectively:  
\[M6A=\frac{N^{2}\sum_{i=1}^{N}\left(diff_{i}-\overline{diff}\right)^{6}}{\left( \sum_{i=1}^{N}\left(diff_{i}-\overline{diff}\right)^{2}\right)^{3}}, \tag{6}\]  
\[M8A=\frac{N^{3}\sum_{i=1}^{N}\left(diff_{i}-\overline{diff}\right)^{8}}{\left( \sum_{i=1}^{N}\left(diff_{i}-\overline{diff}\right)^{2}\right)^{4}}. \tag{7}\]  
ER was proposed to define the RMS of \(diff\) signal divided by the amplitudes of the GMF and its harmonics with further addition by their respective sidebands:  
\[ER=\frac{RMS(diff)}{\sum_{i=1}^{N_{har}}\left\{P_{i}+\sum_{j=1}^{N_{ab}}\left(S _{ij}^{+}+S_{ij}^{-}\right)\right\}}. \tag{8}\]  
The Matlab function to obtain the residual and difference signal are given by _res_sig_ = _res_gear(x/s,gmf, cutoff,ord)_, and _diff_sig_ = _diff_gear (x/s,gmf.sf.cutoff,ord)_, respectively. In the functions, _cutoff_ is the bandwidth to filter out, and _ord_ is the filter order. Within each function, the removal of the frequency component for the bandwidth [_fo-cutoff, f0+cutoff_] is carried out by the Matlab built-in function (_b,a_) = _butter(ord,[f0-cutoff f0+cutoff],'stop')_, followed by _x = filter(b, a, x)_. This is also called notch filtering. Note that the cutoff is imposed to account for the inaccurate GMF, which usually occurs in practice. In the HS gear dataset, _gmf_ = 960 Hz, _cutoff_ = 2, _ord_ = 1 are used. The Matlab function to extract all the above-mentioned gear specific features is given by _[feature, feature_name] = _Gear_feat(tsa_sig, res_sig, diff_sig, gmf, sf,fs)_. Figure 5 represents the result of extracted features for the HS gear. As in Figure 4, some are good classifiers, while others such as SER and M6A are not. Methods to select useful classifiers will be explained in Section 4.