# Replicating File Segments between Multi-Cloud Nodes in a Smart City: A Machine Learning Approach
## 7 Simulation and Results
The outcome of the training process is summarised as follows:  
Table 1.6 Requestcost when replicating to \(c_{5}\) vs replicating to \(c_{4}\). \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline
**Processor** & **Memory Size** & **Memory Usage** & **Task Size** & **Disk Size** & **Disk Usage** & **Segment Size** & **Duration** \\ \hline
2 & 21 & 1 & 15 & 38 & 31 & 1 & 3.43 \\ \hline
2 & 27 & 4 & 18 & 40 & 28 & 9 & 9.57 \\ \hline
3 & 28 & 9 & 9 & 32 & 2 & 16 & 6  
Table 4 shows the outcome of the training process. The model with the learned coefficients can be presented as follows:  
Table 1.7  
It is noteworthy that the first independent variable in Table 3 is denoted as \(X_{1}\), which corresponds to the Processor column. The remaining independent variables continue in the same sequence until column \(X_{7}\), which represents the \"segment size\" variable. Furthermore, the dependent variable \"duration\" is denoted by \(\mathbb{Y}\) and is located in the last column of Table 1.8 Once the time is predicted, the process will need to be executed in certain node, the total cost is predicted to be communication cost and processing cost. Communication cost is already known as mentioned before and processing cost is calculated using Equation (54). The node with the lowest cost is the node that will be chosen for replication and task execution. The model built by machine learning helps choosing the optimal candidate for file segment replication based on history data. The cost that is calculated by regression is the presented by \(\pi\) in Equation (51). _Performance Comparison between Using ML and Picking a Random Eerver_  
In this subsection, a comparison is conducted between the performance of the system when utilising machine learning and when selecting a server randomly. Table 5 presents various configurations to choose from, with values that are interpreted similarly to the explanation provided above. The experiment focuses on a process that has a burst of 18 and uses a segment with a size of 5. To predict the duration required to execute a task with these specifications, Equation (54) is utilised. The resulting predicted costs of each server are demonstrated in Table 1.9  
As depicted in Figure 11, server 2 offers the shortest duration to execute a task with a burst of 18 and access a file segment of 5. Without utilising machine learning, a random selection of servers would have been made, possibly resulting in a server such as server 12 being chosen. However, executing the same task on server 12 would take almost 4.5 times the duration required on server 2. The error in server selection is demonstrated in Figure 4.0 In this context, the error of server \(s\) is defined as the difference between the duration required to execute a task on server \(s\) and the minimum possible duration achievable with the available servers. As server 2 provides the shortest duration to execute the given task, its error is zero. \begin{table}
\begin{tabular}{l c} \hline \hline
**Criteria** & **Value** \\ \hline Training set Length in records & 37,325 \\ \hline Testing set Length in records & 37,000 \\ \hline intercept & 7.24 \\ \hline mean squared error & 0.98 \\ \hline mean absolute error & 0.62 \\ \hline r2 score & 0.94 \\ \hline explained variance & 0.94 \\ \hline maximum error & 2.12 \\ \hline mean absolute percentage error & 0.07 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Training process outcome. Figure 11: Delays when using different servers. \begin{table}
\begin{tabular}{c c c c c c} \hline
**Server** & **Processor** & **Memory Size** & **Memory Usage** & **Disk Size** & **Disk Usage** \\ \hline  
\end{tabular}
\end{table} 
Table 5: Different Server configurations.