# Random forest Algorithm for the Classification of Spectral Data of Astronomical Objects
## 3 Results and Discussion
### Results and Comparative Analysis for the SDSS DR17 Dataset  
As previously specified in Section 2.1, the Sloan digital sky survey DR 17 dataset contains 59,445 observations of the galaxy class (GALAXY), 18,961 of the quasar class (QSO), and 21,594 of the star class (STAR). The Imbalance ratio for this dataset is \(IR=3.13\). When running the proposed random forest algorithm on the SDSS DR17 dataset, the following confusion matrix is obtained (Figure 8):  
If we consider the case GALAXY as positive, the values of the four performance measures: accuracy, sensitivity, specificity, and balanced accuracy are calculated based on the values in the confusion matrix. For comparative purposes, the values of these four performance measures are included in Table 4.  
Again, the results on the SDSS DR17 dataset are similar to those obtained by the proposed random forest algorithm on the SDSS DR14 dataset, which are good in all four performance measures. The comparative table shows that the proposed random forest algorithm clearly outperforms the other five state-of-the-art classifiers, considering GALAXY as the positive class. It is also worth noting that the proposed random forest algorithm outperforms all others in both performance measures: accuracy and balanced accuracy. These results are shown graphically in the bar charts of Figure 9 for balanced accuracy. \begin{table}
\begin{tabular}{c c c c c c} \hline  & **Naive Bayes** & **IB1** & **IB3** & **SVM (SMO)** & **MLP** & **Random forest** \\ \hline sensitivity & 0.6329 & 0.8185 & 0.8022 & 0.9313 & 0.9657 & **0.9756** \\ specificity & 0.8108 & 0.9057 & 0.8988 & 0.9636 & 0.9818 & **0.9874** \\ balanced accuracy & 0.7219 & 0.8621 & 0.8505 & 0.9474 & 0.9738 & **0.9815** \\ \hline \end{tabular}
\end{table} 
Table 4: Performance measures (in %) for SDSS DR17 dataset (best values in bold). Figure 8: Confusion matrix resulting from applying the proposed random forest algorithm on the SDSS DR17 dataset. \begin{table}
\begin{tabular}{c c c c c c c} \hline  & **Naive Bayes** & **IB1** & **IB3** & **SVM (SMO)** & **MLP** & **Random Forest** \\ \hline sensitivity & 0.9630 & 0.8515 & 0.8544 & 0.9433 & **0.9788** & 0.9783 \\ specificity & 0.9862 & 0.9243 & 0.9261 & 0.9676 & 0.9898 & **0.9940** \\ balanced accuracy & 0.9746 & 0.8879 & 0.8858 & 0.9554 & 0.9843 & **0.9861** \\ \hline \end{tabular}
\end{table} 
Table 3: Performance measures (in %) for SDSS DR16 dataset (best values in bold). Given the results in Tables 2-4, unusual behavior is observed within the pattern classification task [50]. It is observed that for the set SDSS DR14, whose unbalance rate is the highest (\(IR\) = 5.88), a better performance is achieved compared to the most recently created datasets, SDSS DR16 and SDSS DR17, this for the most reliable performance measure for unbalanced datasets, the balanced accuracy [51]. In this circumstance, it cannot be established that the unbalanced factor determines the performance, but it can be attributed to the data acquisition; although the attributes considered for each dataset are the same, it should be remembered that these data are obtained from photometric signals, and being acquired in different seasons of the year, these can provide better or worse information of the phenomena occurred [52]. Remarkably, the performance metrics shown for the SMO and MLP algorithms are extremely close concerning the performance achieved by the random forest algorithm proposal developed in this work. However, in that sense, it is evident that RF improves the results achieved by the algorithms of greater scientific relevance, although this difference in some measures seems to be minimal. In this circumstance, it is important to demonstrate that the results are reliable by applying statistical significance tests, these tests consist of accepting or rejecting the null hypothesis \(H_{0}\), i.e., that there are no significant differences between one group of data and another.