# Prediction of Cyanobacteria Using Decision Tree Algorithm and Sensor Monitoring Data
## 2 Research Method
### Evaluation of Sensor-Based Data Prediction Accuracy  
Today, with the development of sensors, various items can be monitored through sensors [38; 39; 40]. In fact, the need for high-frequency monitoring is well known [41], and high-frequency measurements using sensors can confirm trends in water quality in sections with severe temporal fluctuations [42; 43]. Using sensors and modeling is a very efficient way to save time, cost, and manpower in water-quality management [44]. In this study, we applied the results of the cluster analysis of the eight weirs of the mainstream of the Nakdong River to determine the key factors influencing blue-green algae outbreaks and to evaluate the importance of each variable. RandomForestClassifier was used for the analysis, and for the analysis based on the algae alert system data, with the following levels specified under particular conditions: Attention, when the algae cell count was less than 1000 cells/mL; Warning, when the count was between 1000 and 10,000 cells/mL; and Bloom, when the count was more than 10,000 cells/mL. We used Classification, a supervised machine learning method, for the category-type algae prediction model. In Classification, the process identifies the category relationship of the  
Figure 3: Distribution of the water quality data according to explanatory factors for each cluster. existing data and determines the category of the newly observed data by itself. In this study, it was used to predict the algae level based on data from the algae alert system. The RF model was used to evaluate the applicability of the category-type algae prediction model. The factors used for this model per section were BOD, COD, SS, _E. coli_, TN, TP, EC, TOC, W.T., pH, DO, Chl-a, HRT, W. Volume, rainfall, inflow, and outflow. The data set used was based on measurements obtained at 8-day intervals. Real-time predictability was verified by building a prediction model with factors for which data can be obtained in real time from an automatic monitoring network. Data items that can be collected in real time from the automatic monitoring network and weir operational data include EC, TOC, W.T., pH, DO, Chl-a, HRT, W. Volume, inflow, and outflow. We also performed predictions after 7 days to determine whether future predictions could be made. The accuracy of the category-type algae prediction model was evaluated. In all sections, the prediction accuracy was more than 75%, depending on the factors and prediction period (Table 4). With all variables and real-time variables, the accuracy was high in the SJ-GM and DS-HC sections and was more than 80% for the prediction made after 7 days. As such, we were able to determine the applicability of the category-type prediction model. ROC (receiver operating characteristic curves) were used to evaluate the performance of the Classification model (Figure 5). The ROC curve is a graph that shows the performance of a Classification model at various threshold settings, and the area under the ROC curve is referred to as the AUC (area under the curve). A high AUC indicates that the model has a strong ability to distinguish between different classes. In the four segments, Attention and Bloom demonstrated high performance, while the Warning segment exhibited a relatively lower performance. Across the four clusters, the AUC values ranged from 0.86 to 0.92 in the Attention segment, 0.75 to 0.81 in the Warning segment, and 0.80 to 0.95 in the Bloom segment (Table 5). \begin{table}
\begin{tabular}{c c c c} \hline \hline  & \multicolumn{3}{c}{**Applied Factor**} \\ \cline{2-4}
**Station** & **All Data** & **All Data Day + 7** & **Sensor Data Day + 7** \\ \hline SJ–GM & 0.875 & 0.878 & 0.853 \\ \hline CG–GG & 0.754 & 0.719 & 0.761 \\ \hline DS–HC & 0.878 & 0.831 & 0.811 \\ \hline CH & 0.754 & 0.764 & 0.764 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Evaluation of the accuracy of the category-type algae prediction model. Figure 4: Distribution of the hydrological data according to explanatory factors for each cluster.