# An Intelligent Condition Monitoring Approach for
## 4 Application and Results
### Results and Discussions
#### 4.2.2 HMM-ANN Modeling and Fault Detection Results  
In this study, 60% of the samples in each state were randomly chosen as training sets, while the remaining 40% were put aside for testing. The numbers of samples of each sample sets and state category are shown in Table 4.  
The tool wear process is continuous and irreversible, that is, the latter state can not transition back to the previous state. Therefore, the left-right HMM (which permit only left to right transitions) with good effect and fast speed was chosen. The number of states was set to be \(N=4\). Since the initial state was \"normal\", the initial state distribution was set to be \(\pi^{(0)}=[1,0,0,0]\). In addition, the initial state-transition probability matrix was set evenly to be  
\[A^{(0)}=\left[\begin{array}{cccc}0.5&0.5&0&0\\ 0&0.5&0.5&0\\ 0&0&0.5&0.5\\ 0&0&0&1\end{array}\right].\]  
The initial shape of the chosen HMM are shown in Figure 16.  
\begin{table}
\begin{tabular}{l c c c c c} \hline \hline
**Sample Sets** & **Normal** & **Fault 2** & **Fault 3** & **Fault 4** & **Total** \\ \hline Training & 27 & 24 & 30 & 21 & 102 \\ Testing & 18 & 16 & 20 & 14 & 68 \\ \hline \hline \end{tabular}
\end{table}
Table 4: The numbers of samples of each sample sets and state category.  
Figure 16: The initial shape of the chosen HMM.  
Figure 15: Comparison of average energy of each frequency band for different health states. (**a**) band 1; (**b**) band 2; (**c**) band 3; (**d**) band 4;(**e**) band 5; (**f**) band 6; (**g**) band 7; (**h**) band 8.  
In accordance with the general practice, purelin (linear activation function) was used for the output layer of ANN. Logsig (sigmoid function) is very similar to tansig (hyperbolic tangent function function) [42]. However, tansig is considered to be better for its range is normalized from \(-1\) to \(1\) while logsig is vertically translated to normalize from \(0\) to \(1\). Thus, tansig was chosen as the activation function of the hidden layer. According to the activation function, the initial weights should be randomly selected between \((-1,1)\). In this study, the initial weights and thresholds were randomly generated by the newff function in Matlab's neural network toolbox. The learning rate was set to \(0.01\), the momentum factor to \(0.9\), and the maximum epochs to \(300\). The learning function chose learngdm (gradient descent with momentum weight and bias learning function), and the performance function chose mse (mean squared error performance function). For eliminating some disadvantages of the gradient-descent method, such as the slow training speed, the traingdx (gradient descent with adaptive learning rate), trainrp (resilient backpropagation), trainlm (Levenberg-Marquardt), and trainscg (scaled conjugate gradient) algorithms were selected as candidate algorithms for network training. To select the optimal parameter setting of ANN, more than twenty various parameter settings were tested, partly shown in Table 5. The table indicates that a network with ten neurons in the hidden layer proves to be an optimal ANN, and the trainlm (Levenberg-Marquardt) proves to be the best training function.  
The extracted energy feature vectors of the training samples (known state categories) were fed to the HMM layer. Then, some HMMs were obtained by learning the samples. The goal for the ANN training was set to \(10^{-4}\). The input/target vector pairs (constructed by the method mentioned above) were fed to the ANN layer. After the training converged, the ANN model was obtained.  
The extracted energy feature vectors of the testing samples were fed to the trained hybrid HMM-ANN model. The predicted values are shown in Table 6.  
As seen in Table 6, 68 samples including normal and faulty health states were used in the prediction, and \(91.18\%\) samples (a total of 62) were predicted correctly. Especially for the samples of fault 4 (damaged tool), the accuracy rate reached \(100\%\).