## 2 Materials and Methods
### Model Training and Evaluation  
We employed a rigorous model training and evaluation process using repeated stratified \(k\)-fold cross-validation to ensure robust performance assessment. The dataset was  
Figure 1: Deep learning architecture.  
randomly split into 10 stratified repeats, each consisting of 5 folds, ensuring balanced representation of both classes in each fold. This approach helps mitigate any potential biases introduced by data imbalance and provides a reliable estimate of the model's performance across different data partitions. We performed hyperparameter tuning using a grid search method to identify the optimal configuration of learning rate, batch size, and the number of epochs. Specifically, the hyperparameter grid included the learning rate (0.01), batch sizes (16, 32), and training epochs (50, 100). The model's performance was evaluated using the accuracy metric as the primary criterion for optimization during grid search. To address class imbalance, we employed a downsampling technique to balance the classes within the training set. In each fold, the minority class was identified, and an equal number of samples from the majority class were randomly selected to match the size of the minority class. This process was performed to ensure that the model was trained on balanced data in each fold.  
In addition, we utilized recursive feature elimination with cross-validation (RFECV) to identify the most relevant features for classification. A logistic regression model was employed as the base estimator for RFE, with a step size of 10% and a minimum of 150 features retained to ensure that the model had sufficient input dimensions to perform effectively. RFECV was performed within each fold to ensure that feature selection was applied independently to each training set, further reducing the risk of overfitting and ensuring that the selected features generalize well across different data splits. After feature selection, the training data was converted to be used with our custom ResNet1D model. A newly instantiated model was trained for each fold, using the cross-entropy loss function and the Adam optimiser with a learning rate of 0.001. For each training session, the model parameters were optimised to minimize the classification error over a series of epochs, and early stopping was employed to prevent overfitting.  
The model's predictive performance was evaluated using two key metrics: accuracy and area under the receiver operating characteristic curve (AUC). Accuracy (ACC) measured the proportion of correctly classified samples, while AUC assessed the model's ability to discriminate between normal-to-high and low flavonoid content levels. The AUC was computed for the normal-to-high class (positive class) using the predicted probabilities from the model's output. The accuracy was calculated using an optimal threshold determined by [PERSON]'s J statistic to classify samples into normal-to-high or low groups based on their predicted probabilities. The repeated stratified _k_-fold cross-validation approach provided a robust estimate of the model's performance, mitigating potential biases from random data partitioning or class imbalance. The final performance metrics were calculated by averaging the accuracy and AUC scores across all repetitions.