# Dwell Time Estimation of Import Containers as an Ordinal Regression Problem
## 3 Materials and Methods
### Attribute Extraction, Construction, Evaluation, and Selection
 & **Attribute** & **Domain** & **Type** \\ \hline
1 & Type & Type & \(\{20,40\}\) & Nominal \\ \hline
2 & Client & Client & Categorical & Nominal \\ \hline
3 & Destination & Destination & Categorical & Nominal \\ \hline
4 & Products & Product & Categorical & Nominal \\ \hline \multirow{3}{*}{5} & Date of the arrival to the country & \multirow{3}{*}{Days\_in\_country} & \multirow{3}{*}{\(x\in\mathbb{Z}^{*}\)} & \multirow{3}{*}{Numeric} \\ \cline{2-2} \cline{4-4}  & Date of the arrival to the yard & & & \\ \hline
6 & \multirow{3}{*}{
\begin{tabular}{c} \(\text{\small{\small{\small{\small{\small{\small{\small{\small{\small{\small{ \small{\small{\small{\small{\small{\small{\small{\small{ \small{ {    { }}}}} {{}_{{}_{{}_{}_{{}}}}}}}{{{{{{{{}}}{{{{}}{{{}}{{{}}{{{}}{{}{{}}{{}}{{{}}{{}}{{}}{{}}{{}}{{}}{{}}{{}{}{}{}{{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{{}{}{}{}{}{}{{} {}{}{}{}  
departure date. Nevertheless, we have explored the relevance of having an attribute called \"Predicted_dwell_time\" \((\tau)\) computed with the CPU burst time formula [32]. To compute each \((\tau_{i})\), we must group similar containers because the CPU burst time formula assumes that CPU tasks are similar. Thus, we have included another attribute called \"Cluster\" computed with the algorithm KMeans and the validation index VIC [33]. We have sorted containers into each cluster according to their arrival date to the country. Then, we have computed each \(\tau_{i}\) for similar containers. \[\tau_{i+1}=\alpha t_{i}+(1-\alpha)\tau_{i} \tag{1}\]  
The class attribute in our datasets is \"Dwell_time\". Such class attribute represents the number of days that a container stays in the yard, i.e., the number of days between the arrival and departure dates. Thus, the inferred dwell time of a container in the yard allows us to approximate its departure date and reduce the reshuffles during the unloading operations. Histograms in Figures 2 and 3 plot the distribution of the actual dwell time of the containers in our datasets. These histograms depict a class imbalance in our datasets. According to a standard measure of the class imbalance [34], we have measured the imbalance ratio in \(\frac{1}{350}\) and \(\frac{1}{449}\), respectively. Consequently, we have employed algorithms and evaluation metrics suitable for datasets with class imbalance. Figure 2: Histogram of the containers’ dwell time in the full Dataset1, i.e., both Dataset1_T&V and Dataset1_Test. Attribute Evaluation and Selection  
We have evaluated the proposed attributes based on two criteria, the correlation between each attribute and the class attribute \"Dwell_time\" and the correlation among all the attributes [35], and the information gain (\(G\)) of each attribute concerning the \"Dwell_time\" (see Equation (2)). Such an information gain is based on entropy (\(H\)) (see Equation (3)). We have employed the implementations in the platform WEKA version 3.8.3. \[G(Dwell\_time,att_{i})=H(Dwell\_time)-H(Dwell\_time|att_{i}) \tag{2}\]  
\[H(Dwell\_time)=-\sum_{x\in Dwell\_time}(p(x)log_{2}p(x)) \tag{3}\]  
With this experimental configuration and using the Dataset1_T&V, we have obtained as relevant attributes \"Days_in_country\", \"Arrival_week_day\", \"Arrival_month_day\", \"Destination\", \"Product\", and \"Predicted_dwell_time\". Similarly, but using the Dataset2_T&V, we obtained as relevant attributes \"Arrival_week_day\", \"Destination\", and \"Predicted_dwell_time\". We emphasize that the attribute \"Product\" is excluded in this dataset. As a result, we have selected a subset of attributes with \"Days_in_country\", \"Arrival_week_day\", \"Arrival_month_day\", \"Destination\", \"Product\" (first dataset only), and \"Predicted_dwell_time\". A brief analysis of the selected attributes sheds light on their worth for estimating the dwell time, justifying the results of the evaluation algorithms.