A modeling approach for estimating hydrogen sulfide solubility in fifteen different imidazole-based ionic liquids

Absorption has always been an attractive process for removing hydrogen sulfide (H2S). Posing unique properties and promising removal capacity, ionic liquids (ILs) are potential media for H2S capture. Engineering design of such absorption process needs accurate measurements or reliable estimation of the H2S solubility in ILs. Since experimental measurements are time-consuming and expensive, this study utilizes machine learning methods to monitor H2S solubility in fifteen various ILs accurately. Six robust machine learning methods, including adaptive neuro-fuzzy inference system, least-squares support vector machine (LS-SVM), radial basis function, cascade, multilayer perceptron, and generalized regression neural networks, are implemented/compared. A vast experimental databank comprising 792 datasets was utilized. Temperature, pressure, acentric factor, critical pressure, and critical temperature of investigated ILs are the affecting parameters of our models. Sensitivity and statistical error analysis were utilized to assess the performance and accuracy of the proposed models. The calculated solubility data and the derived models were validated using seven statistical criteria. The obtained results showed that the LS-SVM accurately predicts H2S solubility in ILs and possesses R2, RMSE, MSE, RRSE, RAE, MAE, and AARD of 0.99798, 0.01079, 0.00012, 6.35%, 4.35%, 0.0060, and 4.03, respectively. It was found that the H2S solubility adversely relates to the temperature and directly depends on the pressure. Furthermore, the combination of OMIM+ and Tf2N-, i.e., [OMIM][Tf2N] ionic liquid, is the best choice for H2S capture among the investigated absorbents. The H2S solubility in this ionic liquid can reach more than 0.8 in terms of mole fraction.

