# Improving Spaceborne GNSS-R Algal Bloom Meteorological Data
## 3 Detection Method
### Classification Algorithm  
Throughout most of the observation period, there is no cyanobacteria bloom that occurs over the lake surface, so the training data are an imbalanced dataset, and points without cyanobacteria bloom presence are in the majority class, while those with cyanobacteria bloom are in the minority class but need to be emphasized. To deal with the imbalanced data classification problem, we employ the RUSBoost algorithm. The RUSBoost algorithm targets the minimization of the misclassification rate of each class; instead of pursuing the highest OA, it randomly selects some points from the majority class, with its number being equal to that of the minority class, and then trains weak learners by iterations to adjust the weight of each sample until the goal of classifying the imbalanced datasets is achieved. Firstly, we give an imbalanced dataset \(S\) and weights \(D\); \(S\) includes \(n\) dimensions vector \(x=\{x_{1},x_{2},...,x_{i},...,x_{n}\}\) and class label \(y=\{y_{1},y_{2},...,y_{i},...,y_{n}\}\), \(y_{i}=0\) or \(1\). The initial weight of each sample is set as \(1/n\) in the first iteration (\(D_{1}(i)=1/n\)). In the \(t^{\text{th}}\) iteration of total \(T\) iterations, the temporarily balanced dataset \(S^{{}^{\prime}}_{t}\subset S_{t}\) is created by the RUS method, and the corresponding weights \(D^{{}^{\prime}}_{t}\subset D_{t}\) are also created at the same time. The next step is using \(S^{{}^{\prime}}_{t}\) and \(D^{{}^{\prime}}_{t}\) to train the weak hypothesis \(h_{t}\) by some classification algorithms, such as _WeakLearn_. The weak hypothesis performs just a little better than random classification (accuracy around 50%), but combining them together to form a final hypothesis, the classification accuracy is much enhanced. Then, we calculate the pseudo-loss \(\epsilon_{t}\), while pseudo-loss is computed as the following formula:  
\[\epsilon_{t}=\sum_{i=1}^{n}D_{t}(i)(1-h_{t}(x_{i},y_{i})+h_{t}(x_{i},1-y_{i})). \tag{3}\]  
In every iteration, the weights \(D_{t}\) are updated by the updating factor \(\alpha_{t}=\epsilon_{t}/(1-\epsilon_{t})\):  
\[D_{t+1}(i)=D_{t}(i)\alpha_{t}^{\frac{1}{2}(1+h_{t}(x_{i},y_{i})-h_{t}(x_{i},1-y _{i}))}. \tag{4}\]  
Then, we normalize \(D_{t+1}\) by  
\[D_{t+1}(i)=\frac{D_{t+1}(i)}{\sum_{i=1}^{m}D_{t+1}(i)}. \tag{5}\]  
By this point, the process of one iteration is finished. If the iteration number \(t\) is not bigger than \(T\), the iteration will continue, or it will be stopped. Finally, the output of the final hypothesis \(H(x)\) is formed:  
\[H(x)=\operatorname*{arg\,max}_{y\in 0,1}\sum_{t=1}^{T}h_{t}(x,y)\log\frac{1}{ \alpha_{t}}. \tag{6}\]  
All steps of the RUSBoost algorithm are posted in the flowchart (Figure 3); for more detailed information about RUSBoost, refer to [31]. According to the discussions above, a new method for GNSS-R algal bloom detection is proposed, and the flowchart is displayed in Figure 4.  
Figure 4: Flowchart of this research. Blue boxes are the processing steps about CYGNSS data, orange box is about ERA5-Land data, red boxes are about MODIS data and green boxes are the modeling and evaluation steps.  
Figure 3: Flowchart of RUSBoost algorithm.