## 2 Materials and Methods
### K-Mean Clustering  
K-means clustering is a vector quantization approach that seeks to partition \(n\) observations into \(k\) clusters, with each observation belonging to the cluster with the closest mean (cluster centers or cluster centroid), which serves as the cluster's prototype such that the data space is divided into Voronoi cells as a result of this [23]. Within-cluster variances (squared Euclidean distances) are minimized by K-means clustering but not the regular Euclidean distances. The mean optimizes squared errors, while only the geometric median minimizes the Euclidean distances [24]. The use of K-medians and K-medoids, for example, can lead to better Euclidean solutions.  
There are three main characteristics of k-means that make it very efficient for solving engineering problems; however, these same characteristics are also frequently seen as its most significant drawbacks. These characteristics include the following [25]:  
1. Euclidean distance, which is used as both metric and variance for measuring the cluster scatter;
2. The number of clusters k when used as an input parameter; selecting an incorrect value for k may result in bad results. It is important, therefore, to check the number of clusters in the dataset when performing diagnostic checks with the k-mean clustering method;Finally, the convergence to a local minimum can have an unexpected (\"wrong\") result.  
Although the problem is computationally challenging, effective heuristic techniques quickly converge to a local optimum. Both K-means and Gaussian mixture modeling use an iterative refining method that is comparable to the expectation-maximization algorithm for mixtures of Gaussian distributions. They both use cluster centers to represent the data; however, K-means clustering finds clusters with similar spatial extents, whereas the Gaussian mixture model enables clusters to have diverse shapes.  
**Definition 1.**_If a set of observations is given by \((x_{1},\ x_{2},\ x_{3},\ldots,x_{n})\), where each of the observations is a \(d\)-dimensional real vector, the K-means clustering, therefore, aims to partition the \(n\) observations into \(k(k\leq n)\) sets \(S=(S_{1},\ S_{2},\ S_{3},\ldots,S_{k})\), such that the within-cluster sum of squares (WCSS) is minimized as much as possible (i.e., variance). The objective, therefore, is given as follows:_  
\[arg_{S}\text{min}\sum_{i=1}^{k}\sum_{X\in S_{i}}\parallel x-\mu_{i}\parallel^{ 2}=arg_{S}\text{min}\sum_{i=1}^{k}|S_{i}|\text{Var}\ S_{i} \tag{8}\]  
_where \(\mu_{i}\) is the mean of points in \(S_{i}\), and it is equivalent to the minimization of the pairwise squared deviations of the different points within the same clusters._  
\[arg_{S}\text{min}\sum_{i=1}^{k}\frac{1}{|S_{i}|}\sum_{x,y\in S_{i}}\parallel x -\mu_{i}\parallel^{2} \tag{9}\]  
The overall variance is constant, and this is equivalent to maximizing the sum of squared deviations between points in various clusters, and it is equal to the between-cluster sum of squares (BCSS). The algorithm for the implementation of the K-mean clustering method that has been proposed for the reliability and performance management of the non-intrusive continuous sensor was developed using the Python 3 programming language, and it is executed using an online python platform.