# Explainable AI for Marine Ecological Quality Prediction: Integrating Microbiome Data, Metadata, and Diversity

Houria Braikia, Sana Ben Hamida, Marta Rukoz

► To cite this version:

Houria Braikia, Sana Ben Hamida, Marta Rukoz. Explainable AI for Marine Ecological Quality Prediction: Integrating Microbiome Data, Metadata, and Diversity. 2025. hal-05046103

HAL Id: hal-05046103

https://hal.science/hal-05046103v1

Preprint submitted on 24 Apr 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# Explainable AI for Marine Ecological Quality Prediction: Integrating Microbiome Data, Metadata, and Diversity

Houria BRAIKIA<fnref n="1" />, Sana BEN HAMIDA<fnref n="2" />, and Marta RUKOZ<fnref n="2" />

DOI not yet assigned

## Abstract

Assessing ecological quality (EQ) is crucial for marine biodiversity monitoring. With the advent of High-Throughput Sequencing technologies, metabarcoding has enabled large-scale microbial community analysis through Operational Taxonomic Unit (OTU) tables, providing an alternative for EQ assessment. Machine learning (ML) models have been successfully applied for this task, but they often treat microbial abundance as the sole predictor, overlooking environmental meta-data (e.g., pH, salinity, temperature) and diversity indices (alpha and beta diversity). This study integrates metadata and diversity indices into an explainable ML framework for EQ prediction. Using SHapley Additive Explanations (SHAP), we assess the contribution of these features to model predictions across five genetic markers (V1V2, V3V4, V4, 37F, and V9). Our results highlight marker-dependent feature importance, demonstrating that while OTU-based models remain dominant, incorporating metadata improves accuracy for certain markers. This work enhances interpretability in AI-driven biomonitoring, fostering more reliable marine ecosystem assessments.

**Keywords:** Marine Biodiversity Monitoring, Ecological Quality, SHAP, Alpha Diversity

<footnote n="1">¹LAMSADE, Paris Dauphine University- PSL, Pl. du Maréchal de Lattre de Tassigny, 75016 Paris, France,</footnote>

<footnote n="2">²LAMSADE, Paris Dauphine University- PSL, Pl. du Maréchal de Lattre de Tassigny, 75016 Paris, France & SEGMI, Paris Nanterre University, France</footnote>
2

# 1. Introduction

3

4

5

6

7

8

9

10

11

The integration of machine learning (ML) for predicting the Biotic Index (BI) to assess the Ecological Quality (EQ) of marine environments using environmental DNA (eDNA) metabarcoding data represents a significant advancement in biomonitoring. This assessment often involves computing BI values, which can be translated into five ecological quality classes ranging from "very good" to "very bad". BI values can be calculated using benthic macroinvertebrate data or through metabarcoding data obtained from high-throughput amplicon sequencing of eDNA. The former method is time-consuming and requires extensive taxonomic expertise, while the latter relies on reference databases, limiting its applicability to sequences that have known taxonomic or ecological annotations.

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

Recent studies have proposed an alternative approach that uses supervised machine learning (SML) to generate predictive models for BI values or EQ classes directly from eDNA data. The first study by Cordier et al., 2017 in this category tested two SML approaches to predict BI values by focusing on specific taxonomic groups, using benthic foraminifera as features to infer four commonly used BI values for benthic monitoring (AMBI, ISI, NSI, and NQI1). Their results demonstrated that SML approaches could provide accurate BI predictions, reducing or even eliminating the time and cost constraints associated with morphology-based assessments. In a follow-up study (Cordier et al., 2018), the same authors trained Random Forest (RF) models using five different genetic markers—eukaryotic markers (V1V2, V4, and V9), ribosomal bacterial markers (V3V4), and foraminifera markers (37F) to evaluate how predictive accuracy varies across markers. Their findings indicated that all tested markers produced reliable predictive models, outperforming conventional taxonomic classification approaches. Additionally, the study suggested that the predictive performance of the 37F marker was slightly lower than that of the eukaryotic and bacterial markers, confirming that biomonitoring models perform better when a broader taxonomic spectrum is used as features.

27

28

29

30

