# An Adaptive Moving Window Kriging Based on K-Means Clustering for Spatial Interpolation
## 1 Introduction
[26] and [PERSON] [20; 27] to determine a kriging window size through a minimization of the following equation  
\[\text{CV}=\sum_{i=1}^{n}(y(i)-\hat{y}(i)), \tag{1}\]  
where \(n\) is the number of data points, and \(y(i)\) and \(\hat{y}(i)\) are the measured and estimated values of the \(i\)th point, respectively. However, its computationally intensive nature is its main drawback, as the cross-validation is repeated multiple times for various window sizes to achieve a globally optimal window size. Therefore, this can restrict its use to certain applications. More recent work has attempted to apply clustering algorithms. [PERSON] et al. [28] tested various data partitioning algorithms, including K-means, fuzzy C-means, and regression trees. The results indicate that Gaussian mixture models and the regression tree produced more accurate estimates than those derived from other methods. More recent work has explored applying clustering algorithms so that each cluster can be considered as a window for estimation. [PERSON] et al. [29] coupled the K-means clustering technique with ordinary kriging interpolation by classifying piezometric head data into six clusters based on characteristic similarity. The method displayed a superior performance to conventional counterparts, with a normalization factor being introduced to resolve overlapping cluster structures. They additionally addressed the issue of boundary misspecification, in which boundary points were located inside unsuitable clusters. [PERSON] et al. [30] later improved the normalization factor technique by integrating it with genetic algorithms and the K-Nearest Neighbors classifier (KNN) to enhance cluster efficiency. Moreover, instead of using one variogram model for all of the clusters, as presented by [PERSON] et al., automatic estimation of the variogram parameters for each cluster was also introduced. However, undesirable estimation errors from the fixed partitioning strategy of [PERSON] et al. tended to be produced when target points were located at or near the cluster borders. This is because some members were situated in the same cluster as such target points, which were more distant than those in the adjacent clusters. Samples with a weak correlation were hence used for the estimation of the target points. To handle this hindrance, we propose a novel adaptive moving window kriging using the K-means clustering method, referred to as AMWKK. Ordinary kriging is employed within the AMWKK framework. The target points are treated as cluster centroids to select their window members. This approach also incorporates the optimum number for dynamic cluster selection based on the Calinski-Harabasz index. We assessed the performance of AMWKK in estimating annual pressure and humidity across Thailand, comparing it to the traditional fixed window size of the moving window kriging method. Our findings reveal the superior accuracy and adaptability of AMWKK for this specific application. The remainder of this paper is structured as follows. Section 2 presents a brief introduction to the ordinary kriging method and the K-means clustering algorithm. The adaptive moving window kriging using K-means clustering is provided in Section 3. In Section 4, a case study of Thailand's meteorological datasets is carried out to examine the performance of our proposed method relative to existing models. Discussion and Conclusion are provided in Section 5 and Section 6, respectively.