# A New Method of Time-Series Event Prediction Based on Sequence Labeling
## 2 Definitions and Methods
### CX-LC Framework
#### 2.2.2 Feature Extraction  
In Section 3.1, the pattern characteristics of each subsequence set \(T_{m}^{\tau}\) have been obtained \(TProb_{m}^{\tau\ \times\ V},(m=1,2,\ \ldots,M)\), \(TProb_{m}^{\tau\ \times\ V}\in\mathcal{R}^{\tau\ \times\ V}\). It can be seen that the data dimension increases with the increase of the history length \(\tau\) and the number of states V, but in the \(\tau\ \times\ V\) features, there is information redundancy. If all the pattern features are used as the input of LSTM, it will not only greatly increase the calculation time, it will also affect the prediction effect. This paper used the XGBoost model to perform feature selection, extract important features from high-dimensional data and remove redundant features. XGBoost is a powerful machine learning algorithm for structured data. It can improve the speed and performance of calculation based on the implementation of gradient boosting decision tree (GBDT). This article uses the characteristics of its tree model as a basis for quantifying the importance of each feature [23]. In the process of building the tree model, each layer greedily selects a feature as a leaf node to maximize the gain of the entire tree after segmentation. This means that the more a feature is segmented, the more the feature will bring to the entire tree, and the greater the benefit, the more important this feature is. In the process of segmentation, the weight of each leaf node can be expressed as \(w(g_{i},h_{i})\), \(g_{i}\) and \(h_{i}\) are, respectively:  
\[g_{i}=\partial_{\hat{Y}_{i}}l\left(Y_{i},\hat{Y}_{i}\right) \tag{4}\]  
\[h_{i}=\partial_{\hat{Y}_{i}}^{2}l\left(Y_{i},\hat{Y}_{i}\right), \tag{5}\]  
where \(l\) is the loss function, used to measure the distance between the true value \(Y_{i}\) and the predicted value \(\hat{Y}_{i}\). \(g_{i}\) and \(h_{i}\) are the first derivative and the second derivative of the loss function, respectively. In order to minimize the cost of the split tree, according to the weights of all leaf nodes, consider the gain generated when each feature is used as the split point, as follows:  
\[\text{Gain}\ =\sum_{\text{left}}w+\sum_{\text{right}}w-\sum_{\text{previous}}w. \tag{6}\]  
It shows that, for each split point, its gain can be expressed as the total weight after splitting (the sum of the total weight of the left subtree of the leaf node and the total weight of the right subtree) minus the total weight of the leaf node before the split total weight. The importance measurement index is a measure to evaluate the importance of each feature in its own feature set. This paper selected the feature average gain value AverageGain (Equation (7)) as the basis for constructing the decision tree in order to accurately complete the classification task.  
\[\text{AverageGain}\ =\ \frac{\sum_{j}\ \text{Gain}\ r_{j}}{|F|}, \tag{7}\]  
where \(F_{j}\) indicates that the feature is classified into the j-th leaf node and \(F\) is the set of \(F_{j}\). The eigenvalues are sorted in descending order according to the size of the comparison AverageGain, and the first few most representative features are selected. At the same time, the XGBoost model obtained by fitting can be used to softly classify each sub-sequence set and obtain the probability value of each input under different classification results. The probability value only considers the internal information transfer of the subsequence set and can also be used as subsequence set characteristics. Therefore, the pattern feature of the filtered subsequence set \(TProb_{m}^{\tau\ \times\ V}\) is reduced to a Q-dimensional variable and there is \(TProb_{m}^{Q}\in\mathcal{R}^{Q}\).