In the recent century, the need for fossil fuels has risen due to the high levels of energy required for the rapid industrialization of the world 1 . The extraction of oil and gas from underground fields and their combustion for generating heat/energy 2 has undesired environmental effect 3 and is accompanied by the production of large amounts of undesired pollutants [4][5][6] , mainly carbon monoxide (CO) 7 , carbon dioxide (CO 2 ) 8,9 , sulfur dioxide (SO 2 ) 10 , and hydrogen sulfide (H 2 S) 11,12 . The most widely used method for removing these gases is absorption 13 . The absorption processes can help humans meet environmental standards and attenuate the global warming issue 14 . Nowadays, the absorption process using alkanolamine-based solvent is one of the most developed and industrially interesting approaches 15 . However, the loss of mono-ethanolamine, diethanolamine, N-methyldiethanolamine, and di-isopropanol amine creates environmental problems, and they have also produced some highly corrosive byproducts 16,17 . As an alternative and promising approach, scientists have investigated ionic liquids (ILs) [18][19][20] . Ionic liquids are comprised of cations and anions and have an asymmetric organic cation structure, which results in being liquid at room temperature 21 . Ionic liquids possess outstanding thermal stability and a superior ability to solve organic and non-organic problems 18,19 . These features are highly attributed to their cation and anion particles. Cations and anions of ionic liquids can be easily modified to make them suitable for many specific applications 19 . Furthermore, having an insignificant vapor pressure, ILs have been considered promising candidates for sweetening processes with the minimum environmental effect and solvent loss 22 . A central factor that must be appraised in gas sweetening processes is the solubility of gases in liquids under various dominated operational conditions 23,24 . Although many references in the literature have calculated or experimentally obtained Adaptive neuro-fuzzy inference system. A combination of ANN with fuzzy logic will result in the emergence of ANFIS systems. Typically, two common structures for FIS approaches exist: (a) Mamdani et al. and (b) Takagi-Sugeno 36,49 . What is specific about Mamdani et al. method 50 is that a list of if-then rules must be defined for the fuzzy inference system, while the fussy interface proposed by Takagi-Sugeno creates its own rules based on the intrinsic features of the provided experimental data to the modeling endeavor. If the output data is nonlinearly dependent on the input data, Takagi-Sugeno ANFIS method will be more useful. Five distinct layers are a typical architecture for the ANFIS structure 51 . The Fuzzification layer is the first layer in which the conversion of inputted data into linguistic data occurs. The fuzzification process will be done utilizing the defined membership functions. The second layer is used for the model validation by computing a range of parameters known as the firing strengths. The estimated firing strengths are normalized in the next layer, and the fourth layer is responsible for representing outputs' linguistic terms. Ultimately, all rules attributed to any individual output are combined in the fifth layer 50 .
Least square-support vector machine. As a robust method for pattern recognition 52 and regression 53 , the LS-SVM is a widely-used and well-developed method. The SVM formulates the function as is given in Eq. (4).
where the output layer's transposed vector is denoted by w T , the kernel function and bias are given as φ(x) and b, respectively 54,55 . The size of the input data set and the output ensemble are the determining factors for the SVM's dimension. The parameters of w and b are then determined by the cost function, given in Eq. (5) 54 .
The reliable results are possible to achieve by minimizing the cost function considering the following constraints 54 : (4) Radial basis function neural network. RBF neural networks are robust predicting methods that use a simpler structure in comparison to MLP networks, the learning step in them is much faster than the MLP's learning procedure 56 . Like major artificial neural networks, RBF has three layers: the input layer, the interior layers, and the result layer. The radial basis function is applied to the nodes of hidden layers. Using a linear optimization mechanism, the RBFNN will return precise results when the least mean square error is achieved. Despite all existing similarities between MLPNN and the RBFNN structures, RBFNN utilizes a complex RBF function for hidden layers 36 .
Cascade fee-forward neural network. The implemented CFFNN in this study could be contemplated as a type of feedforward neural network where the input neurons are connected to all neurons located in the following layers 57,58 . A range of various learning algorithms is applied to CFFNN models. As one of the most general formulations, the gradient descent algorithm with the momentum is introduced as follows 59 : where the weight of neurons is denoted by w , the learning pace is shown by α, and bias and the number of training steps are given by b and i, respectively. In these formulations, the momentum parameter is presented by µ , and the deviation of outputs from the modeling target is represented by γ 60 . Although the updating algorithm for weight factors (given in Eq. 4) is precise, it is just applicable to a small ensemble of data. The weights updating formulation with two terms (i.e., the formulation without γ e s ) is a better choice for modeling of large-scale databanks. Equation (8) shows that the cost function is defined by summation of the square error.
where the target and the output patterns are shown by t p and o p . The training procedure will not stop unless a pre-defined desirable sum of square errors is obtained 61 .
Generalized regression neural network. In utilizing the GRNN predictive method, there is no need for an iterative training process 13 . Instead, between the output and input vectors, any possible arbitrary functions are approximated. In addition to that, this approach is consistent because as larger datasets are fed to the model, the model return more precise results 62 . Such as the problems solved by the standard regression methods, the GRNN model is also suitable for predicting variables that are intrinsically continuous 62 . According to the definition of this method, the best and most accurate result for a dependent variable (y) will be obtained when an independent variable x and the training dataset are given, and the model commences minimizing the mean-squared error for the given x data points 62 .  Table 1). The range of operating conditions, i.e., pressure (P) and temperature (T), ionic liquid inherent characteristics, i.e., critical pressure (P c ), critical temperature (T c ), and the acentric factor (ω) are listed in Tables 1 and 2. The range of absorbed hydrogen sulfide by different ionic liquids as the dependent variable is also reported in Table 1. Indeed, these variables are enough to derive a global model for determining the amount of captured H 2 S in ILs. The gathered data points were divided into two main subsets, including training (85% of the datasets) and testing (15% of the datasets). These groups have been used in a systematic trial-and-error procedure to find the optimal configuration of the model structures and evaluate their performances.

