# Application of Machine Learning Techniques to
## 3 Methodology
### Climate Zoning
#### 3.1.4 Optimal Clustering and Climate zone Formation  
In this step, the optimal CN of stations for each season is identified. Optimal clustering validity methods must be employed for the real grouping of datasets. Comprehensive studies have been performed for the comparative analyses of the cluster validity indices. The silhouette index (\(S\)) [66], S Dbw index (\(S\) Dbw) [67] and Calinski-Harabasz index (\(CH\)) [68] have been used in this study following the recommendations on these comparative evaluations [67; 69].  
Using the average of the three values identified through the aforementioned validity indices, the optimal CN was identified. The numbering and identification of stations in each cluster were performed via the truncation of the dendrogram. The truncation (cut-off) bar is kept at the valid maximum Euclidian distance corresponding to the validated value of CN [20]. This was performed using a supervised learning algorithm in scikit-learn [53].  
The silhouette score method [66] is employed in the analysis to obtain the optimum CN. The silhouette score is the mean of the distance between clusters. In this study, the silhouette score yielded a maximum of 14 clusters for climate zoning for all seasons. The CN corresponding to the maximum silhouette score is the basis for the decision. The Silhouette score (\(S\)) is obtained as  
\[S=\frac{1}{CN}\sum_{i}\frac{1}{n_{i}}\sum_{r\in C_{i}}\frac{b(r)-a(r)}{\max[b(r ),a(r)]} \tag{1}\]  
and  
\[a(r)=\frac{1}{n_{i}-1}\sum_{s\in\overline{C_{i}}s\
eq r}d(r,s),b(r)=min_{i,j \
eq i}\left[\frac{1}{n_{j}}\sum_{y\in\overline{C_{j}}}d(r,s)\right] \tag{2}\]  
where the number of clusters is denoted by CN; \(C_{i}\) represents the \(i\)th cluster; \(n_{i}\) represents the number of objects in \(C_{i}\); \(c_{i}\) denotes the center of \(C_{i}\); and \(d(r,s)\) is the distance between r and s [66].  
S Dbw considers the inter-cluster density to calculate inter-cluster separation [67]. One of the densities of each cluster pair must be greater than the midpoint density for the cluster centers. This index is the summation of the scatter in the clusters and the density between the clusters. Previous studies have investigated the validation properties of different cluster validity indices using synthetic experimental data [70]. They conclude that S Dbw performed best concerning the aspects of noise, monotonicity, density, skewed distribution and sub-clusters. Equations (3)-(5) can be used to calculate the density between clusters, the scatter in the clusters and the S Dbw, respectively:  
\[Dens\_bw(CN)=\frac{1}{CN(CN-1)}\sum_{i=1}^{CN}\left[\sum_{j=1,i\
eq i}^{CN} \frac{\sum_{x_{i}\in C_{i}\cup C_{j}}f\big{(}x_{i},u_{ij}\big{)}}{\max\{\sum_{ x\in C_{i}}f\big{(}x,c_{i}\big{)},\sum_{x\in C_{j}}f\big{(}x,c_{j}\big{)}\}}\right] \tag{3}\]  
\[Scat(CN)=\frac{1}{CN}\sum_{i=1}^{CN}\frac{\|\sigma(C_{i})\|}{\|\sigma(D)\|}, Dis(CN)=\frac{max_{i,j}\,d\big{(}c_{i},c_{j}\big{)}}{min_{i,j}\,d\big{(}c_{i},c_{j} \big{)}}\sum_{i=1}^{CN}\left(\sum_{j=1}^{CN}d\big{(}c_{i},c_{j}\big{)}\right) ^{-1} \tag{4}\]  
\[S\_Dbw=Scat(CN)\ +\ Dens\_bw(CN), \tag{5}\]where \(D\) is the dataset; \(CN\) is the number of clusters; \(\sigma(C_{i})\) is the variance vector of \(C_{i}\), \(\sigma(D)\) is the variance in the dataset, \((c_{i},c_{j})\) is the distance between \(c_{i}\) and \(c_{j}\) and \(\|x\|=\left(x^{T}x\right)^{1/2}\).  
Calinski-Harabasz Index  
This cluster validation scheme depends on the average of the cluster sum of squares and the average of the sum of squares within clusters and is known as CH [68]. It is obtained by formula as shown in Equation (6)  
\[CH=\frac{\sum_{i}n_{i}d^{2}(c_{i},c)/(CN-1)}{\sum_{i}\sum_{x\in C_{i}}d^{2}(x, c_{i})/(n-CN)}. \tag{6}\]  
Here, \(n\) represents the number of points/objects in \(D\), \(c\) denotes the center of \(D\) and d \((x,c_{i})\) denotes the distance between \(x\) and \(c_{i}\).