# Advancing Taxonomy with Machine Learning: A Hybrid Ensemble for Species and Genus Classification
## 3 Materials and Methods
### Dataset with Simulated Undescribed Species
Define \(num\_levels=\log_{2}(\text{length}(vector))\) \(row\gets 1\) \(OrigVector=vector\); \(\triangleright\) Original feature vector for\(diff\_wavelet=1\):inf do\(\triangleright\) Iterate over wavelet types; vector = OrigVector; \(\triangleright\) Fill the matrix Mat with wavelet coefficients for\(filter=1\):(\(num\_levels\) - 4) do\(\triangleright\) Discard the last 4 levels due to low dimensionality [\(approximation\), \(detail\)] = apply wavelet to'vector'; \(\triangleright\) Randomly choose mother wavelet for this iteration, extract approximation and detail coefficients. Such choice is random for each network, obviously for each pattern in a given network the same set of mother wavelets is used. \(vector=approximation\); \(\triangleright\) Use approximation vector for next iteration - Check(filter==1, \(approximation\), \(detail\)) At the first filter bank level, approximation and detail coefficients are resized to 25% of their size. - Check(filter==2, \(approximation\), \(detail\)) At the second filter bank level, coefficients are resized to 50%. \(\triangleright\) the rationale is to avoid reducing the dimensionality of the other levels, important to underline that the output matrix will be resized to the size required by ResNet50 (i.e., square matrix of size 224 with 3 channels)  Mat(row, :) = \(approximation\);  Mat(row+1, :) = \(detail\);  row = row + 2; endfor if row \(>\) size(Mat, 2) then\(\triangleright\) Exit condition: if row is higher than the number of rows of Mat  break; endif endfor
```

**Algorithm 2** DWT approach for reshaping data

Figure 2:2 A multi-level decomposition of a signal \(x[n]\) using the Discrete Wavelet Transform (DWT). The signal is iteratively passed through a low-pass filter \(h[n]\) and a high-pass filter \(g[n]\), followed by downsampling (\(\downarrow 2\)) at each level. The resulting coefficients at different levels represent progressively lower-resolution approximations and detailed components of the original signal. ### Classification Approaches: Support Vector Machine and ResNet50

One of the most influential approaches to supervised learning is the support vector machine [41]. This method is parameterized by a set of \(N\) weights \(\mathbf{w}\in\mathbb{R}^{N}\) and a bias term \(b\in\mathbb{R}\). In a binary classification task, the SVM predicts a class \(y\in\{-1,1\}\) for a sample vector \(\mathbf{x}\in\mathbb{R}^{N}\) using the following decision function:

Figure 2:3

which defines a hyperplane in \(\mathbb{R}^{N}\) referred to as margin. The margin, or the distance between the hyperplane and the closest points from each class, is maximized during training to achieve optimal separation. For multi-class classification, the problem becomes more complex and can be approached in various ways. A common method is the one-vs-one strategy, which divides the task into multiple binary classification problems, one for each pair of classes. The final prediction is computed by majority voting, often incorporating distance from the margin as a tiebreaker. However, this approach requires training an SVM for every class pair, which can significantly increase computational costs. Another strategy is the one-vs-all, which requires to train a model for each unique class in order to distinguish it from all the other classes. The final prediction is computed by selecting the class for which the model predicts the highest margin. Compared to the one-vs-one strategy, the one-vs-all is more robust to an imbalanced dataset and is particularly fast to train, especially when the number of classes is large. Here, we used the one-vs-all approach and the LibSVM toolbox ([[https://www.csie.ntu.edu.tw/~clin/libsvm/](https://www.csie.ntu.edu.tw/~clin/libsvm/)]([https://www.csie.ntu.edu.tw/~clin/libsvm/](https://www.csie.ntu.edu.tw/~clin/libsvm/)), accessed on 8 February 2025). ResNet (Residual Network), introduced by [PERSON] [42], is a deep learning architecture designed to address the vanishing gradient problem in training deep neural networks.