## 3 Preprocessing Methods
### Density-Based Outlier Analysis of Daily Load Profiles  
For evaluating the irregularity in daily load profiles, we implemented a different version of well-known density-based clustering method DBSCAN [23]. Some advantages of the DBSCAN algorithm compared to their counterparts are that it does not need to a predefined cluster number and includes outliers in the dataset. Moreover, the repeated consumption behaviors of customers form the main clusters, which makes the DBSCAN an ideal clustering technique fordetermining the daily consumption profiles that are not included in these clusters.  
Therefore, the DBSCAN algorithm is well-suited for applications of extraction such as frequent patterns [23]. The algorithm requires three predefined parameters such as distance metric (_Euclidean_, _Mahalanobis_, _Minkowski_, _etc._), the minimum number of object in a cluster \((minpts)\), and the distance \((epsilon)\) values. The clustering results of the DBSCAN algorithm vary according to different \(minpts\) and \(epsilon\) values. An additional optimization process is required for the solution to this problem. In this study, a DBSCAN version based on binary differential evolution (BDE) algorithm, proposed in [22] is preferred.  
The algorithm BDE-DBSCAN uses binary coding for a \((minpts)\) population using a bit string. The second parameter \((epsilon)\) is determined in both an analytical and an iterative way in the optimization process. In the original study, the \(purity\) metric is determined for performance comparison on different data sets. The cost function \((purity)\) needs to have both the input values and labels. Different from publicly available data sets, which possess both information, daily load profiles do not have predefined labels and this situation necessitates deciding on an alternative cost function at the stage of optimization. In this study, after extensive research, the root mean square standard deviation (RMSSTD) index is preferred as the cost function due to its simplicity and easy interpretation. Another modification in the proposed model is to use the RMSSTD index in an innovative way on both 2-D and N-dimension together to decrease the results of cost function. This adaptation is listed in lines 5 and 6 of the proposed Algorithm 1.  
For the internal clustering validation metric, the root mean square standard deviation (RMSSTD) index is given in (4) [24].  
\[\text{RMSSTD}=\sqrt{\frac{\sum_{i}\sum_{x\in C_{i}}\left\|x-c_{i}\right\|^{2} }{N\sum_{i}(n_{i}-1)}} \tag{4}\]  
where \(x\) represents a daily load profile (\(\|x_{i}\|=\sqrt{x_{i}^{T}\cdot x_{i}}\)), and \(C_{i}\) and \(c_{i}\) represent the \(i\)th cluster and its center, respectively. \(N\) represents time resolution [24; 48; 96], as shown in Figure 1, and \(n_{i}\) is the number of objects in \(C_{i}\).  
The RMSSTD index evaluates the homogeneity of the resulting clusters in the optimization process [25]. Considering the \(i\)th customer's resized data set after data cleansing, as illustrated in Figure 1, \(X_{[K,N]}^{(i)}=\left\{x_{(1,N)},x_{(2,N)},x_{(3,N)},\ldots,x_{(K,N)}\right\}\) represents a data set in n-dimensional space, and \(K\) and \(N\) represent the number of available daily load profiles and time resolutions (24; 48; 96) of the related data set, respectively. After cluster label assignment, the data set \(X_{[K,N]}\) is split into subsets based on its unique cluster number (\(C=\{C_{1},C_{2},...,C_{i}\}\)) and then an average daily load profile, standard deviation, and sum of squares within cluster are calculated for each distinct subset. Lastly, a summation of mean squares for each subset is determined as in (4) and is obtained as a root-mean-squared (RMS) value. Additionally, in this study, the daily load profiles for which cluster label are assigned as (\(-1\)) are not included at the stage of RMSSTD index calculation, since the outliers are labeled as a default value of (\(-1\)) in the DBSCAN algorithm.