More recently, Braikia et al., 2024, introduced a simplified approach to predicting EQ, demonstrating that directly predicting EQ classes yielded better results than focusing on individual BI values. This finding reinforces the growing recognition of ML's potential in biomonitoring, particularly for EQ assessment.

31

32

33

34

35

36

However, none of the previously mentioned studies have examined how environmental conditions contribute to ecological quality. Building on Braikia et al., 2024's work, this study integrates model explainability to explore the influence of environmental variables, the role of diversity, and how ML algorithms capture these relationships. Feature importance methods quantify each variable's contribution to predictions, with global methods ranking features overall and local methods assessing their impact on specific cases.

37

38

39

40

41

We implement an explainable artificial intelligence (XAI) framework using microbiome data, metadata, and alpha diversity indices to enhance marine EQ predictions. Specifically, we apply SHapley Additive Explanations (SHAP) to identify key variables driving model decisions. By improving interpretability, this study strengthens the reliability and transparency of ML-based ecological assessments, facilitating better-informed marine monitoring efforts.
## 2. Background

42

43

### 2.1. Alpha Diversity Indices in Marine Microbiome Analysis

44

45

46

47

48

49

50

51

52

53

54

55

Biodiversity assessment depends on diversity metrics to quantify species richness and distribution. In marine ecology, these metrics, or indices, characterize microbial community composition under varying environmental conditions, offering insights into ecosystem health. Diversity indices are mathematical measures that summarize species-abundance distribution within a community as a single value, offering a snapshot of diversity and its fluctuations over time (Van Dam, 1982). The three primary diversity categories are Alpha Diversity (measure within-sample), Beta Diversity (measure between-sample), and Gamma Diversity (measure in landscape-level). Alpha diversity, one of the most widely used metrics for characterizing communities at a local scale, consists of two main components: species richness, which represents the number of different species, and equitability, which measures the uniformity of species abundances (Thukral, 2017).

56

57

58

59

**Species Richness (S)** quantifies species count but does not consider distribution. To address this, evenness indices are used.

60

61

62

63

We begin by introducing some notations that are used in the formulas of the indices introduced later on. Consider S as the species richness, and let $p_i = \frac{n_i}{N}$ the proportional abundance (or percentage abundance) of the i-th species present, where $n_i$ is the number of individuals for species i, and N is the total number of individuals counted, across all species.

**Shannon-Wiener Index (H)** (Shannon, 1948) quantifies alpha diversity by considering both species richness and evenness. A higher Shannon index suggests evenly distributed species, while lower values indicate the dominance of a few species (Thukral, 2017). It is computed as follows 1:

64

65

$$ (1) \qquad H = - \sum_{i=1}^{S} (p_i \cdot \log_2(p_i)) $$

**Pielou's Evenness Index (P)** (Pielou, 1966) measures species distribution independence from richness, making it useful for dominance comparisons (Thukral, 2017). It is given by 2:

66

67

$$ (2) \qquad P = \frac{H}{\log_2(S)} $$

Values range from 0 (one species dominates) to 1 (equal distribution).

68

69

**Simpson's Index (D)** (Simpson, 1949) estimates the probability that two randomly chosen individuals belong to the same species, giving more weight to abundant species (Thukral, 2017). It is defined as 3:

70

71

$$ (3) \qquad D = 1 - \sum_{i=1}^{S} (p_i^2) $$

72

73

Unlike the Shannon index, Simpson's Index is less sensitive to rare species, making it more suited for habitat comparisons.
72

## 2.2. Multivariate Analysis of Microbiome Data

73

74

75

76

77

Multivariate analysis refers to a collection of statistical techniques that examine three or more variables simultaneously, in order to identify or clarify the relationships between them. Unlike univariate analysis, which focuses on a single observation or variable, multivariate analysis acknowledges the complexity of real-world phenomena, where multiple factors influence outcomes (Hazra and Gogtay, 2017).

78

79

80

81

82

83

We may investigate individual measurements, in simple cases, using measures of location and dispersion, or explore relationships between two variables using bivariate analysis. However, most datasets involve numerous variables, and understanding the interrelationships between them requires a multivariate approach. This type of analysis is applicable to both metrical and categorical data, and offers a variety of methods to uncover meaningful patterns and associations (Bartholomew, 2010).

84

85

86

87

