## 2 Materials and Methods
### Main Machine Learning Algorithms
#### 2.2.2 K-Means  
The K-means algorithm, mainly known as an unsupervised clustering method, can also be utilized for classification and detection tasks by using its clustering capabilities [40]. In the context of classification, K-means can assign class labels to unlabeled data on the basis of its similarity to predefined centroids. This process involves two steps: training and prediction. During the training phase, a representative set of labeled samples is used to create a set of centroids (cluster centers) that correspond to different classes. Each centroid represents the mean feature vector of its respective class. Features can be extracted using \begin{table}
\begin{tabular}{p{142.3 pt} p{142.3 pt}} \hline \hline
**Method** & **Description** \\ \hline Averaging & A simple method that involves averaging over several consecutive bins to enhance the signal-to-noise ratio. \\ Median Filtering & Replaces each bin in the profile with the median of neighboring bins to remove noise. \\ Wavelet Transform [30] & Decomposes the signal into wavelet coefficients at different scales for noise reduction at each scale. \\ Savitzky–Golay Filtering [31] & Uses polynomial regression to smooth out the data, while preserving the shape of the signal. \\ Gaussian Filtering [32] & Convolves the lidar signal with a Gaussian function for data smoothing. \\ High-pass and Low-pass Filtering [33] & Removes noise from specific frequency ranges; high-pass filters remove slow-varying drifts, and low-pass filters remove high-frequency noise. \\ Adaptive Filtering & Adjusts based on the signal and noise characteristics by dynamically changing its coefficients. \\ Statistical Methods & Removes those bins that deviate significantly from a statistical measure, assuming deviations from the mean are due to noise. \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Traditional denoising methods for lidar techniques applied to atmospheric studies. various techniques, depending on the type of data, such as image descriptors or numerical attributes [41]. In the prediction phase, K-means uses trained centroids to classify new unlabeled samples. The algorithm calculates the Euclidean distance between each unlabeled sample and the centroids, assigning the sample to the class represented by the nearest centroid. The assigned class label can then be used for classification purposes. K-means can also be used for detection tasks by exploiting the notion of outlier detection. In this scenario, the algorithm is trained on a set of normal samples that represent the target class or classes. During prediction, if a new sample is significantly different from the nearest centroid (based on a predefined threshold), it is considered an outlier or anomaly. This approach is useful for detecting abnormal instances or objects that do not conform to the learned patterns. However, it is important to note that K-means have certain limitations when used for classification and detection. One limitation is that it assumes a fixed number of clusters (K) and requires prior knowledge of the number of classes or anomalies in the data. Additionally, K-means are sensitive to the initial placement of centroids and can converge to suboptimal solutions. It also assumes that the clusters are convex and have equal variance, which may not always hold in complex data distributions [42]. For atmospheric studies, it is important to note that the effectiveness of using the K-means algorithm for cloud and aerosol classification and detection depends on the quality and representativeness of the features extracted from the lidar data. Additionally, the choice of the number of clusters (K value) in the algorithm should be carefully considered, as this determines the level of granularity in the classification results. Iterative refinement and validation techniques can be used to optimize clustering and detection performance [43].