## 4 Case Study
### Results and Discussion  
Next, the results of the RMSLE validation dataset are outlined. The results of the best models selected by the GridSearchCV for each station, are described. Figure 9 shows the results for arrivals and Figure 10 shows results for departures. From these graphs, we can see that regressors tend to have better results than the established baseline. The Random Forest Regressor and the Extra Tree Regressor have the best results.  
Figure 10: RMSLE provided by each algorithm for each station in the departures data.  
Figure 9: Root Mean Square Logarithmic Error (RMSLE) provided by each algorithm for each station in the arrivals data.  
Additionally, the coefficient of determination \(R^{2}\) has been calculated for each of the algorithms, with the aim of using it to select a model that will be included in the predictor agent. The results of the coefficient of determination are shown for each of the algorithms at each of the stations, for arrivals in Figure 11 and departures in Figure 12. Graphically, that the method that performs the best with \(R^{2}\) is Random Forest Regressor, however results will be analysed to see if this difference is significant.  
In order to select the best algorithm for all the stations in the system, a statistical Mann-Whitney U test was used. First, the test was done in order to check if one of the algorithms used, functions differently to the rest. The following confirmatory data analysis was applied: \(H_{0}\) considers the median of two equal methods while \(H_{1}\) considers the median of two different methods. As we can see in Figure 13, in the case of both departure and arrival models, the Random Forest Regressor Algorithm has a median that is different to the rest, thus, it could be considered that there is a significant statistical difference. The \(p\)-value obtained for the Random Forest Regressor and Extra Tree pair, surpasses slightly the test's 0.05 significance level, thus it cannot be assumed that there is a significant statistical  
Figure 11: Coefficient of determination of models for the arrivals at each station.  
Figure 12: Coefficient of determination of models for departures from each station.  
difference. However, by calculating the median of both methods we can see that the median for Random Forest Regressor is greater in comparison to that of ExtraTreesRegressor.  
Once this test is completed, it is necessary to repeat it, in the case significant statistical differences are detected, we would proceed to determining whether the median is smaller or greater. In this case, the defined \(H_{1}\) states that the median of the classifier from the row is greater than the median of the classifier form the column. Figure 14 verifies that Random Forest Regressor has a greater median than the rest of the algorithms for all the stations.  
After seeing these results, Random Forest Regressor has been selected for inclusion in the predictor agent; it will generate models and store them to subsequently provide predictions through the WebAPI agent. In Figure 15, the sequence diagram for performing the predictions is shown. The predictor agent periodically trains and saves the model for each station in the system. Later these models are used by the WebAPI agent in order to show predictions on the web application and the API REST.  
Figure 14: Mann-Whitney U test greater for (**a**) arrivals and (**b**) departures.  
Figure 13: Mann-Whitney U test two sided for (**a**) arrivals and (**b**) departures.  
The WebAPI agent provides a web application where users can request predictions for a selected station. This agent will communicate with the weather agent, the GIS agent and the persistence agent in order to obtain the information it needs for making a prediction that was requested by a user. In the next section, the web application will be explained in detail.