Using correlation and Canonical Correspondence Analysis, we will explore the relationships between environmental variables (metadata) and microbiome data, while SHAP will be used to examine the connection between ecological quality, environmental factors, microbiome, and diversity.

88

89

90

91

92

93

### 2.2.1. Correlation and Canonical Correspondence Analysis.
Correlation measures the strength and direction of the linear relationship between two variables, quantifying the extent to which they change together. While the linear relationship between each pair of independent variables in the metadata can be measured by correlation, a more insightful approach to explore the multivariate relationships between community composition and multiple explanatory environmental variables is Canonical Correspondence Analysis (CCA).

94

95

96

97

98

CCA is a multivariate analysis technique designed to relate community composition directly to environmental variation. It works by imposing the restriction that ordination axes be linear combinations of environmental variables, allowing community variation to be directly linked to environmental factors. The environmental variables can be either quantitative or nominal, and as many axes as there are environmental variables can be extracted (Braak, 1986).

99

100

101

102

103

104

105

106

107

CCA is particularly useful for analyzing data when species exhibit bell-shaped response curves to environmental gradients, making it more appropriate for examining the relationship between community composition and environmental variables than other methods like canonical correlation analysis. The technique produces an ordination diagram in which species and sites are represented as points, and environmental variables are shown as vectors. This diagram helps visualize the patterns of variation in community composition explained by environmental variables and identifies the "centers" of species distributions along each environmental gradient. CCA has been effectively applied to various ecological studies, such as hunting spiders, dyke vegetation, and algae along pollution gradients (Braak, 1986).

108

109

110

111

112

113

### 2.2.2. Explainability in Machine Learning and SHAP.
Understanding why a model makes a specific prediction is often just as important as how accurate that prediction is—especially in fields where interpretability matters. Complex models like ensemble methods or deep learning can perform very well with large datasets, but they're often difficult to understand. This creates a tension between achieving the highest performance and maintaining a model that users can understand. In response to this issue, various methods have been proposed to help interpret the predictions
114 of complex models. However, it is often unclear how these methods relate to one another and
115 in which contexts one method may be more suitable than another (Lundberg and Lee, 2017).

116 To address this challenge, SHapley Additive Explanations (SHAP) (Lundberg and Lee, 2017)
117 was introduced as a unified framework for interpreting model predictions. SHAP assigns an im-
118 portance value to each feature based on its contribution to the model's output. This method
119 is grounded in cooperative game theory and introduces a novel class of additive feature impor-
120 tance measures, which is theoretically proven to have desirable properties. These properties
121 unify several existing methods and ensure that SHAP provides both global and local interpre-
122 tations of model behavior. SHAP's distinctive advantage lies in its ability to provide consistent,
123 interpretable feature importance, while also offering computational efficiency compared to ear-
124 lier approaches (Lundberg and Lee, 2017).

125 In this study, we apply SHAP to explain the predictions of the Random Forest (RF) (Breiman,
126 2001) model, which is an ensemble method that constructs multiple decision trees through boot-
127 strapping and random feature selection. RF predictions are made by averaging (for regression)
128 or majority voting (for classification) across the trees. SHAP is used to assess the influence of op-
129 erational taxonomic units (OTUs), metadata, and diversity indices on EQ predictions. This helps
130 make our machine learning models more transparent, offering clearer insights into how different
131 factors—like environmental conditions and microbial diversity—affect ecological assessments.

132

3. Material and Data Analysis

133

**3.1. Material**

134

In this study, we analyze five datasets that are publicly available on zenodo<fnref n="1" /> from Cordier et al., 2018 study, corresponding to five genetic markers used in marine biodiversity research: Eukaryotic markers (V1V2, V4, and V9), Ribosomal bacterial marker (V3V4) and Foraminifera marker (37F). The dataset is divided into two types. The first type includes metadata files that list the sample names along with four BIs, namely AMBI, ISI, NSI, and NQI1. Other columns in these metadata files contain environmental data, such as sampling location, station, grab, distance from the farming cage, depth, and pH. The second type consists of five files, each representing an OTU-sample matrix for a different marker. These files contain the sample names and the corresponding abundance of each OTU in those samples. This data serves as the basis for analyzing the relationships between OTU abundance and environmental factors.

135

136

137

138

139

140

141

142

143

144

