# Advancing Taxonomy with Machine Learning: A Hybrid Ensemble for Species and Genus Classification
## 3 Materials and Methods
### Dataset with Simulated Undescribed Species  
In accordance with the methodology outlined in the original paper, the data utilized in our experiments were obtained from the Barcode of Life Data System (BOLD) [6], which is a cloud-based data storage and analysis platform developed at the Centre for Biodiversity Genomics in Canada. The data consist of 32,424 image samples, e.g., see Figure 2, of insect species from four Insecta orders, _Diptera_, _Coleoptera_, _Lepidoptera_, and _Hymenoptera_, each associated with a DNA barcode COI mitochondrial sequence of that species. Due to the fact that we did not have access to the original images used in [16], we resorted to downloading the data from the BOLD Systems platform to recreate a dataset that closely matches [16]. However, we encountered some discrepancies: some species names have been updated, and certain species have been split into two distinct categories. As a result, our dataset exhibits some differences compared to [16]. Table 1 highlights these differences. \begin{table}
\begin{tabular}{l l l l} \hline \hline  & **Genera** & **Species** & **Samples** \\ \hline
[16] & 368 & 1040 & 32,848 \\ Here & 371 & 1050 & 32,424 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Differences in the collected dataset compared to [16], the columns Genera and Species report the number of classes of the samples. Next, we split the data following the methodology described in [16]. We considered all genera containing three or more species and we randomly selected 30% of the species within each of these genera as \"undescribed\" (only the genus is known while the species is unknown) and added all the samples from these species in the test set. We then split the remaining described data into 80% for the training + validation and 20% for the test set. Hence, the final test set consists of this 20% together with the previously designated undescribed species. This process is described by Algorithm 1. After applying Algorithm 1 to obtain a training + validation set and a test set, we apply it again on the training + validation set to obtain a training set with only described species and a validation set with both described and undescribed species. It is necessary that the undescribed species in the validation set are different species from the undescribed species in the test set; this is important to avoid class leaking from the test set to the validation set, ensuring that the undescribed species in the test set remain unseen during validation. ```
0:\(D\)\(\triangleright\) Dataset to split, containing species and their genus
0:training, test\(\triangleright\) Split dataset with undescribed species
1: Initialize \(\textit{test}\leftarrow\emptyset\)
2: Group species in \(D\) by genus
3:for all genus \(g\) in \(D\) where \(|g|\geq 3\)do
4: Randomly select 30% of species in \(g\) as undescribed
5: Add all samples in \(D\) with undescribed species to test_unseen
6: Remove samples with undescribed species from \(D\)
7:endfor
8: Split the remaining \(D\) into training (80%) and test_seen (20%)
9:test = test_seen\(\cup\) test_unseen
10:return training, test

Figure 2: Dataset example. We did not use the validation set for the training or the hyperparameter tuning of our models described in Section 3.4, but we provide this validation set to be used in future works that use the same dataset in order to be able to compare our results. ### Dataset with Undescribed Species

To create a dataset of real-life undescribed species, we began by listing all genera present in the BOLD dataset containing simulated undescribed species. Using this list, we queried the BOLD Systems database to download samples belonging to these genera but with no species name, indicating that they were undescribed at the time of data retrieval. From these downloaded samples, we randomly selected 5% to ensure the dataset was comparable in size to the one containing simulated undescribed species.