## 2 Load Profiling Mathematical Background
### Clustering Algorithms  
#### 2.2.1. Partitional Clustering Algorithms  
Partitional clustering aims to find the optimal segmentation of data for a pre-defined number of clusters. Partitional algorithms base their operation on the minimization of a cost function that is a measurement of the distances between the patterns and the centroids of the clusters that they belong to. The minimization is accomplished through a series of observations. According to the load profiling related literature, K-means is the most commonly utilized algorithm. Also, the algorithm has been proposed to address clustering problems in a wide variety of fields such as colour image segmentation, speech recognition, bioinformatics, etc. [91]. The algorithm tends to minimize the within-cluster sum-of-squares function \(O_{K}\):  
\[O_{K}=\sum\limits_{n=1}^{N}\sum\limits_{k=1}^{K}I(y_{n}\in C_{k})(y_{n}-c_{k}) (y_{n}-c_{k})^{T} \tag{3}\]  
where the binary variable \(I(y_{n}\in C_{k})\) equals to 1 if the pattern \(y_{n}\in C_{k}\) and equals 0 otherwise. The following restrictions apply:  
\[ \begin{array}{l}\sum\limits_{k=1}^{K}I(y_{n}\in C_{k})=1,\quad 1\leq n\leq N \\ I(y_{n}\in C_{k})\in\{0,1\},\quad 1\leq n\leq N,\quad 1\leq k\leq K\end{array}  \tag{4}\]  
The operation of the algorithm includes the following steps:  
1. Initialization. A random selection of \(k\) patterns from set \(Y\) is held to serve as the initial centroids. 2. Clustering. For each iteration \(t=1\),..., \(T\), where \(T\) is the number of total iterations of the algorithm and \(\forall n=1,...,N\), the pattern \(y_{n}\) is distributed to cluster \(c_{k}\), where \(k\) is selected so that \(\|x_{n}^{(t)}-c_{k}^{(t)}\|=\min\limits_{1\leq l\leq k}\|x_{m}^{(t)}-c_{k}^{( l)}\|\). 3. Centroids update. A re-calculation of centroids is made according to (2). 4. Termination. The algorithm terminates either when the maximum number of iterations \(T\) is met or when the improvement of \(O_{K}\) between two subsequent iterations is lower than a pre-defined threshold \(\epsilon\), i.e., \(O_{K}(t)-O_{K}(t+1)\leq\epsilon\). The main drawback of the algorithm is its strong dependence on the selection of the initial centroids. To overcome this problem, various researchers have proposed modified versions of the algorithm. In [27,28,67], the selection of the initial \(k\)th centroid is done according to the following formula:  
\[c_{k}=a+b\frac{k-1}{K-1} \tag{5}\]  
where the coefficients \(a\) and \(b\) are selected so that \(a=\{0.10,0.11,...,0.45\}\) and \(a+b=\{0.54,0.55,...,0.90\}\). We refer to this version of the K-means as \"Modified K-means 1.\" Another initialization is proposed in [27,28,67]:  
\[c_{ki}=a_{i}+b_{i}\cdot\frac{k-1}{K-1} \tag{6}\]  
where the coefficients \(a_{i}\) and \(b_{i}\) are selected so that \(a_{i}=x_{nd}^{\min}\) and \(b_{i}=x_{nd}^{\max}\), where \(x_{nd}^{\min}\) and \(x_{nd}^{\max}\) are the minimum and maximum values of the consumer \(x_{n}\) of the element \(d=1\),...,\(D\). We refer to this version of the K-means as \"Modified K-means 2.\"  
In [69], a new method of centroid update is proposed and is referred as WFA. The WFA K-means includes the same steps with the conventional edition of the algorithm apart from two elements: (a) The calculation of the distances of Step#2 is held with a new distance metric, i.e., the WFA and(b) the centroid update involves the product of patterns with the WFA. The WFA of the \(k\)th cluster at iteration \(t\) is given by:  
\[w_{kd}^{(t)}=\exp\frac{-(x_{nd}-x_{nd,mean}^{(t)})}{2\sigma^{2}} \tag{7}\]  
where \(x_{nd,mean}^{(t)}\) is the average of patterns of element d of \(x_{n}\) of the \(k\)th cluster at iteration \(t\). The centroid update at iteration \(t=t+1\) is given by:  
\[c_{kd}^{(t+1)}=\sum_{j=1}^{d}w_{kd}^{(t)}x_{nd} \tag{8}\]  
In [70], the formula of (5) is used to address the problem of the random initialization of the WFA K-means.