Introduction

Over the years, the increase in industrialization has adversely affected the environment. For example, excessive heavy metal levels get discharged into the atmosphere by releasing effluents from industries, leading to underground and open water bodies (Nwosu-obieogu et al. 2021, 2020a).

Toxic metals such as vanadium (V), chromium (Cr) depict as extremely dangerous even at trace levels on human health, animal, and plants. Furthermore, heavy metals pose a significant threat attributed to their capability of accumulating in human systems and their non-biodegradability; hence, developing activated carbon from agro-wastes for wastewater adsorption has proven to be an attractive and reliable method due to high efficiency, more economical, easy handling, cost-effectiveness and availability of biomass (Gebriesadik et al. 2017; Mojiri et al. 2017).

Luffa cylindrica belongs to the family Curcurbitaceae, grown across Asia, Latin America, Africa, an inedible plant, and cellulosic, hence a good choice for the adsorbent. (Saueprasea et al. 2010; Demir et al.2008).

Several researchers have reported adsorption using LAC to be effective in heavy metals removal from industrial effluents; thus, the removal of Pb2+ in water, removal of divalent metals, methylene blue dye, cyanide ions, cadmium ions, common laboratory dye and adsorption of brilliant green from aqueous solutions have been reported by Adewuyi and Pereira (2017), Oboh et al. (2011), Demir et al. (2008), Arana et al. (2017), Lindino et al. (2014), Calciedo et al. (2018) and Segun et al. (2014). Furthermore, Nwosu-obieogu et al. (2021) reported iron (II) adsorption from textile wastewater using LAC. Therefore, applying modelling in the adsorption process will enhance the relationship between parameters and responses, also, it can evaluate and forecast system behaviours (Oke et al. 2021).

Electro-Fenton technique, an advanced oxidation process, was applied in the removal of dimethyl phthalate from landfills leachate and the removal of 2,4-Dichlorophenoxyacetic acid (2,4-DPAA) from agricultural wastewater; response surface methodology (RSM) was employed to model and optimize the developed process for landfill leachate, the removal efficiency of 99.1% was obtained with optimal values of 4 mg/l of initial dimethyl phthalate concentration, 50 mM, Na2SO4, 600uL/l H2O2, 8 min electrolytic time, solution pH 3 and 6 mA cm−2 current density for the process variables. In another study, the removal rate of 99.2% was achieved at a solution pH of 3, the initial 2,4-DPAA concentration of 2.6 mg/l, H2O2 dosage of 470 μL/l, current density of 3.5 mA cm−2 and reaction time of 7.5 min for agricultural wastewater (Dolatabadi et al. 2021a, 2021b). Dolatabadi et al. 2021c et al. successfully removed acetamiprid from groundwater samples using pistachio shell-based modified activated carbon, the maximum removal efficiency of 98.6% was obtained at the optimal condition of the ATP concentration of 10 mg/l, solution pH of 6.5, the contact time of 23 min, and adsorbent dosage of 300 mg/l.

The use of soft computing techniques such as ANN and ANFIS is applied in modelling the relationship between the dependent and independent variables (Nwosu-Obieogu et al. 2020b; Ojediran et al.2020). ANN is a modelling approach based on the brain's neural structure; they are generally used to model and optimize a complex process. (Onoji et al. 2017; Sirohi et al. 2020; Rivera et al. 2010). Thus, it analyses complex variables to form deterministic equations (Kose 2008).

ANFIS combines ANN and fuzzy logic to predict the behaviour of variables, improve error tolerance, adaptiveness and speed of the process (Roy et al. 2019; Uzuner and Cekmecelloglu 2016; Nwosu-Obieogu et al. 2020b; Oke et al. 2020). Nevertheless, the determination of the optimum size of the model and the permanence in local minima has been the significant disadvantage of the ANN and ANFIS approach (Mehrabpour et al.2018; Onu et al.2021; Yaqub et al. 2020). Previous researchers have investigated the use of ANN and ANFIS in predicting the adsorption process: Dolatabadi et al. (2020) successfully indicated the removal efficiency of tetracycline from an aqueous solution using ANN and ANFIS. Souza et al. (2018) compared ANN and ANFIS in modelling nickel adsorption using agrowastes, and the models predicted the process efficiently. Nasir et al. 2017 modelled cadmium(II) biosorption using rice straw using ANN and ANFIS, and the models had an outstanding performance in predicting the removal efficiency.

