# Prediction of Truck Fuel Consumption Based on Crossformer-LSTM Characteristic Distillation
## 4 Data Source and Preprocessing
### Data Preprocessing
#### 4.2.3 Feature Selection  
The purpose of feature selection is to improve model performance and efficiency. The original dataset might contain unnecessary or unrelated features that do not contribute to model training and prediction but increase computational burden and model complexity. By selecting features that significantly impact the target variable from the original feature set, the number of features can be reduced, simplifying the model and improving training and prediction speed.  
The feature importance analysis results from the XGBoost model are shown in Figure 3. According to this analysis, cruise time is the most important feature with a contribution rate of 29.25%, followed by braking count. Considering the relationship between the number of features and the model Mean Squared Error (MSE), as shown in Figure 3, it is observed that  
Figure 2: Box diagram of some feature samples. (**a**) represents the box plot before processing; (**b**) represents the box plot after processing.  
the MSE remains unchanged when the number of features exceeds 7. Therefore, we select the seven features with the highest contribution for the subsequent prediction model input: cruise time, braking count, average speed, downhill, uphill, RPM, and average altitude.  
In addition, to validate the robustness of the selected features, we conducted a feature selection experiment based on SHAP values. The results are shown in Figure 4. The left chart presents a bar plot based on feature importance analysis, with features ordered by their importance scores from high to low. The feature names are listed on the vertical axis, and the horizontal axis represents the importance scores, providing a clear visualization of the contribution of each feature to the target variable. The right chart displays the feature contribution distribution based on SHAP values, illustrating the positive and negative impacts of each feature on the prediction results. Each row corresponds to a feature, with the horizontal axis representing the magnitude of the SHAP values. The color differentiates between positive and negative contributions (red for positive, blue for negative), and the density and position of the points reflect the relationship between the feature values and the model output.  
Compared with the feature importance analysis based on XGBoost, although there are some differences in the ranking of features, the top seven features are consistent. These include cruising time, braking count, average speed, downhill, uphill, rpm, and average  
Figure 4: Visualization diagram of feature importance and contribution distribution based on SHAP. (**a**) represents the feature importance obtained using the SHAP method; (**b**) visualizes the impact of each sample on fuel consumption.  
Figure 3: The results of XGBoost. (**a**) Feature Importance plot; (**b**) Mean Squared Error vs. Number of Features plot.  
altitude. The heatmap results shown in Figure 5 further demonstrate that the selected features are strongly correlated with fuel consumption, confirming the importance of these features. This suggests that the XGBoost feature selection method is reliable, and the selected features exhibit strong robustness and consistency, making them important variables for input into subsequent models.