Experimental data acquisition and preliminary analysis
Outlier detection. Outliers are typically an inevitable part of every dataset; therefore, eliminating outliers is extremely important for good quality and reliable modeling. Outliers can drastically plummet the model's accuracy and robustness. The current study reaps the outstanding rewards of utilizing a combination of Leverage and the Hat matrix methods according to the below equation 68 : Statistical criteria for model assessment. Once the models are developed, the accuracy can be evaluated by various statistical approaches to determine their robustness. In the current investigation, the following criteria were utilized for assessing models' accuracy 70,71 :  www.nature.com/scientificreports/ In these equations, employed for statistical evaluation of the results, y i,exp. and y i,pred. show the experimentally measured and the predicted H 2 S solubilities, respectively. The notation y is the average value of y i,exp. , and N stands for the number of data points.

Result and discussion
Development phase. All considered machine learning mthods [72][73][74] have some parameters that need to be tuned using historical data of a given problem and an optimization algorithm 75 . This research utilizes 792 experimental data of H 2 S solubility in fifteen ILs versus pressure, temperature, acentric factor, critical pressure, and temperature. The collected databank was randomly split into 673 training and 119 testing datasets.
In the training stage, a machine learning method receives the numerical values of independent as well as dependent variables, while its parameters are unknown [76][77][78] . The intelligent model estimates the H 2 S solubilities from the available independent variables. The deviation between these estimated values and actual H 2 S solubilities are then needed to be minimized by an optimization algorithm. Indeed, the optimization algorithm continuously updates the parameters of a machine learning method to converge to this minimum value.
In the testing stage, a trained machine learning method receives the independent variables only and calculates the H 2 S solubility helping the adjusted parameters. The independent variables and machine learning parameters are known in the testing stage, while the dependent variables are unknown.
The accuracy of all machine learning methods in the training and testing stages has been monitored using different statistical indices [i.e., Eqs. (11)(12)(13)(14)(15)(16)(17)]. Then, it is possible to find the best model using the ranking analysis. Figure 1 represents a general flowchart for model development in the present study. Table 3 shows the complete information about the applied trial-and-error procedure during model development. This table shows the numbers of hidden neurons for the MLPNN, CFFNN, and RBFNN, spread factor for the RBFNN and GRNN, cluster radius for the ANFIS, and kernel type for the LS-SVM model is the deciding features in the trial-and-error analyses. Table 3 also presents the cumulative numbers of the developed model for each machine learning class. Generally, 740 models are developed in this study. Assessment phase. Statistical analyses. After the model development phase, monitoring their accuracy in the training and testing stages employing various statistical criteria is necessary. In this way, it is possible to find the most accurate model in each class using the ranking analysis. The prediction uncertainty of the most precise model in each category in terms of seven statistical criteria is summarized in Table 4. This table states that the cluster radius of 0.5 and Gaussian kernel are the best features for the ANFIS and LS-SVM paradigms. Furthermore, nine, six, and nine hidden neurons are the best topologies of the MLPNN, CFNN, and RBFNN models. The best spread factor for the RBFNN and GRNN models are 3.1579 and 0.00210, respectively. As this table shows, almost all intelligent models are sufficiently robust for estimating hydrogen sulfide solubility in various ionic liquid media. All models show the R 2 values greater than 0.99, apart from RBFNN.
Graphical inspection. Different graphical inspections, such as cross-plot and distribution of residual errors, were performed to illustrate the efficiency of the developed models and compare their performances. Figure 2 shows the cross plots of all the implemented approaches and confirms an excellent agreement between experi-   www.nature.com/scientificreports/ mental and predicted mole fractions of H 2 S in ILs due to the concentrated accumulation of the training and testing data around the unit slope line. In addition, the relative deviation of the investigated models from experimental data is depicted in Fig. 3. The error distribution provides a suitable visual comparison between the models' performances. In this figure, LS-SVM, MLPNN, CFFNN, and ANFIS have small scattering to anticipate H 2 S solubility in various ILs, while the relative deviation of the training and testing data points for GRNN and RBFNN models exceed 40%. These findings confirm the obtained results in Table 4.
Ranking analysis. The six models were selected before, and their accuracy in the training and testing stages and over the whole of the database was monitored using seven statistical matrices. It is hard to most accurate one through visual inspection. Therefore, the ranking analysis is employed to do so 40 . Figure 4 provides the results  Table 4. The GRNN model in the learning step is the best model; nevertheless, it shows the worst performance in the testing stage. This sharp contrast between the learning ability and the testing results indicates the overfitting of the GRNN model. On the other hand, the LS-SVM with the second-ranking in the training stage and the first ranks for the testing stage and over the whole database is the best model for predicting H 2 S solubility in ionic liquid media. According to the results of Fig. 4, the developed predictive models can be summarily ranked in terms of their accuracy as follows: LS-SVM > MLPNN > ANFIS > CFFNN > GRNN > RBFNN. As mentioned earlier, the LS-SVM approach was selected as the best model. In order to better describe the excellent performance of the LS-SVM model, its residual errors (RE) versus the frequency are plotted in Fig. 6. Histograms related to the training, testing, and all data points reveal that the maximum frequency could be seen around residual errors of zero, and virtually all data points are predicted with − 0.05 < RE < + 0.05.     Relevancy analysis. As stated earlier, the best model was determined LS-SVM with the input parameters, including pressure, temperature, acentric factor, and critical pressure and temperature. In order to study the influence of input parameters on the dissolved mole fraction of H 2 S in ionic liquids, the relevancy factor was utilized 89 . This relevancy factor ( r i ) is defined for all independent variables (i) as follows 90 : where M i,k ,M,n , N k , and N represent input parameters, an average of inputs, number of the data points, output parameter, and average of output, respectively. The value of r i is located within − 1 to 1, and the large values correspond to the strong correlation. Also, the increasing or decreasing of output parameter with variations in M i attribute to a positive or negative sign, respectively. Two main techniques, namely Spearman and Pearson 91 , relevancy factors were calculated to ascertain the reliability of the interrelation of the considered independent variables with the H 2 S solubility as the model's output. According to the results of both methods (Fig. 8), pressure and temperature have the most significant roles in this process, while the acentric factor has the lowest effect. Moreover, it was found that the H 2 S solubility adversely relates to the temperature and critical pressure of the ionic liquids. Generally, by increasing the pressure, critical temperature, and the acentric factor of ionic liquids, more H 2 S is expected to be captured.