Nevertheless, the literature has not reported soft computing prediction or a comparative study of ANN and ANFIS models for predicting heavy metal removal using LAC. Luffa cylindrica was chosen for the activated carbon preparation because it is an underutilized material that constitutes a menace to the environment; hence this work will add value to LAC; also, there has been sparse reports on the removal of vanadium(V) from textile wastewater. Therefore, this work bridges the existing gap in the literature by applying ANN and ANFIS in predicting chromium (VI), vanadium (V) and iron (II) removal from textile wastewater using LAC.

Materials and methods

Preparation of activated carbon

Luffa sponge was obtained from nearby bushes, washed with distilled water to remove the dust particles, sun-dried and further oven-dried at 100 °C for 24 h. After that, grounded and impregnated with sodium hydroxide solution (60%) and stirred vigorously using a magnetic stirrer at room temperature for 4 h. The mixture was filtered and oven-dried at 110 °C for 24 h. The dried sample was carbonized in a furnace for 4 h at 700 °C in the presence of nitrogen gas flowing at a heating rate of 10 °C/min. The activated carbon developed was screened to 100 µm micrometres, washed by pouring distilled water on the LAC until the pH of the filtrate reached 7. The activated carbon was dried in an oven at 110 °C for 4 h and cooled to room temperature.

Adsorbent characterization

For functional group determination, LAC was characterized using FTIR (PerkinElmer Spectrum one v3.02 FT-IR Spectrometer, India). The surface morphology was determined using scanning electron microscope SEM (HITACHI S-5500, Japan).

Batch adsorption studies

0.2 g of LAC was poured into 100 ml of the effluent in 250 cm3 Erlenmeyer flask, agitated at 100 rpm using a mechanical shaker for 10 min to attain equilibrium, then 10 ml of the solution was further centrifuged for 5 min at 4500 rpm; the filtrate was analysed to determine the concentrations of heavy metal using an Atomic Absorption Spectrophotometer (MODEL: AA-700).

ANN model development

