# Fault Diagnosis Method Based on Time Series in Autonomous Unmanned System
## 4 Fault Diagnosis Method Using Improved Clustering Algorithm
### Time Series Feature Engineering Using the Improved Markov Chain Model  
The measurement of time series similarity is the core of clustering algorithm. The definition of time series similarity is described as follows:  
For the two given time series \(\mathbb{S}_{1},\mathbb{S}_{2}\), and given a similarity measure function \(\text{Dist}(\mathbb{S}_{1},\mathbb{S}_{2})\). If the time series \(\mathbb{S}_{1}\) and \(\mathbb{S}_{2}\) meet the following conditions:  
\[\text{Dist}(\mathbb{S}_{1},\mathbb{S}_{2})\leq\epsilon \tag{3}\]  
then, the time series \(\mathbb{S}_{1}\) and \(\mathbb{S}_{2}\) are similar, where \(\epsilon\) is the threshold of time series similarity. In the design of the time series similarity measurement method, we must consider the common characteristics of sensor data of unmanned autonomous systems. The ultimate goal of unmanned autonomous system fault diagnosis is to find out the abnormal state of the system. Through analysis, it can be found that the current state of the unmanned autonomous system is determined by the state of the previous moment, independent of other time states, and has Markov properties. Therefore, this paper proposes a similarity measurement method for time series based on Markov chain models. In Section 4.1, the symbolic representations of the original space mission time series were made through the symbolic representation of time series based on Gaussian mixture clustering, and this symbolic expression can be regarded as different states of the time series, and the process of symbols change can be considered as the state transition of the time series, this transition is determined by the current state, it has the Markov property. Therefore, we regard each time series as a Markov chain, and its state space is the symbol set after the time series is symbolized. Therefore, we designed a time series similarity measurement method based on Markov chain. The specific process is shown in Figure 2.  
Each symbolized time series \(\text{S}=\{\text{s}_{1},\text{s}_{2},\dots,\text{s}_{n}\}\) satisfies Markov property, that is:  
\[\text{P}(\text{S}_{\text{i}+1}=\text{j}|\text{S}_{0}=\text{i}_{0},\text{S}_{1} =\text{i}_{1},\dots,\text{S}_{1}=\text{i}_{1})=\text{P}(\text{S}_{\text{i}+1} =\text{j}|\text{S}_{1}=\text{i}_{1}) \tag{4}\]  
Among them, \(\text{S}_{1}\) represents the corresponding state of time series at time \(\text{l}\), and the conditional transfer probability \(\text{P}(\cdot|\cdot)\). Thus, the transition probability between states in each symbolized time series can be obtained as follows:  
\[\text{P}_{\text{i}\text{j}}=\text{P}(\text{S}_{\text{l}+1}=\text{j}|\text{S}_ {1}=\text{i}) \tag{5}\]  
The corresponding transfer probability matrix of each symbolized time series can be obtained, that is:  
\[\text{P}=\left(\text{P}_{\text{i}\text{j}}\right) \tag{6}\]  
where \(\sum_{\text{i}\text{j}\in\text{S}}\text{P}_{\text{i}\text{j}}=1\) and \(\text{P}_{\text{i}\text{j}}\geq 0\). Since the symbolic representation method of time series is based on Gaussian mixture, clustering gives the symbol set corresponding to the time series, and the length of the symbol set is fixed. We might set the length as \(\text{k}\), then the size of the transfer probability matrix corresponding to each time series is also fixed, that is \(\text{k}\times\text{k}\). Therefore, the method can convert the time series with variable length into the transfer probability matrix with the same size, and it also provides effective support for the similarity measure of time series. Because the transition probability matrix is a sparse matrix, the representation of triples is used to reduce the space complexity during storage. Figure 2: The flow of time series similarity measurement method is based on Markov chain.