# Replicating File Segments between Multi-Cloud Nodes in a Smart City: A Machine Learning Approach
## 7 Simulation and Results
Now we show the selection of the best candidate to host the replica of \(s_{11}\) requested by \(e_{9}\). Sources without replication are \(c_{1},c_{2}\) and \(e_{7}\). Now that we know the chosen path is :  
Table 1.2  
The replication could occur to \(c_{4}\) or \(c_{5}\). Figure 8 shows the cost of replicating \(s_{11}\) to \(c_{5}\) versus replicating the whole file. The figure shows the base cost, which is the cost of moving data from source \(c_{1}\) to \(c_{5}\). It is low because it happens only once. The segment replication increases with a low slope since we only replicate what is requested by \(e_{9}\). The third line has a high slope since the whole file is being accessed every time \(e_{9}\) sends a request. Figure 9 shows the cost of replicating \(s_{11}\) to \(c_{4}\) versus replicating the whole file. The figure shows the base cost which is the cost of moving data from source \(c_{1}\) to \(c_{4}\). It is low because it happens only once, and the segment replication increases with a low slope since we only replicate what is needed by \(e_{9}\). The third line has a high slope since the whole file is being accessed every time \(e_{9}\) sends a request. Figure 10 shows the difference of replication cost between \(c_{4}\) and \(c_{5}\). The results show that the more the iterations are, the lower the cost is when replicating to \(c_{5}\). This study employs a multivariate regression model as a machine learning technique to identify the optimal replica. The approach involves calculating the cost associated with each node if it were to run the process and factoring in the total cost of replication, taking into account the size of the file's segments to be replicated. By utilising this approach, we aim to determine the optimal choice of a replica in a cost-effective manner. As a sample of the data, we provide a subset of the training data:  
Table 1.3 Minimum costs when streaming from different nodes. Table 3 showcases a small subset of the training data employed in this study. The total number of rows in the dataset was 10,000, which is considered sufficient to achieve a mean square error below our predefined minimum threshold. The first column of the table represents the processor used for a given task. The discrete values in this column represent three different types of processors, with 1 indicating the slowest and 3 indicating the fastest. The second column displays the \(log_{2}\) of the memory size in gigabytes for the task. The third column shows the percentage of memory used for the given task. The value of the used memory is displayed in \(log_{2}\) of the memory used in gigabytes. The fourth column represents the size of the task required to execute, where the numbers represent the \(log_{2}\) of the task length in gigabytes. Note that in this context, the term \"task\" refers to the entire activity required to execute and it is not related to the definition used in operating systems engineering. Furthermore, the fifth column shows the \(log_{2}\) of the disk size in gigabytes, while the sixth column displays the percentage of disk space used for the given task. The value of the used disk space is also displayed in \(log_{2}\) of the disk space used in gigabytes. Table 1.4 File segment requests when replicated in \(c_{5}\) VS. all file requests. Table 1.5 File segment requests when replicated in \(c_{4}\) VS. all file requests. The seventh column of the table represents the \(log_{2}\) of the segment size in gigabytes. Finally, the last column represents the duration in microseconds required to process the given task that accesses the given file segment. It is important to note that this is only a small sample of the complete training dataset, which was utilised to train a multivariate regression model. This model was used to determine the optimal choice of a replica, based on the cost associated with each node if it were to run the process and the total cost of replication.