Artificial neural network (ANN) modelling of the adsorption process was developed using the neural fitting toolbox of MATLAB R2014b (Mathworks Inc., Natick, MA, USA) as shown in Fig. 1. The architecture consists of an input layer (pH, time and adsorbent's dosage), an output layer (percentage removal efficiency) and a hidden layer. The data set obtained from the adsorption process was divided into (training, validation and testing) with 70%, 15% and 15%. To determine the best algorithm for the prediction, MSE and R2 were used as the statistical criteria to assess the algorithm's performance (Uzuner and Cekmecelloglu 2016; Masoudi et al. 2018; Nwosu-Obieogu et al. 2020b).

Fig. 1
figure 1

ANN structure

ANFIS model development

A multi-input single-output (MISO) fuzzy model was developed for percentage removal efficiency prediction for adsorption of heavy metal from textile wastewater using LAC by considering three input variables (pH, time and adsorbent’s dosage) and one output variable (percentage removal efficiency). The model's architecture is given in Fig. 2, which comprises five layers: fuzzification, product, rule, defuzzification and output summation layers using the Takagi–Sugeno fuzzy system (Rezakazemi et al. 2017; Ausati and Amanollahi 2016; Ojediran et al. 2020):

Fig. 2
figure 2

ANFIS structure

Performance evaluation of the developed models

The assessment of the model for the adsorption process prediction was determined using the statistical parameters presented as follows:

$$\left( {{\text{Mean }}\,{\text{square}}\,{\text{ error}}} \right)\,{\text{MSE}} = \frac{1}{P}\mathop \sum \limits_{p = 1}^{p} \left( {d_{p} - O_{p} } \right)^{2}$$
(1)
$$\left( {{\text{Correlation}}\,{\text{ coefficient}}} \right)\,R^{2} = 1 - \frac{{\mathop \sum \nolimits_{p = 1}^{p} \left( {d_{p} - O_{p} } \right)^{2} { }}}{{\mathop \sum \nolimits_{p = 1}^{p} \left( {O_{p} } \right)^{2} { }}}$$
(2)

\(d_{p}\) and op represent the desired and calculated outputs, respectively. The closeness of the MSE value to zero and the R2 value to one depicts the models' efficiency (Oke et al. 2018; Li et al. 2013).

Results and discussion

FTIR analysis

FT-IR spectrum of the LAC (before adsorption) in Fig. 3 shows that the broad peak at 3652.8 cm−1 is ascribed to the O−H group's stretching due to hydrogen bonding of alcohols or phenols. The peak at 1994.1 cm−1 is assigned to carbonyl stretching of the aldehydes. The peak at 2896.1 cm−1 was attributed to CH bond vibration stretching. The peaks at 1215.1 cm−1 are associated with the C=C stretching, which occurred due to aromatic bands. The intense peak at 879.7 cm−1 is attributed to the C−O stretching of alcohol, the band at 674.6 cm−1 indicates the C–I aromatic ring formation, the FT-IR spectrum suggests that the surface functional groups containing O2, which include the carboxyl groups and hydroxyl groups, influences the adsorption characteristics of LAC; the FT-IR spectra of the adsorbent after adsorption are presented in Fig. 4, the adsorption of the heavy metal ions caused the intensity of the broad bands at 2985 cm−1 for CH bond vibration stretching, 1379.1 cm−1 for C=C stretching and 1006.4 cm−1 for C−O stretching of alcohol to increase, this proves that the heavy metal ions bonded with oxygen-containing functionalities on the adsorbent surface of LAC (Eletta et al.2019; Ullah et al. 2020). A similar result was also reported for adsorption of lead(II) from aqueous solution using Africa elemi seed, mucuna shell and oyster shell as adsorbents (Okolo et al. 2020) and adsorption of vanadium (V) from textile wastewater using LAC (Nwosu-obieogu et al. 2021).

Fig. 3
figure 3

FT-IR spectrum for LAC before adsorption

Fig. 4
figure 4

FT-IR spectrum for LAC after adsorption

SEM analysis

The SEM image of LAC before adsorption in Fig. 5 shows that LAC's surface is relatively smooth with a dense fibrous structure; the surface morphology results from the developed LAC. Figure 6 shows the SEM image of LAC after adsorption; it is evidenced that the formation of a layer results from the heavy metal ions adsorbed on the surface and occupying the cavities of LAC (Ullah et al. 2020). Similar surface morphologies were observed by Nwosu-obieogu et al. (2020) for adsorption of iron(II) from textile wastewater by LAC.

Fig. 5
figure 5

SEM image of LAC before adsorption

Fig. 6
figure 6

SEM image of LAC after adsorption

ANFIS exhaustive search results

The (ANFIS) exhaustive search function in Matlab used root mean square error (RMSE) as the parameter for assessing the effect of single and interaction effects on the output. (Nwosu-Obieogu et al. 2020). The value of RMSE close to zero ascertains the degree of predictability and reliability of the model (Oke et al. 2020). Tables 1, 2, 3, 4, 5, and 6 show the impact of one and combined input variables in the minimal training error. Table 1 shows that time had the most significant effect with an RMSE of 0.0491 for chromium (VI) removal; in contrast, an interaction effect between time and mass had the most impact on removing chromium (VI) from textile wastewater with an RMSE of 0.0470, as shown in Table 2. For Table 3, the mass is the most effective as a single variable for iron(II) removal with an RMSE of 1.3132.

Table 1 One-input variable ANFIS (exhaustive search) for chromium(VI) removal
Table 2 Two-input variable ANFIS (exhaustive search) for chromium (VI) removal
Table 3 One-input variable ANFIS (exhaustive search) for iron(II) removal
Table 4 Two-input variable ANFIS (exhaustive search) for iron (II) removal
Table 5 One-input variable ANFIS (exhaustive search) for vanadium (V) removal
Table 6 Two-input variable ANFIS (exhaustive search) for vanadium (V) removal

In contrast, a combined variable of time and mass had the most effect with the least RMSE of 1.2981 on iron (II) removal from textile wastewater in Table 4. On the other hand, time impacted vanadium (V) removal in Table 5 with an RMSE of 1.0271. At the same time, the best input combination for vanadium (V) removal from textile wastewater in Table 6 is a combination of pH and mass with an RMSE of 1.0038 these results confirm that the parameters (time, pH and mass) have a significant impact on the removal of heavy metals (chromium (VI), vanadium (V) and iron (II)) from textile wastewater using LAC. This observation is similar and followed the claim of previous investigations from Oke et al. (2020) and Nwosu-obieogu et al. (2021).

ANN simulation results

The ANN-based model was developed based on the feed-forward, back-propagation (BP) algorithms to predict the removal efficiency of chromium(VI), iron(II) and vanadium(V) ions from textile wastewater using three inputs: time, pH and adsorbent's dosage. One hundred and eighty-one data sets used for ANN modelling were divided randomly into three sets (training the network, validation of the results and testing the network) with a ratio of 70%, 15% and 15%. The hidden layer comprises ten neurons; As shown in Tables 7, 8 and 9, the Bayesian regularization was the best of the algorithms, having the smallest MSE of 5.9857E−14, 2.33856E−13 and 7.22197E−12 for chromium (VI), iron (II) and vanadium(V), respectively. The variation of the MSE with the number of training cycles (epochs) was presented in Fig. 7, 8 and 9 below the minimal MSE shown in Tables 7, 8, and 9 were obtained at epoch 13 for chromium (VI), 684 for iron (II) and 156 for vanadium (V), after the maximum cycles were attained, the training process was stopped (Razmi-Rad et al. 2007; Uzuner and Cekmecelloglu 2016; Oke et al. 2020). The effectiveness of the predictive ANN model results for heavy metal adsorption using LAC is in agreement with reports from Souza et al. 2018 on ANN and ANFIS modelling for nickel adsorption onto agro-wastes and commercial activated carbon and Nasr et al. (2017) on artificial intelligence modelling of cadmium (II) biosorption using rice straw.

Table 7 Performance of different ANN models in estimating chromium (VI) removal using LAC
Table 8 Performance of different ANN models in estimation of iron (II) removal using LAC
Table 9 Performance of different ANN models in estimation of vanadium (V) removal using LAC
Fig. 7
figure 7

Mean squared error (ANN) for chromium(VI) removal

Fig. 8
figure 8

Mean squared error (ANN) for iron(II) removal

Fig. 9
figure 9

Mean squared error (ANN) for vanadium(V) removal

ANFIS simulation results

One hundred and eighty-one data set were used for ANFIS modelling, best ANFIS prediction for heavy metal adsorption using LAC was simulated at various input and output membership functions (mf). The correlation coefficient (R2) and the mean square error (MSE) were used to validate the model's predictiveness. Tables 10, 11 and 12 summarize the ANFIS results of different input membership function types; the highest R2 (0.76305) and minimum MSE (0.037105) were observed at trimf and psigmf for chromium(VI) removal as highlighted in Table 11, gaussmf gave a prediction of R2(0.67652) and MSE(0.846) for iron(II) removal as shown in Table 12, while an R2(0.22673) and MSE(0.65925) was obtained at trimf and gaussmf, respectively, for vanadium(V) removal in Table 12; hence, the best prediction was obtained at chromium(VI) removal, this shows that the ANFIS model is capable of predicting adsorption capacity of chromium(VI) with high precision (Souza et al., 2018). The results in Tables 11, 12 and 13 are validated in Figs. 10, 11, and 12. The obtained result is similar to previous research of Ojediran et al. (2020), Oke et al. (2020) and Nwosu-Obieogu et al. (2020b).

Table 10 ANFIS model efficiency for chromium (VI) removal using LAC
Table 11 ANFIS model efficiency for iron(II) removal using LAC
Table 12 ANFIS model efficiency for vanadium (V) removal using LAC
Fig. 10
figure 10

R2 (ANFIS) for chromium (VI) removal

Fig. 11
figure 11

R2 (ANFIS) for iron (II) removal

Fig. 12
figure 12

R2 (ANFIS) for iron(II) removal

ANN results compared with ANFIS

This study compared ANN and ANFIS results to evaluate the model’s predicting ability for heavy metal removal from textile wastewater using statistical metrics such as R2 and MSE. The coefficient of determination (R2) of ANN (0.99) and ANFIS (0.76305) was close to 1, showing the agreement between experimental and predicted results. Furthermore, it was noticed that both MSE of ANN (5.9857E−14) and ANFIS (0.037105) were less than one. These results showed the capability of the models in predicting heavy metal removal from textile wastewater. Moreover, they provided an excellent measurement scale to assess the goodness of the adjustment and ascertain the efficacy of progressive approaches. However, the R2 of ANN is higher than ANFIS; also the MSE of ANN is lower than ANFIS; demonstrating that ANN estimated the process better than ANFIS; this is similar to the studies of Nwosu-Obieogu et al. (2020b), Oke et al. (2020) and Uzuner and Cekmecelloglu (2016).

Conclusion

A batch experimental study was used to investigate the effect of three parameters, time, pH and adsorbent's dosage, on the adsorption of chromium (VI), vanadium (V) and iron (II) using LAC as adsorbent. A proposed ANN and ANFIS model predicted the removal of heavy metals successfully. The properties of LAC before and after adsorption were studied by various techniques such as FTIR and SEM. The FT-IR confirmed the functional groups, while the SEM presented the surface morphology of the LAC. ANFIS (sensitivity analysis) showed that the process parameters (time, pH and mass) significantly affect removing the heavy metals. From the results, the ANFIS and ANN models relatively predicted Cr(VI), Fe(II) and Vanadium(V) removal with Bayesian regularization BP that gave MSE of (5.9857E−14), (2.33856E−13) and (7.22197E−12) for ANN, psigmf showed MSE of (0.037105), gaussmf (0.67652) and trimf (0.22673), respectively, for ANFIS. This study proved that LAC is a low-cost alternative material for removing heavy metals from textile wastewater. Hence, it is evidenced that ANN and ANFIS are promising predicting technique that can be used effectively to predict heavy metal removal from textile wastewater using LAC.