## 4 Case Study and Applications
### Performance Evaluation of a Regression Problem Implementation  
A pre-fed neural network with a single hidden and output layer was created, the parameters of which are given in Table 2. The network was trained using the DSPSO and DAPSO variants and the original sequential PSO algorithm, after which the weights of the final network were extracted into a file of weight vectors of dimension 5224. The mean number of predictions made per hour was 7296, with the mean run times (based on five runs for each measurement) presented in Table 3. \begin{table}
\begin{tabular}{c c} \hline \hline
**Parameter** & **Value** \\ \hline Number of neurons in the input layer & 14 \\ Number of neurons in the hidden layer & 26 \\ Activation function & Identity function \\ Inertia constant W & 1.0 \\ Cognitive learning coefficient \(c_{1}\) & 0.8 \\ Social learning coefficient \(c_{2}\) & 0.2 \\ Interval of particle positions & [\(-\)1, 1] \\ Particle velocity ranges & [\(-\)0.6, 0.6] (0.6\(\times\)max position) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Parameters of the trained neural network for the EC prediction. Figure 6: Prediction with DAPSO implementation of the hourly power consumed during the month of January 2024 by a group of UGr buildings. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Particles** & **Iterations** & **PSO(s)** & **DPSO(s)** & **DAPSO(s)** & **MSE** \\ \hline
100 & 100 & 1435.370 & 1621.191 & 1167.736 & (0.870, 0.461, 0.267) \\
100 & 200 & 2776.149 & 3186.593 & 2259.875 & (0.7  
To assess the performance of the two variants of the PSO algorithm, the parameters given in Table 2 were employed. The input of the neural network is derived from the attributes in the rows of the dataset provided by the institution.These include the day, hour, and minute of the measurement, as well as the scheduled and wasted power for that day, with a 10-minute resolution. The realized implementation of the DSPSO algorithm was evaluated with a synchronous individual update of particle velocity/position, while the DAPSO algorithm with an asynchronous distributed update of the same parameters. In addition, to assess the performance of each algorithm, only one of the initial two constant parameters outlined in Table 4 was increased at a time, while the other was maintained at its original value in each trial. In this way, we were able to analyse how each algorithm responds to an increase in the complexity of a single parameter, namely the number of particles, the number of iterations and the conditions under which they are applied. Figure 7a demonstrates that, for a limited number of particles (100, 200), the distributed algorithms (DSPSO and DAPSO) exhibit a marginal improvement in performance compared to the traditional sequential PSO algorithm.This is attributed to the overhead introduced by Spark, which affects the overall measured performance. Nevertheless, when the number of particles is increased to 500 and 1000, the distributed algorithms DAPSO and DSPSO are markedly faster, achieving, on average, four and two times the speedup of the traditional PSO, respectively. Figure 7b illustrates a comparable trend to that observed in the preceding graph, as the number of iterations is increased. The execution time of DAPSO is observed to be similar to that of DSPSO for (500, 1000) iterations. This is due to the fact that the number of Spark jobs generated is primarily dependent on the number of iterations. Consequently, for a high number of iterations, the number of jobs generated is comparable for both algorithms. This differs from the observation in Figure 7a, in which the number of iterations was held constant and the number of particles increased. It can thus be concluded that both algorithms perform well regardless of the number of iterations or particles. \begin{table}
\begin{tabular}{c c} \hline \hline
**Parameter** & **Value** \\ \hline Number of PSO iterations & 100, 200, 500, 1000 \\ Number of particles & 100, 200, 500, 1000 \\ SuperRDDs & 4 \\ Batch size & 10 \\ \hline \hline \end{tabular}
\end{table}