The pipeline code of this study is available on zenodo<fnref n="2" />.

145

**3.2. Alpha diversity Analysis**

146

147

148

149

To better understand the microbial community structure across the five datasets (V1V2, V3V4, V4, 37F, V9), we conducted alpha diversity analyzes. The results for each dataset are visualized in Figure 1, which provides a comparative box plot highlighting the variation of the alpha diversity indices.

150

151

152

153

*   **Species Richness**: The species richness box plots reveal significant differences in the number of species detected by each marker. The medians of V1V2 and V3V4 are close, both below 1000, reflecting a moderate number of species captured in these datasets. In contrast, the V4 dataset has an even lower median, below 500, indicating a reduced

<footnote n="1">¹DOI:10.5281/zenodo.1286476</footnote>

<footnote n="2">²DOI:10.5281/zenodo.15238612</footnote>
<figure><img src="image_2.png" /><figcaption>Figure 1 – Box Plot Comparison of Alpha Diversity Indices Across Datasets.</figcaption></figure>

species richness, while 37F shows the lowest median overall, highlighting its limited capacity to capture species. On the other hand, V9 stands out with the highest median, ranging between 2000 and 2500, suggesting that this marker captured the most species. Outliers are visible in the V3V4 and V9 datasets, indicating some extreme values outside the typical range.

When examining the interquartile range (IQR), V9 shows the largest IQR, reflecting the greatest variability in species richness across its samples. The other datasets display more similar IQRs, indicating a more consistent distribution of richness values. The whiskers further clarify the spread: V1V2 has balanced, moderately long whiskers, while V3V4 and V9 show longer lower whiskers, suggesting a wider range of lower values. In contrast, V4 and 37F have longer upper whiskers, indicating greater variation in higher richness values. These trends are consistent across the box plots and highlight key differences in species richness captured by each marker.

* **Shannon Index:** The Shannon index, which accounts for both species richness and evenness, reveals a relatively consistent pattern across the datasets. Among them, V3V4 stands out with the highest median value, suggesting it captures the greatest overall species diversity. This dataset also includes a notable outlier, indicating the presence of an exceptionally low diversity value.

V1V2 displays whiskers of roughly equal length, with a median close to those of V4 and 37F, implying a similar central tendency in diversity across these three markers. The V4 dataset, with a median just below 3, has the widest IQR, reflecting greater variability
in diversity among its samples. The lower half of the box is longer, indicating more spread in samples with lower diversity.

Likewise, 37F exhibits a longer lower whisker than the upper one, highlighting greater variability at the lower end of its diversity distribution. As for V9, it has a higher median than V1V2, V4, and 37F, and shows a longer lower whisker as well—again pointing to more dispersion in samples with lower diversity scores.

* **Simpson Index**: The Simpson index, which emphasizes dominance and evenness in species distribution, supports earlier observations. V9 and V3V4 show values very close to 1, suggesting a highly even distribution with no dominant species. V3V4 has the highest median and an extremely small IQR, indicating both high evenness and low variability across samples. In contrast, V4 displays the lowest median and the largest box, with a longer lower half, pointing to lower evenness and greater variation among samples—suggesting that some species may dominate.

V1V2 and 37F have close medians, indicating comparable diversity levels. The IQR is particularly narrow for V3V4, showing consistent values across its samples. Most datasets contain outliers. The longer lower whiskers in V1V2, 37F, and V9 suggest greater dispersion among the samples with lower diversity scores.

* **Pielou's Index**: Finally, Pielou's evenness index shows that V3V4 has the highest evenness values and median, reflecting a uniform distribution of species across its samples. In contrast, V1V2 and V4 exhibit the lowest evenness and the greatest variability, suggesting a more uneven distribution where certain species may dominate.

As with the other indices, V4 displays a large box, with the lower portion being larger, indicating more variation in samples with low evenness. 37F and V9 have similar medians and show longer lower whiskers, reflecting greater variability among samples with lower evenness values.

### 3.3. Multivariate Analysis

**3.3.1. Exploring Relationships Among Environmental Condition Variables.** We start to explore the relationship between environmental variables and BIs. To achieve this, we use the metadata table, which includes columns such as Sample Names, Locality, Station, Grab, Distance from the Cage, Depth, pH, AMBI, NSI, ISI, and NQI1. To ensure clarity and relevance in our analysis, we first removed any columns that did not contribute to our research objectives. We also addressed any null values to maintain the integrity of the dataset. We then calculated the correlation between each environmental variable and each BI.

