Abstract
Hydrogen production through the dark fermentation pathway offers an energy recovery alternative via wastewater utilization. The study hybridizes experimental and machine-learning investigations to model and optimize the hydrogen yield through seven major operational variables. Four regression models-one each of Support Vector Machine, Decision Tree, Random Forest, and Neural Network are developed and evaluated through rigorous preprocessing and hyperparameter tuning. The Random Forest turned out to be the best-performing model, offering an R2 of 0.8006 and an accuracy of 0.9171. A differential evolution algorithm was then employed, ranging over the input parameters, to search for the optimum conditions, with the predicted maximum hydrogen yield set at 0.9361 (L H2/L media/hr). These findings establish the application of Machine Learning (ML) in predicting and establishing the optimum conditions for bio-hydrogen production, thus providing a scalable platform for the environmental recovery of energy from wastewater treatment processes.
1 Introduction
Energy production from renewable sources, as opposed to fossil fuel-based energy sources, is attracting significant attention worldwide to fulfill international climate protection agreements. This occurs due to its generation of only minimal greenhouse gas (GHG) emissions, thereby contributing to the stand toward climate change driven by fossil fuel consumption (). In categorizing several renewable energy sources like wind and solar energy, which are influenced by factors such as the presence of sun and intensity or speed, or direction of the wind, hydrogen comes out feeling worthy over the others. Its use comes with the potential to reduce heavy reliance on non-renewable energy sources, which are imported and majorly represented by fossil oils such as crude oil. In addition to its various applications, including propellant fuel, fuel cells, agriculture, and refining, hydrogen has been developed as a significant secondary energy source and an essential energy carrier (). Furthermore, the variability inherent in many renewable energy sources presents a significant drawback, potentially resulting in temporary discrepancies between demand and supply. Consequently, transforming surplus energy into hydrogen presents a viable solution to address this energy deficit (Zivar et al., 2021).
Hydrogen is increasingly acknowledged globally as an exceptional energy solution and a promising fuel source, providing carbon-free alternatives. A variety of domestic resources are available for the production of clean hydrogen, including nuclear power, natural gas, coal gasification, and renewable energy sources like solar, wind, biomass, geothermal, and hydro (; ; ; ; ; Wang et al., 2017). Hydrogen production can be divided into three main categories: green, when it is derived from renewable sources; purple, when nuclear energy technology is used; and blue, from coal and natural gas integrated with the technology of carbon capture and storage (CCS).
The most efficient and cost-effective way of producing biohydrogen is via dark fermentation, making it extremely attractive as a research area (). Environmental factors like temperature and pH, as well as the microbial community structure, can influence the dark fermentation process (Ziara et al., 2019). However, the process control of biohydrogen production is challenged by the diversity and variability of substrates and complex microbial interactions for multiple substrates; thus, it becomes difficult to identify the impact of operational parameters and community proportions on bioreactor performance (). ML algorithms can analyze datasets generated from bioreactors to find patterns and correlations among the various process variables. This data can help improve the process for biohydrogen production, such as altering different process parameters, including temperature, pH, and nutrient concentrations, thereby leading to an increase in yield and efficiency (). In addition, ML algorithms are used to develop predictive models for biohydrogen production, to identify the optimal conditions for biohydrogen production, and to optimize the process accordingly (). It is the newest and most practical subset of AI models to be applied in energy systems (). Although the trend of increasing applications of ML in hydrogen-related technologies is taking hold, less attention is being paid to the exploration of ML in the context of hydrogen production technologies from dark fermentations. In filling those gaps, this study developed and compared various ML-regression models (Random Forest, SVR, and ANN) for the prediction of bio-hydrogen yield while using differential evolution optimization to infer operating conditions for maximum yield. Specifically, this work uniquely integrates experimental data from a regional wastewater treatment plant in Oman with carefully curated literature data from equivalent experimental conditions, and applies Differential Evolution in reverse mode to identify optimal operational parameters. With this, one would expect robust insights based on data that can stand in for both scientific knowledge and industrial-scale process design; thus, furthering the interface between biological hydrogen production and ML.
It was clearly demonstrated that the Operational parameters have a significant impact on the performance of anaerobic digestion processes. Results shows that mesophilic conditions are typically maintained between 35 °C and 37 °C, OLR typically ranges from 1 to 6 g VSāCOD Lā1 dayā1, HRT for co-digestion processes is typically operated between 10 and 20 days, and VS and COD removal efficiency can reach up to 90% under optimised co-digestion conditions (Tufaner and AvÅar, 2016). Biohydrogen production through dark fermentation was reported in a recent comprehensive study. The study examined the key process parameters affecting hydrogen yield, including substrate type, microorganism selection, and fermentation conditions such as pH, temperature, and hydraulic retention time, and additionally modelled the process using ASPEN Plus simulation. This review confirms that these parameters represent the most relevant input variables for data-driven modelling approaches such as the one pursued in the present study ().
The foundational proof that ANN successfully works for complex anaerobic processes was demonstrated by modelling biogas production from cattle manure and organic waste co-digestion in a laboratory-scale UASB reactor, using ten process input variables such as pH, alkalinity, COD, HRT, and waste type, achieving R2 = 0.89 in training. This work led to the establishment of the viability of neural networks for complex anaerobic bioprocess prediction (Tufaner et al., 2017). The ANN approach was extended from conventional digesters to hybrid reactor configurations, showing ANN generalises across different anaerobic system designs. ANN and nonlinear regression models were applied to predict biogas production rate from an anaerobic hybrid reactor (AHR) filled with perlite, treating synthetic wastewater across organic loading rates of 5ā15 kg COD/m3/day and hydraulic retention times of 12ā48 h under mesophilic conditions (37 °C) with ten input variables including reactor fill ratio, influent/effluent pH, alkalinity, OLR, effluent COD, TSS, VSS, further confirming the superiority of ANN over conventional regression approaches in capturing the nonlinear dynamics of anaerobic systems across all loading conditions in predicting biogas production rate (Tufaner and Demirci, 2020). This line of work was advanced most recently by applying ANN and Adaptive Neuro-Fuzzy Inference System (ANFIS) to model biogas production in a combined microbial electrolysis cell-anaerobic digestion (MECAD) system, a novel hybrid electrochemical-biological configuration that demonstrates AI-based models can accurately predict performance in novel and complex hybrid anaerobic configurations (Tufaner et al., 2025). These studies provide a clear understanding of AI modelling capability in anaerobic processes, from conventional digestion to hybrid electrochemical-biological systems. This directly motivates the extension of AI modelling to dark fermentative biohydrogen production, which is the scope of this study. Recent research has focused specifically on ML for biohydrogen production based on this broader foundation. Researchers highlight the growing role of explainable AI (XAI) in understanding complex bioprocess interactions by demonstrating that gradient boosting algorithms, specifically CatBoost and BagXGBoost, outperformed conventional ML models in predicting dark fermentation biohydrogen production from wastewater, with CatBoost achieving an R2 of 0.98. Shapley Additive Explanations (SHAP) was employed to identify COD, nickel, and butyrate as the most influential process parameters (). Particularly relevant to this study, the critical challenge of limited experimental data was addressed in proposing a Generative Adversarial Network (GAN)-inspired augmentation strategy to expand a dark fermentation dataset from 210 to 1,050 synthetic samples, enabling a Histogram-based Gradient Boosting (HGB) model to achieve an R2 of approximately 0.95, substantially higher than training models on the original dataset alone (). The prediction of biohydrogen yields from dark fermentation across different feedstock types, including organic waste biomass and wastewater, was demonstrated using ML models whether neural networks or ensemble methods (). An ANN was coupled with a Genetic Algorithm (ANN-GA) to optimise dark fermentation of food waste hydrolysate using Clostridium pasteurianum to predict the optimum process conditions of (pH = 6.7, temperature = 36.8 °C) that produced the optimum yield of 1,108 mL/L biohydrogen. These results outperformed the RSM optimization and confirmed a higher maximum production rate under AI-optimized conditions via the Modified Gompertz model (). This approach mirrors the ML-plus-optimization pipeline adopted in the present study, where a Random Forest model is coupled with Differential Evolution to identify optimal operational parameters. Research also confirmed the established practice in environmental ML applications, where comparing LR, ANN, SVM and Decision Trees (DT) algorithms for Palmer Drought Severity Index estimation from meteorological data demonstrated that ANN achieved the best performance with R = 0.98. This confirms that comparative evaluation across multiple ML algorithms is effective for complex environmental prediction tasks, which is consistent with the comparative multi-model evaluation approach adopted in the present study (Tufaner et al., 2020).
1.1 Goals and objectives of the research
This paper presents a logical comprehension of ML algorithms such as; SVM, RF, DT, and NN for the prediction of bio-hydrogen yield production. Moreover, it demonstrates knowledge about the algorithmās proficiency in modelling. The challenges encountered during the experiment of hydrogen production were overcome by leveraging ML, along with the methodology and development of all algorithms, with their performance. Next, it presents the results and the conclusion. The last section of the paper covers used references and citations.
Objectives of this research:
To investigate the best ML model to be used for bio-hydrogen gas production from different wastewater streams based on experimental findings.
Optimize the performance of each model.
Optimization of process conditions towards maximizing bio-hydrogen yield production using ML.
2 Methods
2.1 Experimental design and investigation of bio-hydrogen production
The centerpiece of the hydrogen production experiments in the study is to determine the effect of an absorber and batch reactor on the production of hydrogen gas. With the reactor, bio-hydrogen gas was produced in the experiment using a mixture of 50% of the sludge and 50% treated water. The bioreactor was a 1-L glass vessel equipped with a magnetic stirrer for agitation control, maintained at anaerobic conditions through continuous nitrogen sparging. The reactor cover was for dark fermentation conditions, which meant no light or other energy sources from glucose were employed in the experiment.
The selected STP in Oman was taken as a case study in this research. Various locations in the STP exist for sampling and analysis of water: using sampling before treatment, after the MBR treatment, and again after chlorination disinfection, and these three locations can be employed for sampling purposes (). The complete experimental design setup is presented in Figure 1.
FIGURE 1
2.2 Machine learning (ML)
The present study developed various ML models, which are Support Vector Machine (SVM), Decision Tree (DT), Random Forest (RF), and Neural Network (NN) algorithms, to predict the production of bio-hydrogen based on other parameters that directly influence the production, such as temperature, pH, treated effluent, sludge, medium volume, hydraulic retention time (HRT), and agitation. A dataset was compiled through experimental works and peer-reviewed scientific papers. Table 1 demonstrates a sample of records and features of the dataset. The dataset comprises 80 records; each record contains 7 features as inputs, specifically temperature, pH, treated effluent, sludge, medium volume, hydraulic retention time (HRT), agitation, and H2 as outputs. Figure 2 outlines the main stages involved in the implementation of ML models.
TABLE 1
| Data number | Input | Output | ||||||
|---|---|---|---|---|---|---|---|---|
| Temperature (°C) | pH | Treated effluent (mL) | Sludge (mL) | Medium volume (mL) | HRT (hours) | Agitation (rpm) | H2 (L H2/L media/hr) | |
| n1 | 37 | 7.31 | 100 | 0 | 60 | 44 | 100 | 0.225 |
| n2 | 45 | 7.39 | 100 | 0 | 60 | 144 | 150 | 0.62 |
| . | . | . | . | . | . | . | . | . |
| . | . | . | . | . | . | . | . | . |
| n80 | 35 | 5.5 | 55.56 | 44.44 | 100 | 24 | 100 | 2.91 |
A sample of the dataset.
FIGURE 2
2.2.1 Supervised machine learning algorithms
ML employs programmed algorithms that learn and enhance their operations through studying input data to predict the outputs within a valid range. These algorithms tend to develop more precise predictions with the input of new data. Whereas there are variations in how to classify the algorithms of machine learning, they can be classified into three main categories based on the method the core machine is being instructed. These three primary categories are unsupervised, supervised, and semi-supervised.
As part of supervised machine learning algorithms, a labelled training dataset is utilised to train the algorithm. Following that, the trained algorithm is then inputted into the unlabelled test dataset to classify them into groups of similar characteristics. Figure 3 shows an illustration of the main process of the supervised learning algorithm implemented in this study. Supervised learning algorithms align well with two problem classes: regression problems and classification problems. This study deals with a regression problem with a corresponding output of a real value, such as the prediction of bio-hydrogen yields from a fermentation process. In the following subheadings, the commonly applied supervised machine learning algorithms for bio-hydrogen yield prediction are elaborated.
FIGURE 3
2.2.1.1 Support Vector Machine (SVM)
Support Vector Machine (SVM) is a powerful algorithm capable of handling both linear and non-linear data. It converts all data points into an n-dimensional feature space, where n is the number of features. The algorithm then identifies hyperplanes that separate data items with maximum marginal separation distance for both classes and minimum total classification errors (Uddin et al., 2019). For regression tasks (Support Vector Regression), the algorithm finds a hyperplane that best fits the data while minimizing prediction errors. In this study, SVM was configured with a radial basis function (RBF) kernel (kernel = 'rbfā), regularization parameter C = 100, epsilon = 0.1, and gamma = 'scaleā to capture nonlinear relationships in the biohydrogen production data. As shown in Figure 4.
FIGURE 4
2.2.1.2 Decision tree (DT)
DT is a method of predictive modelling employed in AI. It is a hierarchical categorization scheme made up of a chain of if-else statements. Comprising several nodes, also referred to as leaves, as illustrated in Figure 5. Each leaf involved in DT is necessitated to undertake a test that lets a query enter the branches. The query will be iterated until it hits a terminal leaf. Each leaf node is associated with the value returned as the contribution of the tree. This must be done in order to develop the prediments of the tree from the ground, with the most important assumptions in priority. The process of growing a decision tree leverages the importance of individual variables and involves separating data using the most discriminative features, which results in simpler datasets. Question difficulty grows with answer string length and wanes with the removal of perfect accuracy nodes. Specifically, the end objective is to partition the data successively towards the creation of leaf nodes with the greatest class purity (). In this study, the Decision Tree was configured with max_depth = 10, min_samples_split = 2, and min_samples_leaf = 1 to balance model complexity and generalization capability.
FIGURE 5
2.2.1.3 Random forest (RF)
RF is a supervised method of regression that uses ensemble learning. An ensemble learning random forest is a bagging-type, not boosting-type, method. In a Random Forest, the trees are grown independently of each other and in parallel so that the construction of one tree neither influences nor interferes with that of another. It involves training a set of decision trees and then predicting the class corresponding to the mode of classes or the mean prediction associated with each tree (; ; Zhang et al., 2022). The RF method follows three main steps. It takes the training set and generates trained regression trees. The RF model in this study was configured with n_estimators = 100 (number of trees), max_depth = 15 (to prevent excessive overfitting), min_samples_split = 2, and min_samples_leaf = 1. These hyperparameters were selected to balance model complexity and computational efficiency while capturing complex nonlinear relationships in the biohydrogen production process.
2.2.1.4 Neural network (NN)
NNs are machine learning algorithms inspired by the workings of the neural networks of the human brain. In the biological brain, neurons are connected to one another through many axon junctions and, in this sense, can be viewed as a graph. The interconnections can be rewired (e.g., through neuroplasticity) in order to adapt and process information and store it. Similarly, NN algorithms can be viewed as an interconnected group of nodes, where a nodeās output becomes the input to another node for further processing, depending on the interconnections. Normally, nodes are grouped into something called a layer, depending on the kind of transformation they perform. In any NN configuration, aside from the input and output layers, there can be one or more intermediate or hidden layers. The nodes and edges have weights that can adjust the signal strength of communication; signal strength can be either amplified or weighted through a certain number of training iterations. Following the training and adaptation of the matrices, node weights, and edge weights, the NNs will be able to make a prediction for the test data (Uddin et al., 2019).
In this study, the Neural Network was configured as a Multi-Layer Perceptron (MLP) with the following architecture: input layer (7 neurons, one per feature), hidden layer 1 (64 neurons with ReLU activation), hidden layer 2 (32 neurons with ReLU activation), and output layer (1 neuron for hydrogen yield prediction). The model was trained using the Adam optimizer with adaptive learning rate, maximum 1,000 iterations, and early stopping enabled (validation_fraction = 0.1) to prevent overfitting on the limited dataset. This architecture was chosen to balance model capacity with the constraint of having only 80 training samples, following the empirical guideline that training dataset size should be 27ā31 times the number of trainable parameters for optimal generalization. The prediction of effluent color and COD from olive mill wastewater (OMW) treatment using natural grape molasses soil as a coagulant was reported using ANN models with five input variables of mixing time, mixing speed, amount of coagulant, effluent pH, and turbidity. The results proved that the proposed ANN performed well in predicting the effluent color and effluent COD with the use of natural grape molasses soil while avoiding economic and environmental sustainability problems (Tufaner, 2022).
2.2.2 Data source and data extraction
The dataset was compiled from experimental outcomes and extracted from scientific publications under equivalent conditions to verify the accuracy and validity of the data in preparation for subsequent modelling, comprising 80 data points and 7 features, including temperature, pH, treated effluent, sludge, medium volume, HRT, and agitation. The target of the modelling was bio-hydrogen production yields (H2). All data were normalized to consistent units (temperature in °C, volumes in mL, time in hours, agitation in rpm) before model training. The integration of experimental and literature data provides a comprehensive representation of biohydrogen production under diverse operational conditions while maintaining consistency through rigorous data curation procedures.
2.2.3 Data preprocessing
Prior to model development, a series of data preprocessing measures were implemented to enhance data quality and model performance.
Feature Selection and Nonlinear Relationship Analysis: Initial feature selection was performed using Pearson correlation analysis with a threshold of |r| > 0.2. However, recognizing that Pearson correlation captures only linear relationships, we complemented this analysis with Spearman rank correlation and Kendallās tau correlation to detect monotonic nonlinear relationships. Additionally, polynomial feature analysis (degree 2) was performed to identify quadratic relationships. Based on this comprehensive nonlinear analysis, all 7 input features were retained for model training, as even features with weak linear correlations (e.g., agitation, r = ā0.02) exhibited significant nonlinear interactions that the ML models could capture. This approach ensures that the models can discover complex patterns and interactions that may not be apparent from linear correlation analysis alone.
Train-Test Split: The dataset was divided into training (80%) and testing (20%) sets using stratified splitting with a fixed random seed (random_state = 42) to ensure reproducibility. This separation ensures that model evaluation is performed on independent data, guarding against overfitting and data leakage.
Data Normalization: For models sensitive to feature scaling (Support Vector Machine and Neural Network), z-score normalization (StandardScaler) was applied to transform features to have zero mean and unit variance. Tree-based models (Random Forest and Decision Tree) were not scaled, as they are inherently scale-invariant.
2.2.4 Training and testing of the model
In the context of assessing the performance of the ML models that have been developed, the data were split into two, training and testing, using the strategy of holdout validation. In particular, 80% of the data were used when constructing a model, including training, and 20% remained and was used for testing only. The stratified split was done using the train_test_split function from the scikit-learn library by fixing the random seed (random_state = 42) for the ease of getting the same results whenever the experiment is rerun.
All the models underwent training specifically on the training subset, and as a result, their performance was evaluated on an independent testing subset. The fact that these models were separate enabled the determination of how reliably the evaluation metrics were representative of the modelsā ability to generalise to unseen data, hence guarding from overfitting and leakage of data. Additionally, 5-fold cross-validation was performed on the entire dataset to provide robust generalization estimates. In cross-validation, the data is divided into 5 folds, and the model is trained 5 times, each time using a different fold as the test set and the remaining 4 folds as the training set. This procedure reduces variance in performance estimates and provides a more reliable assessment of model generalization capability.
2.2.5 Performance metrics for model evaluation
The implemented ML algorithms were evaluated within the context of this research by computing various performance metrics. These metrics present a variety of measures as to the accuracy of the models in classifying the target categories and are important when it comes to the comparison of various algorithms under the same evaluation settings. Results were found for the following metrics.
2.2.5.1 Mean absolute error (MAE)
The MAE is defined as the absolute difference between the actual and predicted values, as expressed in Equation 1. The objective is to minimise the mean absolute error (MAE), which is the sum of all errors divided by the total number of observations. The Mean Absolute Error (MAE) is defined as the absolute difference between actual and predicted values. It aims to minimise the MAE, which is the sum of the absolute differences between predictions and actual results divided by the total number of results. Mean absolute error, or MAE, possesses some merits, one of them being the direct proportionality it offers to the employment output against the loss and the description of the outliers. Nevertheless, the derivative of the MAE graph is discontinuous and poses an issue in areas of optimization that seek to minimise loss, such as gradient descent, which depends on differentiability ().where:
MAE = mean absolute error
n = number of data points.
= observed values
= predicted values
2.2.5.2 Mean squared error (MSE)
MSE is a widely used basic metric, displaying slight differences from MAE. The MSE is defined as the squared difference between the actual and predicted values, as expressed in Equation 2. MSE is a methodology that is employed to circumvent the cancellation of negative terms, and this is the advantage of MSE ().where:
MSE = mean squared error
n = number of data points.
= observed values
= predicted values
2.2.5.3 R-squared (R2)
R2 Score is a metric to assess the model performance that is unitless, as it always falls between 0 and 1. While MAE and MSE can establish the error, it is always expected that the higher the R2 value, the better the baseline model improves upon the comparison. R2 measures how well the regression line fits in relation to a mean line and is also known as the coefficient of determination or goodness of fit, as expressed in Equation 3 ().
2.2.5.4 Explained variance score (EVS)
EVS can be deduced as a performance measure in regression that stands for the coefficient of determination of the model. This coefficient determines how much variance in the target variable is predicted by the model predictions.
The primary focus of this approach is to assess the extent to which the variability of the data is explained, as opposed to penalising systematic biases or a lack of correlation between true and predicted values (VĆquez and Kuberski, 2024). The explained variance score is defined as shown in Equation 4.where:
Y = actual value.
= predicted values
The explained variance score ranges from negative infinity to 1, where 1 indicates the model explains all variability in the target variable.
Uncertainty Quantification: Bootstrap confidence intervals (95%) were calculated for all model predictions to quantify prediction uncertainty. This was performed by resampling the training data 100 times, training the model on each resample, and calculating the percentile-based confidence intervals from the distribution of predictions.
Residual Analysis: Residuals (prediction errors) were analyzed to assess model assumptions and identify systematic biases. Residual statistics (mean, standard deviation, minimum, maximum) were computed for each model to evaluate prediction consistency.
Sensitivity Analysis: One-at-a-time perturbation analysis was performed by varying each input feature by ±10% of its range while keeping other features constant. The resulting changes in predictions were quantified to assess feature importance and model robustness to input variations.
3 Results and discussion
3.1 Heatmap correlation analysis
This correlation map rather emphasizes the multivariate complexity of hydrogen production and the necessity of models able to capture these higher-order interactions among features. Figure 6 illustrates the feature correlation heatmap, showing the Pearson correlation coefficient between the outputs (bio-hydrogen yields) and the inputs. Medium volume (r = 0.31) and sludge (r = 0.30) showed strong positive correlations with hydrogen yield, showing the pivotal importance of microbial activity and hydrogen production efficiency. On the other hand, a weak or slightly negative correlation exists for Treated Effluent (r = ā0.09) and Hydraulic Retention Time (r = ā0.17), which could be interpreted as effects of dilution or over-processing in decreasing hydrogen availability. The temperature and pH showed a very weak direct correlation (r = ā0.07 and r = ā0.19, respectively), indicating possible non-linear or interaction effects and thus necessitating the use of nonlinear modelling approaches.
FIGURE 6
In contradiction, Agitation shows very low correlation (r = ā0.02), su ggesting limited direct influence, though it can perhaps enhance substrate contact or microbial activity under some conditions.
3.2 Model comparison and performance evaluation
A comparative analysis was performed among the di fferent ML algorithms using four performance evaluation measures: R2, MSE, RMSE, MAE, and EVS. The result is shown in Table 2.
TABLE 2
| Model | R2 | MSE | RMSE | MAE | EVS | Accuracy (%) |
|---|---|---|---|---|---|---|
| RF | 0.8006 | 0.0001 | 0.0102 | 0.0085 | 0.8163 | 91.7136 |
| DT | 0.7434 | 0.0001 | 0.0116 | 0.0107 | 0.825 | 90.6 |
| NN | 0.6684 | 0.0002 | 0.0132 | 0.0104 | 0.6694 | 89.3152 |
| SVM | 0.6359 | 0.0002 | 0.0138 | 0.0112 | 0.6905 | 88.8039 |
Performance evaluation.
Across all models tested, the Random Forest (RF) showed the strongest predictive capability, yielding an R2 score of 0.8006 on the test set, with MAE = 0.0085 and RMSE = 0.0102. The 5-fold cross-validation results (CV Mean R2 = 0.7845 ± 0.0456) confirm that the RF model generalizes well to unseen data, with relatively low variance across folds, indicating robust and reliable predictions. These findings align with previous research highlighting how RF has gained popularity for being robust to noise, delivering reasonable performance, and being easy to train (). From an ensemble perspective, this method averts overfitting by averaging predictions from multiple decision trees during predictions, which enhances the generalization capability.
The DT model closely followed with an R2 value of 0.743 and an accuracy of 90.6%, showing slightly higher error variance due to the ability of the model to capture the primary patterns that exist within the training data, but certainly showed limitations with regard to generalization compared to ensembled algorithms such as Random Forests.
The NN demonstrated moderate performance, with R2 being about 0.668 and accuracy being 89.3%. NNs tend to exhibit better prediction when trained on sufficiently large datasets. Empirical studies have suggested that the best results in generalization are obtained when the training dataset size is between 27 and 31 times that of the trainable parameters (weights) in the network (). This ratio shines a light on the fact that the model should be able to learn complex patterns but not overfit them, specifically in areas where there is very nonlinear behaviour interacting with features, like bio-hydrogen production.
On the other hand, the SVM recorded the lowest performance with R2 values of 0.636, an RMSE equal to 0.0139, and about 88.8% in terms of accuracy. Despite its applicability for energy and environment-prediction systems, SVM performance can be heavily dependent on the correct selection of kernels and tuning of parameters (Wu and Wang, 2009).
Therefore, these results collectively prove that RF methods are appropriate for such structured environmental datasets that come with noise, outliers, and multicollinearity.
3.3 Predicted versus actual yield comparison
Depicted in Figure 7 are actual versus predicted plots for a visual appraisal of model predictions. The prediction of the RF model (Figures 7A) is tightly clustered along a 45° reference line, indicating robust predictive capability alignment with the actual hydrogen yields. Therefore, corroborates the fact that the strong alignment reflects the modelās ability to generalize over the dataset with minimum bias and variance.
FIGURE 7
However, the DT model (Figures 7C) demonstrated somewhat acceptable performance, with a broader scatter due to the lack of averaging mechanisms acting in the ensemble models. The NN (Figure 7D) and SVM (Figure 7B) models deviated on a larger scale from the reference ideal line, implying that their relative accuracy is lower. Further, those deviations were more significant in the upper region of predicted values, indicating underestimation of high bio-hydrogen production scenarios.
Therefore, these results reinforce that RF as an algorithm provides not only better quantitative performance but also generally accurate predictions throughout the output range, granting this method the credibility to be considered appropriate for use in the prediction of bio-hydrogen production in complex systems.
3.4 Residual analysis and uncertainty quantification
Residual analysis was performed to assess the distribution of prediction errors and identify systematic biases. The residuals (actual minus predicted values) for all models exhibited approximately zero mean, indicating unbiased predictions. The standard deviation of residuals for the RF model was 0.0089, which is small relative to the target variable range (0.225ā2.91), confirming consistent prediction accuracy across the test set. The residual distributions for all developed models are shown in Figure 8.
FIGURE 8
Bootstrap confidence intervals (95%) were calculated for all model predictions. For the RF model, the average prediction uncertainty (standard deviation across bootstrap samples) was 0.0087, indicating that predictions are reliable with narrow confidence intervals. The 95% confidence interval range averaged [0.0045, 0.0129], demonstrating that the model provides precise predictions with quantifiable uncertainty bounds.
3.5 Sensitivity Analysis
One-at-a-time perturbation analysis was performed to assess the sensitivity of RF model predictions to variations in each input feature. Features were perturbed by ±10% of their range, and the resulting changes in predictions were quantified. The sensitivity results for all input features are presented in Figure 9. Results showed that Medium Volume had the highest sensitivity (0.0234), followed by Sludge (0.0198), indicating that these parameters have the greatest influence on hydrogen yield predictions. Temperature (0.0045) and pH (0.0038) showed lower direct sensitivity but likely exhibit important nonlinear interactions with other variables. Agitation showed minimal sensitivity (0.0012), suggesting limited direct influence on yield, though it may enhance substrate contact or microbial activity under specific conditions. These sensitivity results align with biological understanding of biohydrogen production, where substrate availability (medium volume and sludge concentration) is critical for microbial growth and hydrogen production.
FIGURE 9
3.6 Optimum parameters estimation to enhance hydrogen yield production
With Differential Evolution, the additional RF was queried in reverse mode to estimate input set combinations that would maximize hydrogen yield. The optimization was developed in the transformed feature space and mapped back to the original domain. Table 3 illustrates the optimum parameters for maximizing hydrogen yield production.
TABLE 3
| Parameter | Optimum value |
|---|---|
| Temperature (°C) | 55.69 |
| pH | 5.97 |
| Treated effluent (mL) | 45.15 |
| Sludge (mL) | 35.07 |
| Medium volume (mL) | 6217.71 |
| Hydraulic retention time (h) | 50.03 |
| Agitation (rpm) | 728.07 |
| Predicted hydrogen yield (L H2/L media/hr) | 0.9361 |
Optimum parameters estimation.
4 Conclusion
This study has brought together experimental bio-hydrogen production and machine learning-based modeling to maximize yield prediction and process optimization. Under dark fermentation conditions, the experimental setup using sludge and treated effluent created a rich dataset representing the nonlinear behavior of hydrogen production.
The application of ML models, mainly RF and ensemble methods, allowed accurate prediction of bio-hydrogen yield based on seven parameters affecting the process. Of all the models tested, RF gave the best prediction power, with an R2 score of 0.8006 and an estimated accuracy of 91.7136%. The model is fit to seek the complex interactions occurring in energy in biological systems.
Differential Evolution optimization of the RF model identified operational parameters predicted to maximize hydrogen yield to 0.9361 L H2/L media/hr. However, these optimized conditions require experimental validation at pilot or full scale before implementation, as some parameters (particularly agitation speed and medium volume) approach practical limits and may not be achievable without significant shear stress or reactor scaling.
Study Limitations: The primary limitation of this work is the relatively small dataset size (80 samples), which is inherent to the resource-intensive nature of biohydrogen production experiments. While robust validation techniques (5-fold cross-validation, early stopping, regularization) were employed to mitigate overfitting risks, the dataset size remains below the theoretical optimum for training neural networks. Additionally, the optimized parameters have not been experimentally validated, and the modelās predictions for extreme parameter combinations may not reflect real-world performance due to biological constraints not captured in the data.
Future Research Directions: (1) Expand the dataset by conducting additional experimental studies with diverse substrates, reactor configurations, and operational conditions to improve model robustness and enable training of more complex models. (2) Conduct pilot-scale or full-scale experimental validation of the ML-optimized operational parameters to confirm predicted hydrogen yields (3) Implement explainable AI techniques (e.g., SHAP values, LIME). to provide deeper mechanistic insights into how each feature influences hydrogen production. (4) Develop adaptive control systems that use the trained ML models for real-time process optimization in operational wastewater treatment plants. (5) Incorporate multi-objective optimization to simultaneously maximize hydrogen yield while minimizing energy input and operational costs.
To conclude, experimental methods integrated with ML and optimization techniques serve as one of the ways toward a more advanced production of hydrogen from waste-derived feedstock. Future work could focus on expanding the data, using explainable AI to gain deeper insights, and validating the optimized conditions in real-time pilot or full-scale settings.
Statements
Data availability statement
The original contributions presented in the study are included in the article/supplementary material, further inquiries can be directed to the corresponding authors.
Author contributions
HB: Investigation, Methodology, Supervision, Writing ā original draft. KA: Data curation, Formal Analysis, Funding acquisition, Investigation, Methodology, Writing ā original draft. SA: Formal Analysis, Methodology, Software, Writing ā review and editing. FH: Data curation, Formal Analysis, Writing ā review and editing. AA-H: Formal Analysis, Funding acquisition, Resources, Writing ā review and editing.
Funding
The author(s) declared that financial support was received for this work and/or its publication. The research leading to these results has received Internal funding from the German University of Technology in Oman under Seed Grant 2025 (SG2025/I/ENG/HB).
Acknowledgments
The authors would like to gratefully acknowledge the funding for the project provided by The German University of Technology in Oman under Seed Grant 2025 (SG2025/I/ENG/HB). The authors would like to express their gratitude to NAMA Water Services, Oman, for their support in data collection and the sampling process throughout the entire period of the project. Special thanks also go to GUtech for providing access to facilities, laboratories, and materials, which were instrumental in the completion of this project.
Conflict of interest
The author(s) declared that this work was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.
Generative AI statement
The author(s) declared that generative AI was not used in the creation of this manuscript.
Any alternative text (alt text) provided alongside figures in this article has been generated by Frontiers with the support of artificial intelligence and reasonable efforts have been made to ensure accuracy, including review by the authors wherever possible. If you identify any issues, please contact us.
Publisherās note
All claims expressed in this article are solely those of the authors and do not necessarily represent those of their affiliated organizations, or those of the publisher, the editors and the reviewers. Any product that may be evaluated in this article, or claim that may be made by its manufacturer, is not guaranteed or endorsed by the publisher.
References
1
Al-BassamA. M.ConnerJ. A.ManousiouthakisV. I. (2018). Natural-gas-derived hydrogen in the presence of carbon fuel taxes and concentrated solar power. ACS Sustain. Chem. Eng.6 (3), 3029ā3038. 10.1021/acssuschemeng.7b02745
2
AlagumalaiA.DevarajanB.SongH.WongwisesS.Ledesma-AmaroR.MahianO.et al (2023). Machine learning in biohydrogen production: a review. Biofuel Res. J.10 (2), 1844ā1858. 10.18331/BRJ2023.10.2.4
3
AlbuquerqueM. M.SartorG. de B.Martinez-BurgosW. J.ScapiniT.EdwigesT.SoccolC. R.et al (2024). Biohydrogen produced via dark fermentation: a review. Methane3 (3), 500ā532. 10.3390/methane3030029
4
AlwosheelA.van CranenburghS.ChorusC. G. (2018). Is your dataset big enough? Sample size requirements when using artificial neural networks for discrete choice analysis. J. Choice Model.28, 167ā182. 10.1016/j.jocm.2018.07.002
5
AnandA.MahataC.MoholkarV. S. (2024). Biohydrogen synthesis from food waste hydrolysate: optimization using statistical design of experiments (DoE) and artificial neural network (ANN). Biomass Bioenergy191, 107452. 10.1016/j.biombioe.2024.107452
6
BarghashH.AlRashdiZ.OkeduK. E.DesmondP. (2022). Life-cycle assessment study for bio-hydrogen gas production from sewage treatment plants using solar PVs. Energies15 (21), 8056. 10.3390/en15218056
7
BreimanL. (2001). Random forests. Mach. Learn.45, 5ā32. 10.1023/A:1010933404324
8
BriguglioN.AndaloroL.FerraroM.Di BlasiA.DispenzaG.MatteucciF.et al (2010). Renewable energy for hydrogen production and sustainable urban mobility. Int. J. Hydrogen Energy, 35(18), 9996ā10003. 10.1016/j.ijhydene.2009.09.065
9
DevasahayamS. (2023). Deep learning models in python for predicting hydrogen production: a comparative study. Energy280, 128088. 10.1016/j.energy.2023.128088
10
European Commission (2010). Energy 2020 A Strategy for Competitive, Sustainable and Secure Energy. EurelectricBrussels.
11
Fahimi BandpeyA.AbdiJ.FirozjaeeT. T. (2024). Improved estimation of dark fermentation biohydrogen production utilizing a robust categorical boosting machine-learning algorithm. Int. J. Hydrogen Energy52, 190ā199. 10.1016/j.ijhydene.2023.11.137
12
FarooqF.AminM. N.KhanK.SadiqM. R.JavedM. F.AslamF.et al (2020). A comparative study of random forest and genetic engineering programming for the prediction of compressive strength of high strength concrete (HSC). Appl. Sci. Switz.10 (20), 1ā18. 10.3390/app10207330
13
ForootanM. M.LarkiI.ZahediR.AhmadiA. (2022). Machine learning and deep learning in energy systems: a review. Sustain. Switz.14 (8), 4832. 10.3390/su14084832
14
KalinciY.HepbasliA.DincerI. (2009). Biomass-based hydrogen production: a review and analysis. Int. J. Hydrogen Energy34(21), 8799ā8817. 10.1016/j.ijhydene.2009.08.078
15
Kumar SharmaA.Kumar GhodkeP.GoyalN.NethajiS.ChenW. H. (2022). Machine learning technology in biohydrogen production from agriculture waste: recent advances and future perspectives. Bioresour. Technol.364, 128076. 10.1016/j.biortech.2022.128076
16
LiuC.LiF.BalasubramanianP. (2025). Augmented machine learning with limited data for hydrogen yield prediction in wastewater dark fermentation. Npj Clean. Water8, 101. 10.1038/s41545-025-00529-4
17
MokhtaraniB.ZanganehJ.MoghtaderiB. (2025). A review on biohydrogen production through dark fermentation, process parameters and simulation. Energies18 (5), 1092. 10.3390/en18051092
18
MontgomeryD. C.PeckE. Š.PeckE. Š. (2021). Introduction To Linear Regression Analysis. Wiley.
19
MuresanM.CormosC.-C.AgachiP.-S. (2013). Techno-economical assessment of coal and biomass gasification-based hydrogen production supply chain system. Chem. Eng. Res. Des.91(8), 1527ā1541. 10.1016/j.cherd.2013.02.018
20
NafeesA.KhanS.JavedM. F.AlrowaisR.MohamedA. M.MohamedA.et al (2022). Forecasting the mechanical properties of plastic concrete employing experimental data using machine learning algorithms: DT, MLPNN, SVM, and RF. Polymers14 (8), 1583. 10.3390/polym14081583
21
PandeyA. K.ParkJ.KoJ.JooH. H.RajT.SinghL. K.et al (2023). āMachine learning in fermentative biohydrogen production: advantages, challenges, and applications,ā in Bioresource Technology, 370. Elsevier Ltd. 10.1016/j.biortech.2022.128502
22
SantoshK. C.DasN.GhoshS. (2022). Chapter 2 - deep learning: a review. In SantoshK. C.DasN.GhoshS. (Eds.), Deep Learning Models for Medical Imaging (pp. 29ā63). Academic Press. 10.1016/B978-0-12-823504-1.00012-X
23
SeoS.-K.YunD.-Y.LeeC.-J. (2020). Design and optimization of a hydrogen supply chain using a centralized storage model. Appl. Energy, 262, 114452. 10.1016/j.apenergy.2019.114452
24
ShomopeI.TawalbehM.Al-OthmanA.AlmomaniF. (2025). Predicting biohydrogen production from dark fermentation of organic waste biomass using multilayer perceptron artificial neural network (MLPāANN). Comput. Chem. Eng.192, 108900. 10.1016/j.compchemeng.2024.108900
25
SiegelK. I. (2016). Incremental Random Forest Classifiers in Spark Signature Redacted. Cambridge, MA: Massachusetts Institute of Technology, Department of Electrical Engineering and Computer Science. Thesis: M. Eng. Available online at: http://hdl.handle.net/1721.1/106105 (Accessed January 15, 2026).
26
TaniT.SekiguchiN.SakaiM.OhtaD. (2000). Optimization of solar hydrogen systems based on hydrogen production cost. Sol. Energy, 68 (2), 143ā149. 10.1016/S0038-092X(99)00061-4
27
TufanerF. (2022). The use of artificial neural networks for modeling color and chemical oxygen demand removal from olive mill wastewater using grape molasses soil. Environ. Model. Assess.27, 855ā868. 10.1007/s10666-022-09852-3
28
TufanerF.AvÅarY. (2016). Effects of co-substrate on biogas production from cattle manure: a review. Int. J. Environ. Sci. Technol.13, 2303ā2312. 10.1007/s13762-016-1069-1
29
TufanerF.DemirciY. (2020). Prediction of biogas production rate from anaerobic hybrid reactor by artificial neural network and nonlinear regressions models. Clean Technol. Environ. Policy22, 713ā724. 10.1007/s10098-020-01816-z
30
TufanerF.AvÅarY.GƶnüllüM. T. (2017). Modeling of biogas production from cattle manure with co-digestion of different organic wastes using an artificial neural network. Clean Technol. Environ. Policy19, 2255ā2264. 10.1007/s10098-017-1413-2
31
TufanerF.ĆzbeyazA. (2020). Estimation and easy calculation of the palmer drought severity index from the meteorological data by using the advanced machine learning algorithms. Environ. Monit. Assess.192, 576. 10.1007/s10661-020-08539-0
32
TufanerF.DalkılıƧK.UÄurluA. (2025). Artificial intelligence-based modelling of biogas production in a combined microbial electrolysis cell-anaerobic digestion system using artificial neural networks and adaptive neuro-fuzzy inference system. Environ. Sci. Pollut. Res.32, 12524ā12546. 10.1007/s11356-025-36467-4
33
UddinS.KhanA.HossainM. E.MoniM. A. (2019). Comparing different supervised machine learning algorithms for disease prediction. BMC Med. Inf. Decis. Mak.19 (1), 281. 10.1186/s12911-019-1004-8
34
VĆquezS.KuberskiW. (2024). The little book of ML metrics.Available online at: https://www.nannyml.com/metrics (Accessed January 15, 2026).
35
WangF.DengS.ZhaoJ.WangJ.SunT.YanJ. (2017). Performance and economic assessments of integrating geothermal energy into coal-fired power plant with CO2 capture. Energy, 119, 278ā287. 10.1016/j.energy.2016.12.029
36
WuK. P.WangS.De. (2009). Choosing the kernel parameters for support vector machines by the inter-cluster distance in the feature space. Pattern Recognit.42 (5), 710ā717. 10.1016/j.patcog.2008.08.030
37
ZhangW.LiY.WuC.LiH.GohA. T. C.LiuH. (2022). Prediction of lining response for twin tunnels constructed in anisotropic clay using machine learning techniques. Undergr. Space (China)7 (1), 122ā133. 10.1016/j.undsp.2020.02.007
38
ZiaraR. M. M.MillerD. N.SubbiahJ.DvorakB. I. (2019). Lactate wastewater dark fermentation: the effect of temperature and initial pH on biohydrogen production and microbial community. Int. J. Hydrogen Energy44 (2), 661ā673. 10.1016/j.ijhydene.2018.11.045
39
ZivarD.KumarS.ForoozeshJ. (2021). Underground hydrogen storage: a comprehensive review. Int. J. Hydrogen Energy46 (45), 23436ā23462. 10.1016/j.ijhydene.2020.08.138
Summary
Keywords
dark fermentation, Decision Tree, hydrogen yield, machine learning, neural network, random forest, support vector machine
Citation
Barghash H, Al Mamari K, Al Araimi S, Hasoon FN and Al-Humairi A (2026) Machine learning based prediction and parameters optimization for biohydrogen gas production. Front. Energy Res. 14:1818122. doi: 10.3389/fenrg.2026.1818122
Received
26 February 2026
Revised
02 June 2026
Accepted
30 June 2026
Published
22 July 2026
Volume
14 - 2026
Edited by
Xiao-Yu Wu, University of Waterloo, Canada
Reviewed by
Fatih Tufaner, Adiyaman University, Türkiye
Anam Jalil, University of Chinese Academy of Sciences, China
Updates
Copyright
Ā© 2026 Barghash, Al Mamari, Al Araimi, Hasoon and Al-Humairi.
This is an open-access article distributed under the terms of the Creative Commons Attribution License (CC BY). The use, distribution or reproduction in other forums is permitted, provided the original author(s) and the copyright owner(s) are credited and that the original publication in this journal is cited, in accordance with accepted academic practice. No use, distribution or reproduction is permitted which does not comply with these terms.
*Correspondence: Hind Barghash, hind.barghash@gutech.edu.om; Feras N. Hasoon, ferasalattar@nu.edu.om
Disclaimer
All claims expressed in this article are solely those of the authors and do not necessarily represent those of their affiliated organizations, or those of the publisher, the editors and the reviewers. Any product that may be evaluated in this article or claim that may be made by its manufacturer is not guaranteed or endorsed by the publisher.