# Random forest Algorithm for the Classification of Spectral Data of Astronomical Objects
## 2 Materials and Methods
### Materials  
In astronomical observation, many methodologies allow for the detection of astronomical bodies, such as stars, exoplanets, quasars, galaxies, and others. These detection methods yield a large amount of data that describes these bodies in particular. These methods can range from direct observation in space to observation using spectroscopes, such as with the Sloan Digital Sky Survey (SDSS), which uses an optical telescope that allows for studies of redshift on astronomical bodies [20]. The SDSS conducts a celestial census, which has allowed for gathering information about how many galaxies and quasars the universe contains, how they are distributed, their individual properties, and how bright they are. This data collection uses an optical telescope that allows studies of redshifts on astronomical objects. The SDSS has created spectral maps of over three million astronomical objects [21; 22]. In astronomy, it is common to carry out the task of classifying astronomical bodies according to certain spectral characteristics. One of the most important astronomical classification schemes is that of galaxies, quasars, and stars. The goal of this kind of dataset is to classify stars, galaxies, and quasars based on their spectral characteristics [14]. In particular, the three datasets used in this work consist of different compilations made over time from SDSS. From the wide range of astronomical datasets generated by scientists throughout the centuries, we have chosen three of them due to the interest shown by researchers. The prestige of these three datasets is reflected in the quantity and quality of scientific articles published in high-impact journals over the last lustrum [23; 24; 25; 26; 27; 28; 29]. The objective of these datasets is to classify stars, galaxies, and quasars based on their spectral characteristics, so the patterns of each dataset are divided into three classes: stars, galaxies, and quasars. Since the three classes do not necessarily contain the same number of patterns, it is necessary to characterize each dataset with an index that indicates the imbalance of the classes. The imbalance ratio (\(IR\)) is an index that measures the degree of imbalance of a dataset. The \(IR\) index is defined as in [30]:  
\[IR=\frac{|majority\_class|}{|minority\_class|} \tag{1}\]  
where \(|majority\_class|\) represents the cardinality of the majority class in the dataset, while \(|minority\_class|\) represents the cardinality of the minority class. A dataset is considered balanced, if its \(IR\) value is close to or less than 1.5 (note that the \(IR\) value is always greater than 1). In all cases, each pattern is composed of 17 attributes, which are:  
1. obj_ID: Object Identifier, the unique value that identifies the object
2. alpha: Right Ascension angle
3. delta: Declination angle
4. u: Ultraviolet filter in the photometric system
5. g: Green filter in the photometric system
6. r: Red filter in the photometric system
7. i: Near Infrared filter in the photometric system
8. z: Infrared filter in the photometric system
9. run_ID: Run Number used to identify the specific scan
10. rerun_ID: Rerun Number to specify how the image was processed
11. cam_col: Camera column to identify the scanline within the run
12. field_ID: Field number to identify each field
13. spec_obj_ID: Unique ID used for optical spectroscopic objects
14. redshift: Redshift value based on the increase in wavelength
15. plate: plate ID, identifies each plate in SDSS
16. MJD: Modified Julian Date, when a given piece of SDSS data was taken
17. fiber_ID: fiber ID, the fiber that pointed the light at the focal plane The datasets used are DR14, DR16, and DR17. Sloan Digital Sky Survey DR14  
The Sloan digital sky survey DR 14 dataset contains observations from the SDSS taken in July 2016. The dataset consists of 10,000 observations taken by the SDSS [31]. Each observed pattern comprises 17 attributes and a class column identifying them as a star, galaxy, or quasar.