We calculated the correlation between each environmental variable and each BI. The heatmap in Figure 2 shows a strong correlation between Distance Cage and the four BIs, with coefficients exceeding 0.7 (a negative correlation with AMBI and positive correlations with the others). Additionally, there is a relatively strong correlation between Depth and the four BIs, with coefficients above 0.5, while the correlation between pH and the four BIs is weaker, with coefficients above 0.4. The corresponding p-values shown in table 1 for all Pearson tests are very small, indicating that these correlations are statistically significant.

**3.3.2. Canonical Correspondence Analysis of Environmental Variables and Ecological Quality.** To further explore the relationship between environmental variables and EQ, we applied CCA. This analysis was performed using three environmental variables including pH, distance from the
<figure><img src="image_3.png" /><figcaption>Figure 2 - Heatmap showing correlations between environmental variables and BIs.</figcaption></figure>

<table><caption>Table 1 - P-values of Pearson correlation tests between environmental variables and ecological quality indices (BIs).</caption><thead><tr><th>Variable</th><th>AMBI</th><th>NSI</th><th>ISI</th><th>NQI1</th></tr></thead><tbody><tr><td>Distance from Cage</td><td>4.176e-26</td><td>9.462e-23</td><td>1.912e-20</td><td>1.850e-22</td></tr><tr><td>Depth</td><td>2.037e-10</td><td>3.929e-13</td><td>1.258e-15</td><td>2.934e-10</td></tr><tr><td>pH</td><td>1.594e-07</td><td>2.253e-06</td><td>3.012e-04</td><td>7.948e-09</td></tr></tbody></table>

cage, and depth. We then visualized the results by projecting the samples onto a 2D space defined by the first two axes of the CCA (Figure 3). To examine how EQ is distributed, the samples were color-coded according to their EQ classes derived from AMBI values, allowing us to assess the influence of environmental factors on ecological status.

The resulting plot revealed that the samples grouped primarily by their EQ classification, with clear clusters. The arrows representing the environmental variables showed the direction of influence for each factor. Notably, pH, distance from the cage, and depth all demonstrated a clear relationship with the samples' ecological quality. The arrows for pH and depth point toward areas with higher ecological quality, indicating that higher pH levels and deeper sampling depths are associated with better EQ status. In contrast, the distance-from-cage variable shows a negative relationship: samples located closer to the cage tend to have lower ecological quality. These patterns suggest that environmental conditions like higher pH and greater depth may support healthier ecosystems, while proximity to aquaculture structures could be linked to ecological degradation.

These results from the CCA reinforce the conclusions drawn from the correlation analysis, highlighting the importance of environmental variables in influencing marine ecosystem health and providing a visual representation of how these factors contribute to variations in ecological quality across samples.
<figure><img src="image_4.png" /></figure>

<figure><img src="image_5.png" /></figure>

<figure><img src="image_6.png" /></figure>

<figure><img src="image_7.png" /></figure>

<figure><img src="image_8.png" /><figcaption>Figure 3 – Canonical Correspondence Analysis plot ordination plots for five datasets.</figcaption></figure>

236
237
238
239

3.3.3. *Results and Explainability.* In order to explore the relationships between explanatory vari-
ables—diversity, environmental variables, microbiome data—and the explained variable, ecolog-
ical quality, we implemented an SML pipeline that takes the explanatory variables as input to
predict the explained variable.
This pipeline is organized into three steps. First, the data in OTU tables, along with their metadata, are preprocessed to generate the training/testing datasets. The OTU tables were normalized using the Trimmed Mean of M-values (TMM) method, then reduced using Singular Value Decomposition (SVD) to five dimensions to address the issue of the curse of dimensionality (a high number of features relative to the number of samples) and avoid overfitting. As in Braikia et al., 2024, SVD and TMM proved to be the best approach for these data. The number of components to retain for SVD is determined by maximizing both the variance between features and the accuracy of the RF model while using the minimum number of components possible.

