Abstract
We investigate the application of supervised machine learning models to directly infer the spectral types of ultracool dwarfs (dwarf spectral types ≥M6) using binned fluxes as feature labels. We compare the ability of two machine learning frameworks, k-Nearest Neighbor (kNN) and Random Forest (RF), to classify low-resolution near-infrared spectra of M6 to T9 dwarfs (3100 K ≳ Teff ≳ 500 K). We used a synthetic training data set of 2400 spectra generated from 24 spectral type standards and validated our models on 315 spectra with previous literature classifications. Classification accuracies within ± 1 subtype were 98.4% ± 0.7% for the kNN model and 95.6% ± 1.2% for the RF model, indicating the kNN performs marginally better for spectral-type estimation. Future studies will explore a broader range of stellar properties such as metallicity, gravity, and cloud characteristics and additional machine learning models.
Export citation and abstract BibTeX RIS
Original content from this work may be used under the terms of the Creative Commons Attribution 4.0 licence. Any further distribution of this work must maintain attribution to the author(s) and the title of the work, journal citation and DOI.
1. Introduction
Spectral typing is a cornerstone of stellar astronomy, providing an empirical metric that can be mapped to more general physical traits. Following the discovery and characterization of LTY-type brown dwarfs, multiple methods for spectral classification have been developed for ultracool dwarfs (UCDs; SpT ≥ dM6) at various wavelengths, in some cases leading to conflicting spectral types indicative of distinct spectral properties (Kirkpatrick 2005 and references therein). With thousands of UCD spectra anticipated from space-based facilities such as Euclid (Laureijs et al. 2010; Solano et al. 2021), Roman (Holwerda et al. 2023), and SPHEREx (Crill et al. 2020), the need for a robust, consistent, and efficient spectral typing methodology is paramount.
Machine learning (ML) offers a data-driven approach that captures patterns within data to distinguish different classes. ML has been used to estimate UCD properties and detect binaries (e.g., Feeser & Best 2022; Gong et al. 2022; Desai et al. 2023; Sithajan & Meethong 2023). In this Research Note, we compare the performance of the k-Nearest Neighbor (kNN) and Random Forest (RF) algorithms (Ho 1995) in the context of spectral classification.
2. Methods
We used low-resolution (λ/Δλ ≈ 120) near-infrared (NIR; 0.80–2.45 μm) spectra of M6–T9 dwarf spectral standards (Burgasser et al. 2006; Kirkpatrick et al. 2010) obtained with SpeX (Rayner et al. 2003) on the NASA IRTF and procured from the SpeX Prism Library Analysis Toolkit (SPLAT; Burgasser & Splat Development Team 2017). Data were normalized by the median flux between 1.27–1.28 μm, and telluric regions at 1.35–1.42 μm and 1.80–1.95 μm were masked. We resampled the spectra using the average flux in wavelength bins of 0.10, 0.05, 0.02, and 0.01 μm within the 0.81–2.45 μm range and evaluated the performance of each bin using accuracy metrics (see below), determining the 0.02 μm bin provided the best performance for both classifiers. For each spectral standard, we created 100 synthetic spectra by varying the fluxes using a Gaussian distribution scaled to the measured uncertainty with a 3% lower limit, resulting in 2400 spectra for training and validation. For testing, we selected 315 additional spectra from SPLAT with NIR spectral types between M6–T9 and SNR ≳ 40.
We constructed our RF and kNN models using the sklearn.ensemble.RandomForestClassifier and sklearn.neighbors.KNeighborsClassifier modules. The parameters used are provided in the GitHub repository below. To assess the validity of these models, we define classification accuracy as the fraction of retrieved classifications from our test set that were within ±1 subtypes of their known classifications. We obtained overall accuracies of 95.6% ± 1.2% and 98.4% ± 0.7% for the RF and kNN models, respectively, where the uncertainties assume binomial distributions. These results indicate that kNN performs marginally better at spectral-typing. A more detailed breakdown of performance as a function of spectral type is shown in Figure 1. We found 4 (of 14) incorrect classifications from the RF model are known binary candidates. While the kNN algorithm exhibited 5 misclassifications, it successfully identified all binary candidates that the RF had misclassified.
Our results highlight the potential of kNN and similar algorithms for automating spectral classification. Future work will explore the integration of other ML techniques, such as support vector machines and neural networks (Vapnik 1999; LeCun et al. 2015), which could capture more complex patterns in the data. Such models may be particularly useful in capturing additional parameters from the spectra, such as surface gravity, metallicity, cloud properties, etc. Further investigations are underway to include the classification of surface gravity and metallicity using supervised machine-learning algorithms (Zhou et al. 2024, in preparation). The data and models are made publicly available at https://github.com/Ultracool-Machine-Learning/SpeXtral_type_classifier (Zhou 2024).