# Machine Learning-Based Satellite Routing for SAGIN IoT Networks
## 3 Model Design
### Denoising with SMOTE Algorithm  
The original weather-related data is gathered utilizing sensors and IoT technologies, and that will need a collection of about 140,000 data points. There were approximately 500,000 pieces of data in the dataset after a series of data preprocessing procedures, such as missing value and anomalous value processing, data category imbalance processing, and so on. The dataset includes information such as geographic location, daily minimum and maximum temperatures; as well as temperature, wind speed, humidity, and air pressure at various times of the day, including 9 a.m., 3 a.m., and 3 p.m.  
Table 2 shows the data distribution of different rainfall categories in the original data. Among the collected weather data, there is a serious problem of unbalanced data categories. Synthetic minority over-sampling technique (SMOTE) is used to solve this problem. SMOTE is a commonly used over-sampling technique to subside the imbalanced dataset problem [17]. The basic idea of the algorithm is to analyze and simulate minority samples, and add new manually simulated samples to the dataset, so the categories in the original data will not lose balance seriously [18]. At present, the SMOTE algorithm is an excellent way to deal with the imbalanced classification problem.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline  & **Thickness** & **Incident Angle** & **Attenuation** & **Blockage** \\  & **(km)** & **(\({}^{\circ}\))** & **(dB/km)** & **(dB)** \\ \hline Drizzle & 2.5 & 30 & 0.2 & 1 \\ Moderate rain & 3 & 60 & 3.5 & 12.1 \\ Heavy rain & 8 & 45 & 20 & 226.3 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Comparison table of blockage caused by bad weather.  
The flow chart of the SMOTE algorithm is shown in Figure 6. First, in a small number of sample sets, for a sample x, the K nearest neighbor samples of x can be obtained by calculating the Euclidean distance from x to other samples [19]. The formula for calculating Euclidean distance is  
\[\mathrm{d(x,y)}=\sqrt{\sum_{i=1}^{n}(y_{i}-x_{i})^{2}} \tag{2}\]  
Secondly, the sampling rate is set for the samples to obtain the sampling multiplicity, assuming that the sampling multiplicity is represented by n. Then n nearest neighbor samples can be randomly selected from K nearest neighbor samples, and the selected samples are recorded as y [20]. Thirdly, given sample X and sample y, we can construct a new sample set by the formula  
\[\mathrm{L}=x+\mathrm{rand}(0,1)\times|\mathrm{x-y}| \tag{3}\]  
Figure 7 shows the box diagram of 'blockage' data processed by SMOTE algorithm according to category distribution. It can be concluded that the SMOTE algorithm can solve the problem of unbalanced data categories.  
A good-performing classifier may be constructed after rebalancing the class distribution of the training dataset.  
\begin{table}
\begin{tabular}{c c c} \hline \hline  & **Number** & **Proportion** \\ \hline No blockage & 79,952 & 64.3\% \\ Micro blockage & 35,890 & 29.0\% \\ Small blockage & 5713 & 4.7\% \\ Intermediate blockage & 1832 & 1.4\% \\ Large blockage & 585 & 0.5\% \\ Huge blockage & 138 & 0.1\% \\ \hline \hline \end{tabular}
\end{table}
Table 2: Data distribution and proportion in the original dataset.  
Figure 6: Flow chart of SMOTE algorithm.  
Figure 7: Blockage distribution after data preprocessing using the SMOTE algorithm.