For the environmental variables, we retained "Distance from cage", "Depth", and "pH", which were scaled using "StandardScaler()" python function. As for the explained variable, following Braikia et al., 2024, we kept the AMBI index, which was converted into EQ classes.

The second phase is the learning step. We trained our RF model, with 200 trees, on three tasks: (1) OTU data extended with metadata and diversity indices, (2) metadata only, and (3) diversity indices only. These RF models are used to generate predicted EQ classes for each sample in the test set.

The third step quantifies the contribution of all explanatory variables in EQ predictions using SHAP values and RF feature importance. The objective is to determine whether richness, evenness, metadata, or community composition shifts play a more significant role in ecosystem health.

The models are evaluated using the kappa statistic, and the results are presented in Table 2 for each dataset. This table first presents results from the literature, specifically those of Cordier et al., 2018 and Braikia et al., 2024, respectively, followed by our results for extended data, metadata, and diversity data. The best results are highlighted in bold.

Cordier et al. first predicted AMBI values, then converted them into EQ classes before calculating the Kappa score to assess the agreement between predicted and reference EQ classes. Unlike our approach, they did not apply dimensionality reduction. Braikia et al., on the other hand, directly predicted EQ classes using only normalized and reduced OTU tables (non extended data).

Our results indicate that the effect of adding metadata and diversity indices varies across markers. For V3V4 and V4 markers, our approach outperforms Braikia et al.'s results. When compared to Cordier et al., our method surpasses their results for the V1V2, V4 and 37F markers. These findings suggest that the contribution of metadata and diversity indices depends on the specific marker, affecting the predictive power of the models in different ways.

Upon further analysis, we observe that predictions based solely on metadata perform relatively well. This suggests that the environmental or contextual information captured in the metadata is valuable for predicting ecological quality. On the other hand, predictions using only diversity indices show bad performance, indicating that diversity alone may not provide sufficient information to accurately assess ecological quality.

To verify these hypotheses and better understand the role of metadata and diversity indices in the prediction of EQ, we analyzed feature importance using both RF and SHAP values. The feature importance histograms, first generated by the RF model and then by the SHAP method for each dataset, are displayed in Figure 4.

The order of feature importance is generally consistent between RF and SHAP, except for some of the least important attributes. Otherwise, the ranking of important features remains similar across all markers. We note that the most influential features for markers V1V2, V3V4,
<table><caption>Table 2 – Kappa results comparison</caption><thead><tr><th>Markers</th><th>Literature Kappa</th><th>Non extended data</th><th>Extended data</th><th>Meta data</th><th>Diveristy data</th></tr></thead><tbody><tr><td>V1V2</td><td>0.866</td><td><strong>0.956</strong></td><td>0.889</td><td>0.889</td><td>0.389</td></tr><tr><td>V3V4</td><td><strong>0.918</strong></td><td>0.834</td><td>0.863</td><td>0.713</td><td>0.514</td></tr><tr><td>V4</td><td>0.877</td><td>0.916</td><td><strong>0.928</strong></td><td>0.893</td><td>0.552</td></tr><tr><td>37F</td><td>0.832</td><td><strong>0.889</strong></td><td>0.859</td><td>0.816</td><td>0.771</td></tr><tr><td>V9</td><td><strong>0.927</strong></td><td>0.881</td><td>0.837</td><td>0.836</td><td>0.468</td></tr></tbody></table>

V4, and V9 include OTU attributes (reduced) and the meta-variable "Distance to the cage.", and that the diversity indices contribute minimally to the prediction of EQ. In particular, for V1V2, diversity indices do not significantly explain ecological quality, a result confirmed by the kappa value when testing predictions using only diversity data (table 2).

However, the case of 37F stands out. According to both SHAP and the feature importance scores from RF, diversity indices play a much more significant role in explaining EQ compared to OTU data. This finding suggests that, for 37F, diversity indices may be more informative than OTU-based features in predicting EQ.

As demonstrated in our results, the performance of V4 was enhanced by integrating environmental variables and diversity measures, followed by V1V2, which showed the second-best results. To further explore the impact of each variable and identify key drivers of good and poor ecological quality, we analyzed SHAP values for the "Very Good" and "Very Bad" classes in both datasets (Figure 5).

