# Predictive Analysis for Optimizing Port Operations
## 4 Results  
The data (\(n\) = 153,331) are split into 80% (122,664) for training and 20% (30,667) for testing. The analysis considers 24 (out of 35) features as independent variables, and the other features related to the calculation of Total Time and Delay Time at the port are removed. Seventeen are categorical variables, which are transformed using one hot encoding (low cardinality variables like Month, Type of Mooring, Geographic Region, etc.) or target encoding (high cardinality variables like Berth, Source, Destination, Port, etc.). To avoid overfitting and pick the best hyperparameters, 10-fold cross-validation (CV) is performed. Let us first look into the prediction of Total Time and Delay Time, followed by the classification of Total Time and Delay Time. Feature analysis is performed for a comprehensive understanding of the key factors influencing port operations. The experiments were performed on an 8-core M2 CPU. Table 1 shows the performance of different Machine Learning and Deep Learning approaches for Total Time prediction. The general trend observed is that tree-based methods perform better than statistical approaches on this task. This might be because of the complex nature of the data and their superiority in handling categorical variables. Surprisingly, neural network and ResNet performance is a bit underwhelming, the main reason for this is the presence of many categorical features in the data [48; 49]. The high cardinality, non-ordinal nature, and insufficient sample per category hamper the deep learning performance. Random Forest (RF) performs the best in this task, has the lowest RMSE (10.4377), and also has better values in other metrics in comparison to the rest of the methods. Performance on the test set for RF is similar, where the RMSE is 10.2577 (other metrics are also in close range). This is visible from Figure 2, where the predicted values and true values are near the identity line with an \(R^{2}\) value of 0.8287. Figure 2: R-squared plot on test data for Total Time prediction. Figure 3 shows the feature importance for the Total Time prediction, and it is observed that the Berth feature plays the most crucial role to some berths being more busy and less efficient compared to others, followed by other features like Moved Value, VL Containerized Load Weight, Type of Mooring Navigation, Source, Destination, Month, etc. Since Berths play a vital role in port operations, efficient berth management is essential for optimizing port capacity, throughput, and overall smooth operations. The SHAP analysis helps obtain deeper insights, as seen in Figure 4. It indicates that features like Berth, Type of Mooring Navigation, and Nationality have a high impact on the outcomes for the Random Forest model. The horizontal spread indicates the magnitude of the effect that a feature has on the outcome, whereas the color represents if the feature value is high or low. For example, the Berth feature (target encoded) denotes that, generally, a high value of this feature leads to a higher positive impact on the outcome. This means that it will lead to a higher Total Time value. Figures 5 and 6 show the Decision and Force plot for a particular sample with a true Total Time of 4.50 h. The base value (49.52) represents the expected value of the model's output before any features are considered. The model output is 4, which is near the truth. Features like Berth, Type of Mooring Navigation, and Source are observed to have the highest impact on obtaining the right output for this sample. Since Berth and Source are fixed features, changing the Type of Mooring Navigation for this sample might help