Trend analysis of the LS-SVM.
Besides being precise, the developed LS-SVM approach should be able to detect the physical trend of the simulated phenomenon. For doing so, the LS-SVM predictions for H 2 S solubility in ionic liquids in various temperatures and pressures were compared to the experimentally measured data.
The effect of temperature and pressure. Figure 9 illustrates the solubility of hydrogen sulfide in  6 ] by increasing the operating pressure. However, the H 2 S solubility in the ionic liquid dramatically decreases as temperature increases. The enhancing effect of pressure is related to the fact that the pressure pushes the H 2 S molecules into the liquid phase 92 . Furthermore, this enhancement is more significant in lower pressure. Increasing the kinetic and internal energy of the hydrogen sulfide molecules by increasing the temperature may be responsible for this observation 92 . Furthermore, dissolving H 2 S in liquid is an exothermic process. When this gas dissolves in ILs, its molecules interact with ionic liquid molecules and release heat within attractive interaction. Conversely, increasing temperature by  www.nature.com/scientificreports/ adding heat to the solution provides thermal energy that overcomes the attractive forces between the gas and the liquid molecules, thereby decreasing the solubility of the gas. The outstanding performance of LS-SVM for predicting the profile and all distinct data points can be concluded from this figure. Indeed, the proposed LS-SVM model successfully understands the influence of operating pressure and temperature on the hydrogen sulfide solubility in the ionic liquid.
The effect of cation and anion type. Assessing the effects of both anions and cations leads to a deep perception of the behavior of H 2 S solubility in ILs. It is generally found that anions have more influence on the solubility of H 2 S gas than cations 93 As illustrated in Figs. 10a  This originates because the longer alkyl chain provides more free volume available in ILs. Aki et al. 94 ascribed this behavior to entropic rather than enthalpic reasons, where the molar density of the ILs decreases as the length of the cation alkyl chain gets larger 95 . As the molar density of the IL decreases, the free volume of the IL enhances the absorption of H 2 S to occur through a space-filling mechanism 96 . Consequently, larger free volumes increase H 2 S solubility by stronger Van der Waals interactions and more H 2 S molecules absorbed in the solvent 23 . The above-mentioned trend is an outcome of the variations in molecular interactions of H 2 S with ionic liquids, which arise from the differences in the chemical constituents, shapes, and sizes of ILs. In addition, H 2 S solubility for ILs with similar [EMIM] + but different types of anions was investigated. It was found that higher H 2 S solubility obtains in anions containing more fluorine content ([TF 2    Application range of the constructed LS-SVM model. Table 1 shows that the H 2 S solubility data utilized to develop the LS-SVM model are only about imidazole-based ionic liquids containing F atoms. Therefore, this intelligent approach is only valid for the utilized ionic liquids in the reported pressure and temperature ranges. On the other hand, many different non-F functionalized ionic liquids have also been utilized for H 2 S absorption. It is possible to collect a databank for H 2 S solubility in non-F functionalized ionic liquids (or for both F functionalized and non-F functionalized ionic liquids), develop different machine learning methods, compare their accuracy, and find the most accurate model.

Conclusion
The absorption process is likely the most widely used method for H 2 S removal. Untapped potentials and favorable characteristics of ionic liquids have been enticing for scientists to investigate their H 2 S removal capacity. However, experimental endeavors are not only costly but time-consuming. On the other hand, since there are many affecting parameters and the interactions between IL and H 2 S molecules are complex, accurate results cannot be achieved by the equations of state. Fortunately, AI methods can bypass theoretical equations and    www.nature.com/scientificreports/ solve complicated problems expeditiously and accurately. The current study investigated H 2 S solubility in fifteen ILs by implementing six robust AI methods, including MLPNN, LS-SVM, ANFIS, RBFNN, CFFNN, and GRNN. The temperature, pressure, acentric factor, critical pressure, and critical temperature of investigated ILs are influential variables of the current study. The validation of the derived models was approved using seven statistical criteria. It was found that the LS-SVM was the best predictive model having R 2 , RMSE, MSE, RRSE, RAE, MAE, and AARD of 0.99798, 0.01079, 0.00012, 6.35%, 4.35%, 0.0060, and 4.03%, respectively. It was found that temperature and the critical pressure of the liquid are adversely related to the H 2 S solubility. However, the pressure, critical temperature, and acentric factor of ionic liquids increase H 2 S dissolution in ionic liquids. The outlier detection method justified that a relatively substantial number of data points are valid and have enough quality to be incorporated into the modeling procedure. Finally, the maximum hydrogen solubility of ~ 0.8 is achievable by [OMIM][Tf 2 N] ionic liquid at the highest pressure and lowest temperature.

Data availability
A user-friendly and straightforward Matlab-based code has been prepared to use by other research groups (please see Supplementary Information: supplementary_file\Matlab_code). The collected experimental databank has been added to the revised manuscript (please see Supplementary Information: supplementary_file\Database).

Standardized residuals
Valid data Suspect data Warning Leverage Upper suspect limit, 3% Cut off Lower suspect limit, -3% Cut off Figure 13. Outlier/valid data detection by the Leverage method.