Focusing on the five most influential variables, we observe that in V1V2, high values of environmental variables strongly drive the classifier toward good quality. Similarly, the reduced OTU components 2 and 1 exhibit a pattern where low values contribute to good quality, whereas OTU component 4 has the opposite effect (Figure 5 (a)). Conversely, for the Very Bad class (Figure 5 (b)), SHAP values confirm these trends: high values of depth and distance from the cage push the classifier towards bad quality, while pH appears to have a mitigating influence.

For V4, a similar trend is observed. The five most important variables (Figure 5 (c)(d)) include environmental factors and reduced OTU components. As in V1V2, higher values of distance from the cage are associated with good ecological quality, whereas lower values tend to indicate poorer quality.

These findings highlight the strong influence of environmental parameters and microbial diversity on ecological quality classification, reinforcing the relevance of integrating these variables into predictive models.

## 4. Conclusion

The goal of this study was to examine the contribution of environmental, diversity, and microbiome variables in predicting EQ. We assessed this by evaluating an RF model on these data and, to verify and understand the model's predictions, we used SHAP.

We developed an explainable ML framework for predicting marine EQ from eDNA metabarcoding data. Our pipeline, based on SVD and RF, was tested across five genetic markers (V1V2, V3V4, V4, 37F, and V9), and we evaluated the model on three tasks: (1) OTU data extended with
<figure><img src="image_9.png" /><figcaption>RF Feature importance for V1V2</figcaption></figure>

<figure><img src="image_10.png" /><figcaption>RF Feature importance for V3V4</figcaption></figure>

<figure><img src="image_11.png" /><figcaption>RF Feature importance for V4</figcaption></figure>

<figure><img src="image_12.png" /><figcaption>RF Feature importance for 37F</figcaption></figure>

<figure><img src="image_13.png" /><figcaption>RF Feature importance for V9</figcaption></figure>

<figure><img src="image_14.png" /><figcaption>SHAP Feature Importance for V1V2</figcaption></figure>

<figure><img src="image_15.png" /><figcaption>SHAP Feature Importance for V3V4</figcaption></figure>

<figure><img src="image_16.png" /><figcaption>SHAP Feature Importance for V4</figcaption></figure>

<figure><img src="image_17.png" /><figcaption>SHAP Feature Importance for 37F</figcaption></figure>

<figure><img src="image_18.png" /><figcaption>SHAP Feature Importance for V9</figcaption></figure>

**Figure 4** – Random Forest and SHAP Feature Importance in EQ Prediction Across Five Datasets (V1V2, V3V4, V4, 37F, and V9). The numbers in the x-axis represent the reduced OTU data.
<figure><img src="image_19.png" /><figcaption>**Figure 5** – Feature Impact on predicting "Good" and "Very Bad" classes (Datasets V1V2 & V4) according to SHAP: Environmental variables (Depth, pH, Distance from Cage) and OTU reduced to 5D.</figcaption></figure>

metadata and diversity indices, (2) metadata only, and (3) diversity indices only. For the environmental variables, we retained "Distance from cage," "Depth," and "pH," while for diversity indices, we calculated richness, Shannon, Simpson, and Pielou. We then applied SHAP to measure the contribution of different features to the model's predictions.

The results showed that predictive performance varied by genetic marker, with OTU-based features consistently being the most important. The contribution of metadata was significant, while diversity indices showed mediocre performance, differing substantially across datasets. These additional features improved EQ predictions for V1V2, V3V4 and V4, had minimal impact on V9, and negatively affected the predictions for 37F.

SHAP and RF feature importance analyses confirmed these trends, revealing that OTUs and metadata—particularly distance from the cage—played a dominant role in EQ predictions, except for 37F, where diversity indices were more informative.
329
330
331

These findings emphasize that the predictive power of metadata and diversity indices is marker-dependent, highlighting the need for marker-specific feature selection strategies in future studies.

332

## Acknowledgements

333
334

We would like to thank the organizers and scientific committee of JOBIM 2025 for the opportunity to present our work and for facilitating the connection with PCI Genomics.

335
336

We gratefully acknowledge the reviewers and the recommender for their time and valuable feedback, which helped improve the quality of this manuscript.

337
338

Preprint version [to be updated] of this article has been peer-reviewed and recommended by Peer Community In Genomics.

339
340

Authors declare that in this paper, artificial intelligence tools were used to assist with language correction and editing.

