# Adaptive Rate-Compatible Non-Binary LDPC Coding Scheme for the B5G Mobile System
## 3 Channel Clustering Based on the K-Means++ Algorithm
### Channel Environment Clustering Based on the K-Means++ Algorithm  
The k-means algorithm is one of the most common partition-based clustering algorithms. K-means clustering aims to partition \(n\) observations into \(k\) clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster. The k-means algorithm is simple and flexible, but sensitive to outliers and isolated points.  
In addition to the impact of the physical factors, the number of users under the same hotspot, as well as the user usage behavior (occupied bandwidth), will have an impact on the actual available  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Matrix Construction** & & & & \\
**Algorithm** & **Pre-Process** & **Mass in GF\((q)\)** & **Multiplication Operation** & **Coding Times in GF\((q)\)** & **Complexity** \\ \hline Random construction & \(O(n^{3})\) & \((w-1)n\) & \(wn\) & \(O(n^{2})\) \\ Masking and puncturing construction & No & No & \(o\Big{(}(L-J)^{2}p\Big{)}\) & \(O(n)\) \\ \hline \hline \end{tabular}
\end{table}
Table 1: Coding complexity analysis.  
channel state. In this paper, we abstract these influencing factors into data vectors and form the data vectors into a sample set, and then cluster them with the k-means algorithm.  
We assume that the inputs are the sample set \(D=\{x_{1},x_{2},\ldots,x_{m}\}\), the cluster number \(k\), the maximum number of iterations \(N\), and the output is cluster partition \(C=\{C_{1},C_{2},\cdots C_{k}\}\). The k-means algorithm flow is as follows:  
1. We randomly select \(k\) samples from data set \(D\) as the initial cluster center vector \(\{\mu_{1},\mu_{2},\cdots\mu_{k}\}\).
2. For \(n=1,2,\cdots,N\) 1. Initialize cluster partition \(C\) to \(C_{t}=\varnothing,t=1,2,\cdots k\). 2. For \(i=1,2,\cdots,m,j=1,2,\cdots,k\), calculate the distance between the sample \(x_{i}\) and cluster center vector \(\mu_{j}\): \(d_{ij}=\|x_{i}-\mu_{j}\|^{2}\). Mark \(x_{i}\) as the category \(\lambda_{i}\) corresponding to the smallest \(d_{ij}\) and update \(C_{\lambda_{i}}=C_{\lambda_{i}}\cup\{x_{i}\}\). 3. For \(j=1,2,\cdots,k\), recalculate the new cluster center for all sample points in \(C_{j}\) by \(\mu_{j}=\frac{1}{|C_{j}|}\sum\limits_{x\in C_{j}}x\). 4. If all cluster center vectors have not changed, go to step 3.
3. Output cluster division \(C=\{C_{1},C_{2},\cdots C_{k}\}\).  
The k-means algorithm is sensitive to the initially selected cluster center, and the position selection of the k initial cluster centers has a great influence on the final clustering result. Therefore, it is necessary to select the appropriate \(k\) cluster centers. The k-means++ algorithm randomly initializes the cluster center, which is the optimization of the k-means algorithm.  
The optimization strategy of k-means++ for initializing the cluster center is as follows:  
According to the process of the algorithm, different initial clustering centers may result in different results. In this paper, we select the k-means++ algorithm in order to optimize the initial clustering center. The k-means++ algorithm is an improvement of the k-means algorithm. Try to choose the k-measuring point distance as the initial cluster center. The specific steps are as follows:  
1. Randomly select sample data from the data set as the first cluster center \(\mu_{1}\) in \(k\) clusters.
2. Calculate the distance \(D(x)\) between the data sample \(x_{i}\) in the dataset and the nearest cluster center. \[D(x)=\operatorname{argmin}\|x_{i}-\mu_{r}\|^{2},r=1,2,\cdots,k_{selected}\]
3. According to the value of \(D(x)\), select a new data point in the remaining sample data as a new cluster center. The larger the \(D(x)\), the greater the probability of being selected;
4. Repeat steps 2 and 3 until \(k\) cluster centers are selected;
5. Implement the standard k-means algorithm by using the \(k\) centers as the initial cluster centers.