# A Cost-Sensitive Diagnosis Method Based on the Operation and Maintenance Data of UAV
## 2 Materials and Methods
### Cost Matrix Setting Based on FMECA Information  
At present, the effort of imbalanced data classification is focused on the imbalance of data distribution, which fails to take full account of the essential differences between different classes of objects--for example, different fault modes. Considering that the training data used for the model cannot represent all conditions of UAV exhaustively, we chose the fault criticality value reflecting the essential difference of fault modes (from FMECA) to set the cost matrix, in order to avoid the overfitting issue led by data distribution.  
For the multi-class fault diagnosis, the misdiagnosis cost \(c_{ij}\) represents the classifier misdiagnoses' actual fault mode \(F_{j}\), as predicted by fault mode \(F_{i}\), which yields the misdiagnosis cost matrix, as shown in Table 1, which is similar to the confusion matrix.  
For the actual fault mode \(F_{j}\) and predicted fault mode \(F_{i}\), we defined the misdiagnose distance of fault criticality as  
\[d_{ij}=R_{i}-R_{j} \tag{2}\]  
When the actual fault mode \(F_{j}\) is more harmful than predicted fault mode \(F_{i}\), the value of \(d_{ij}\) is positive, but negative in the opposite case. Based on the misdiagnosed distance, we defined a hazard value of misdiagnosis as the following equation:  
\[h_{ij}=\begin{cases}S\cdot\frac{d_{ij}}{\sum\limits_{i}R_{i}}&d_{ij}\geq 0\\ -mS\cdot\frac{d_{ij}}{\sum\limits_{i}R_{i}}&d_{ij}<0\end{cases} \tag{3}\]  
where \(\sum\limits_{i}R_{i}\) indicates the sum of hazard values of all fault modes of the target equipment; \(S\) represents a scaling factor to improve computing convenience (in the present paper, this is represented by \(S=100\)); \(m\) represents a correction coefficient between 0 and 1, for the negative value of misdiagnose distance, showing that the cost as a result of the misdiagnosis of a more serious fault compared to a minor one would be greater than the opposite. Since there is no reference to determine the value of \(m\), we temporarily took \(m\)= 0.5 to realize the correction function and, thus, to avoid the excessive or insufficient effects.  
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline  & & \multicolumn{6}{c}{**Actual Fault Mode**} \\ \cline{3-6}  & & \(F_{1}\) & \(F_{2}\) & \(\cdots\) & \(F_{n}\) \\ \hline \multirow{2}{*}{**Predicted**} & \(F_{1}\) & \(c_{11}\) & \(c_{12}\) & \(\cdots\) & \(c_{1n}\) \\  & \(F_{2}\) & \(c_{21}\) & \(c_{22}\) & \(\cdots\) & \(c_{2n}\) \\  & \(\vdots\) & \(\vdots\) & \(\vdots\) & \(\ddots\) & \(\vdots\) \\  & \(F_{n}\) & \(c_{n1}\) & \(c_{n2}\) & \It can be intuitively found that there is a positive correlation between the misdiagnosis cost \(c_{ij}\) and the misdiagnosis hazard value \(h_{ij}\), simplifying this to a linear mapping as the following:  
\[c_{ij}=kh_{ij}+b \tag{4}\]  
In order to simplify the computing process, the factors \(k\) and \(b\) can be taken as 1 and 0, respectively.  
According to the above process, the misdiagnosis cost between a pair of fault modes based on FMECA information could be calculated and then used to build the misdiagnosis cost matrix.