341

## Fundings

342

The authors declare that they have received no specific funding for this study.

343

## Conflict of interest disclosure

344
345

The authors declare that they comply with the PCI rule of having no financial conflicts of interest in relation to the content of the article.

346

## Data, script, code, and supplementary information availability

347
348
349

Data from Cordier et al., 2018 are available online (DOI:10.5281/zenodo.1286476); Our script and codes are available online (DOI:10.5281/zenodo.15238612).

350

## References

351
352
353
354
355

Bartholomew D (2010). Analysis and Interpretation of Multivariate Data. In: *International Encyclopedia of Education (Third Edition)*. Ed. by Penelope Peterson, Eva Baker, and Barry McGaw. Third Edition. Oxford: Elsevier, pp. 12–17. https://doi.org/https://doi.org/10.1016/B978-0-08-044894-7.01303-8. URL: https://www.sciencedirect.com/science/article/pii/B9780080448947013038.

356
357
358
359
360

ter Braak CJF (1986). Canonical Correspondence Analysis: A New Eigenvector Technique for Multivariate Direct Gradient Analysis. *Ecology* **67**, 1167–1179. https://doi.org/https://doi.org/10.2307/1938672. eprint: https://esajournals.onlinelibrary.wiley.com/doi/pdf/10.2307/1938672. URL: https://esajournals.onlinelibrary.wiley.com/doi/abs/10.2307/1938672.

361
362
363

Braikia H, Ben Hamida S, Rukoz M (2024). Random Forest Classifier for Marine Biodiversity Analysis. In: *2024 International Conference on Intelligent Systems and Computer Vision (ISCV)*, pp. 1–8. https://doi.org/10.1109/ISCV60512.2024.10620111.

364
365

Breiman L (2001). Random Forests. *Mach. Learn.* **45**, 5–32. https://doi.org/10.1023/A:1010933404324. URL: https://doi.org/10.1023/A:1010933404324.
366

367

368

369

Cordier T, Esling P, Lejzerowicz F, Visco J, Ouadahi A, Martins C, Cedhagen T, Pawlowski J (2017). Predicting the ecological quality status of marine environments from eDNA metabarcoding data using supervised machine learning. *Environmental Science and Technology* **51**, https://doi.org/10.1021/acs.est.7b01518.

370

371

372

373

Cordier T, Forster D, Dufresne Y, Martins CIM, Stoeck T, Pawlowski J (2018). Supervised machine learning outperforms taxonomy-based environmental DNA metabarcoding applied to biomonitoring. *Molecular Ecology Resources* **18**, 1381-1391. https://doi.org/10.1111/1755-0998.12926.

374

375

376

Hazra A, Gogtay N (2017). Biostatistics Series Module 10: Brief Overview of Multivariate Methods. *Indian Journal of Dermatology* **62**, 358-366. https://doi.org/10.4103/ijd.IJD_296_17.

377

378

379

Lundberg SM, Lee SI (2017). A unified approach to interpreting model predictions. In: *Proceedings of the 31st International Conference on Neural Information Processing Systems*. NIPS'17. Long Beach, California, USA: Curran Associates Inc., pp. 4768-4777.

380

381

382

383

Pielou E (1966). The measurement of diversity in different types of biological collections. *Journal of Theoretical Biology* **13**, 131-144. https://doi.org/10.1016/0022-5193(66)90013-0. URL: https://www.sciencedirect.com/science/article/pii/0022519366900130.

384

385

Shannon CE (1948). A mathematical theory of communication. *The Bell System Technical Journal* **27**, 379-423. https://doi.org/10.1002/j.1538-7305.1948.tb01338.x.

386

387

Simpson EH (1949). Measurement of Diversity. *Nature* **163**, 688-688. https://doi.org/10.1038/163688a0. URL: https://doi.org/10.1038/163688a0.

388

389

Thukral A (2017). A review on measurement of Alpha diversity in biology. *Agricultural Research Journal* **54**, 1. https://doi.org/10.5958/2395-146X.2017.00001.1.

390

391

Van Dam H (1982). On the use of measures of structure and diversity in applied diatom ecology. *Hydrobiological Bulletin* **16**, 288-292. https://doi.org/10.1007/BF02255385.