Introduction

The importance of maintaining a healthy environment for all living creatures is critical, particularly in light of the ever-increasing human population and the impact of their activities on the environment. As a result, numerous waste management laws and regulations have been enacted by both national governments and international organizations. The bulk of legislation targets biologically harmful, toxic or particularly carcinogenic substances, as well as certain industrial by-products. Owing to their constant use, the textile and dye industries are one of the main industries that are concerned with these hazardous chemicals (Igwegbe et al. 2021).

Dyes are the essential raw materials used for coloration and esthetic purposes in cloth, pulp and paper, food, dye and other industries. As a result of inept manufacturing processes, some of these dyes end up in wastewater, increasing biochemical oxygen demand (BOD), COD, solid material and toxicity (Anastopoulos and Pashalidis 2020). The discharge of wastewater into the marine ecosystem without treatment will destabilize the aquatic ecosystem by depleting dissolved oxygen. This consequently obstructs photosynthesis and other biological activities (Onu et al. 2020). When exposed to man, the chemical composition of most dyes and the product of dye decay has been confirmed to be toxic, carcinogenic and mutagenic. These could cause damage to various organs and tissues in human (Onu et al. 2020; Hadi et al. 2019; de Souza et al. 2016). As a result, removal is needed.

Removal of dye pollutants requires multiple treatment techniques, such as membrane separation, aerobic and anaerobic deterioration, chemical oxidation, adsorption, coagulation/flocculation (CF), among others (Ezemagu et al. 2021). Each of these techniques, whether biological, chemical or physical, has its own limitation which could be high cost, performance efficiency, feasibility and environmental effect (Badawi and Zaher 2021; Ahmad et al. 2021; Samsami et al. 2020). Despite the wide range of treatment techniques available (Mdlovu et al. 2020; Mohamad Yusof et al. 2020), CF is the treatment technique of choice. This is due to the fact that CF is quick and accurate (Wang et al. 2011; Khayet et al. 2011), cost-effective and straightforward (Singh and Kumar 2020), compact and easy to use (Nnaji et al. 2020b). Coagulation/flocculation, which occurs as a result of the addition of coagulants (chemical or biological), destabilizes the color/colloidal dispersion by neutralizing charges of the same sign on the colloidal surface. As a result, these particles interact with one another, forming microflocs and then flocs as they increase in size (Bruno et al. 2020).

Notwithstanding the fact that using a well-known chemical coagulant like alum is cost-effective, there are a number of drawbacks. These include non-biodegradability, the production of large amounts of sludge with related disposal costs (Adesina et al. 2019), post-contamination with aluminum salts, Alzheimer's disease in humans and poor output in cold water (Aniagor and Menkiti 2018; Nnaji et al. 2020b). Due to the above uncertainties, there has been an increasing demand for the production of environmentally friendly natural coagulants. Natural coagulants like Moringa olifera seed, Detarium microcarpum, Mucuna Sloanei and tannins (Nnaji et al. 2020a; Adesina et al. 2019; Ani et al. 2012) have shown to be effective.

Wastewater treatment with natural coagulants is environmentally friendly, and the sludge generated (following biological conversion) could be used as soil conditioners (de Souza et al. 2016). The Luffa cylindrica seed provided the natural coagulant used in this study. Although this plant grows wild in Nigeria and the pod has been used as a filter sponge and support for adsorptive biomass (Maroneze et al. 2014), L. cylindrica seed has little application in wastewater treatment. This biomass is biodegradable, non-toxic and suitable for human and animal consumption. The use of L. cylindrica seed for wastewater treatment has been confirmed to have good results with low sludge generation (Nnaji et al. 2020b).

The proper selection of the necessary independent variables for an optimal response is critical to the effective implementation of the CF treatment process (Singh and Kumar 2020). Temperature, pH, wastewater quality, and the amount and form of coagulant used, among other things, all have an effect on the CF process. The process's efficiency would be significantly improved if these variables are optimized. Despite its time-consuming features, the use of a single variable approach for modeling and optimization is outdated and does not indicate correlation between variables (Adesina et al. 2019). Existing conceptual approaches, such as the statistically based method and artificial intelligence's black-box approach, were used to overcome this restriction.

The RSM, a combination of mathematical and statistical methods that operates with a reduced number of experimental runs, high-precision regression equations and continuously analyses different levels of test factors, has been studied for a statistically based approach (Zhao et al. 2019). RSM has been shown to be an effective method for combining the optimization of several independent variables and their responses. In addition, the ANOVA gives researchers insight into the statistical findings, which they can use to assess the models' adequacy (Singh and Kumar 2020). This method has been used in many fields of research (Wang et al. 2011; Elsayed and Lacor 2011; Chamoli 2015; Gupta and Kumar 2020).

In the last two decades, artificial intelligence approaches such as artificial neural networks (ANNs), adaptive neuro-fuzzy inference systems (ANFISs), genetic algorithms (GAs) and others have been recognized as useful tools for simulation and process optimization, particularly for nonlinear multivariate modeling (Zhao et al. 2019; Zin et al. 2020). ANN is a data-driven, self-adaptive approach that relies on the least number of prior assumptions about the mechanism being studied (Youssefi et al. 2009). ANN tries to calculate each input set's response, compare it to the output and correct the deviation by adjusting internal weights. The hit and test process continue until the outputs and responses have the least amount of variance (Joshi et al. 2020).

ANFIS (adaptive neuro-fuzzy inference system) is a fuzzy inference input expanded ANN. It consists of a synchronized hybrid neural network and fuzzy inference system that generates precise response predictions from numerical input data (Onu et al. 2020). ANFIS is a universal approximator since it performs multivariate system approximation by establishing IF–THEN laws (Sarkar et al. 2014). ANFIS combines ANN and fuzzy logic in order to maximize the benefits of both approaches (Betiku and Ishola 2020); Desai et al. 2008).

RSM, ANN and ANFIS have been used as optimization methods in a variety of areas, either alone, in conjunction with any of the two or in a combination of the three strategies for the purpose of determining the best solution. Artificial intelligence has been widely used in modeling, forecasting, fault dictation and process control in areas such as membrane science and technology (Khayet et al. 2011), building and construction (Hammoudi et al. 2019), power technology (Elsayed and Lacor 2011), environmental engineering (Gupta and Kumar 2020) and corrosion (Anadebe et al. 2020).

There has been very little research on the use of the trio for optimizing CF modeling for the treatment of textile wastewater with bio-coagulant (Zhao et al. 2019; Zin et al. 2020). Nonetheless, there is no documented evidence on the use of the three optimization methods to predict the removal of COD and CTSS using bio-coagulant derived from Luffa cylindrica seed. As a result, the current research is both important and novel. Hence, the goals of this study are to: optimize the decontamination of textile wastewater using CS-LCSE-induced CF process; (ii) investigate the three optimization techniques; and (iii) compare the performance/adequacy of these optimization techniques. The percent CTSS and COD removal from textile wastewater were both evaluated. The novelty of the present study is optimizing CS-LCSE coagulant-induced decontamination of textile wastewater using three optimization approaches and determining the technique with the best predictive strength.

Materials and methods

The wastewater from a garment factory in Aba, one of the Nigeria's commercial cities was applied. The wastewater was collected in a twenty-five-liter plastic container using grab sampling techniques and stored at 4 °C in the laboratory. All reagents used were of analytical grade.

Methods

Luffa cylindrica seed (LCS)

Sun-drying the sponges collected from L. cylindrica plant allowed the seeds to be separated. The seeds were cleaned, dried and homogenized into powder and kept in an airtight jar. Sutherland suggested another technique for further processing the LCS (Menkiti et al. 2016). This process involved soaking 100 g of sieved powder in ethanol and vigorously stirring the mixture for 150 min with a magnetic stirrer. The mixture was then filtered with Whatman filter paper no. 3 afterward. After filtration, the residue was transferred to a beaker (14.1 cm ED and 13.8 cm ID) containing a 1:25 w/v solution of complex salts (0.7 g/L CaCl2, 4 g/L MgCl2, 0.75 g/L KCl, 30 g/L NaCl) (Menkiti et al. 2016, 2018). A magnetic stirrer was used to stir the mixture of residue and complex salt solution for 2 h before filtering it (using Whatman filter paper). The filtrate solution was poured into a sufficiently agitated beaker and heated to 70 °C for 2 min to precipitate out the required complex salt–bio-coagulant extract (CS-LCSE). The precipitated CS-LCSE was poured into the filter papers and allowed to dry for 24 h at room temperature.

Biomass and textile wastewater (TW) characterization

Standard methods were used to assess the distinctive quality of the TW and the proximate composition of the biomass (AOAC 2005; Ani et al. 2012; Nnaji et al. 2020b). Table 2 shows the results of the characterization performed at the National Soil, Plant, Fertilizer, and Water Laboratory in Umudike, Nigeria. The Mettler Toledo Delta 320 pH Meter, DDS 307 Conductivity Meter and UNICO 1100 Spectrophotometer were used to evaluate the solution pH, electrical conductivity and CTSS, respectively. The COD and the BOD5 were determined using dichromate method (5220A) and 5-Day BOD test (5210B), respectively (AWWA 2012). The following instruments were used to characterize the LCS and its extract used in the study: FTIR spectra were generated using an Agilent Technologies infrared spectrometer with a resolution range of 4000–650 cm−1 and 30 scans at 8 cm−1 with 16 background scans. The sample's morphology was developed using a Phenon-World MVE 016,477,830 scanning electron microscope.

Coagulation/flocculation procedure

In each case, a jar test was performed on 200 mL of wastewater with pH levels range of 2, 4, 6, 8 and 10 using 1000, 1200, 1400, 1600 and 1800 mg/L of CS-LCSE, respectively. pH was altered by adding 0.1 M sulfuric acid and 0.1 M sodium hydroxide separately. For 300 min, the solution was allowed to settle. Following that, the CTSS and COD levels in each cylinder's supernatant were measured to determine the extent to which they had been removed. For color removal, absorbance is converted to suspended solid particles concentration (N), mg/L, using Beer’s law as shown in Eq. (1).

$$A = \varepsilon mCL$$
(1)

where A = absorbance, εm = molar extinction coefficient, C = concentration and L = path length of 1 cm.

$${\text{Colour}}/{\text{TSS}}\,{\text{removal}} = N_{0} - N_{n}$$
(2)

N0 = initial particle concentration and Nn = particle concentration at time, t.

Empirical modeling and optimization approach

Response surface methodology (RSM)

Numerous approaches of RSM like central composite design (CCD), Box–Behnken design (BBD) and full factorial design (FFD) in the prediction of optimal output were used in many researches (Thirunavukkarasu and Nithya 2020; Okolo et al. 2016). BBD was used for all conditions, with a three-level architecture of calculated influences. The architecture was different in three places, each with a different number of factors: high (+1), mid- (0) and low (-1). It took 17 experimental runs to achieve the proposed design. The variables studied were CS-LCSE dosage (X1), wastewater pH (X2) and stirring time (X3). The percent CTSS (Y1) and percent COD (Y2) elimination are the reaction variables. The following are the actual variables used in the experiment: dosage (1000, 1400 and 1800 mg/L), pH (2, 6 and 10) and stirring time (10, 20 and 30 min). The factors were chosen based on the established influence on CF process, while the responses were because they constitute the major pollution indicators in textile wastewater. The arrangement is selected to fit the pattern of a quadratic polynomial equation (de Souza et al. 2016; Kim 2016) Eq. (3).

$$y = b_{o} + \mathop \sum \limits_{i = 1}^{k} b_{i} X_{i} + \mathop \sum \limits_{i = 1}^{k} b_{ii} X_{i}^{2} + \mathop \sum \limits_{i}^{k} \mathop \sum \limits_{j} b_{ij} X_{i} X_{j}$$
(3)

where y is the variable response to be modeled; Xi and Xj are the independent variables influencing y; and bo, bi, bii and bij are the offset terms, the ith linear coefficient, the iith quadratic coefficient and the ijth interaction coefficient, respectively.

Artificial neural network

The ANN simulates a human neural network to tackle critical challenges by following certain specified patterns. ANN performs computational tasks (using neurons and linkage computing networks) without following any specific rules when it comes to data processing. Traditional methods learn by following a set of rules, while ANN learns by following patterns (Khayet et al. 2011; Joshi et al. 2020).

An artificial neuron is a single computational processor with a summing junction and a transfer function (Khayet et al. 2011). Weights, w, and biases, b, with neurons that address data make up the relationship. The summing junction operator of a discrete neuron combines the weight and bias into an input node, S, defined as the logic to be presented:

$$S = \mathop \sum \limits_{i = 1}^{n} x_{i} w_{i} + b$$
(4)

The input parameter xi is used here. The transfer function takes the logic and produces the scalar output of a single neuron. The famous transfer functions for solving linear and nonlinear regression problems are purelin, logsig and tansig. The logsig transfer function is represented as follows:

$$\log {\text{sig}} \left( S \right) = \frac{1}{{1 + \exp \left( { - S} \right)}}$$
(5)

The architecture is the link between the inputs and outputs of the neurons (Fig. 1). The neurons in such a network are divided into layers, which are bands of neurons. A multilayer neural network has three input layers (X1, X2 and X3), an output layer (Y1 or Y2) and a hidden layer. The multilayer feed-forward neural network, also known as the MLP or multilayer perceptron, is a popular algorithm for solving nonlinear regression problems. Back-propagation is the most popular feed-forward neural network training algorithm (BP). The back-propagation algorithm in ANN training is an iterative method of maximization in which the output function is reduced by appropriately changing the weights. After selecting the architecture, the experimental data sets are required to train the ANN model for forecasting the performance. To achieve convergence, a total of 17 experiments from DoE in RSM were scaled up to 100 before implemented at random in the current study using the same variables and responses. These 100 experimental data points were fed into an ANN structure and were divided into training (70), validation (15) and testing (15) subgroups. The validation and testing samples were chosen at random from the study data set to assess the model's adequacy. MSE is a commonly used performance variable, which is defined as:

$${\text{MSE}} = \frac{1}{HM}\mathop \sum \limits_{i = 1}^{m} (y_{{\text{p}}} - y_{{\text{a}}} )^{2}$$
(6)

M denotes the number of patterns used in the training data set, H denotes the number of output nodes, and yp and ya denote the output node's targets (experimental) and (predicted), respectively. The neural network toolbox in MATLAB software has been used for scientific programming and ANN model generation.

Fig. 1
figure 1

Artificial neural network framework

Adaptive neuro-fuzzy inference system (ANFIS)

ANFIS is a one-of-a-kind and extremely precise optimization tool that can investigate and analyze all types of complex and nonlinear multivariate systems (Anadebe et al. 2020). In order to implement a standard technique for training and transformation of human intelligence into rule bases, the ANFIS structure and learning method based on the Takagi–Sugeno fuzzy (TSK) inference paradigm were used (Naghibi et al. 2021). The ANFIS model used in this study is a five-layered neural network assisted by the fuzzy inference system concept.

As presented in Fig. 2, the input variables (X1, X2 and X3), output variables (Y1 or Y2) are depicted in the first and last layers, respectively. The same 100 data sets that were used in ANN were also used in ANFIS. The TSK model uses membership functions (MF) to convert input parameters into membership values in a method known as fuzzification (second layer of the framework) (Onu et al. 2020). ANFIS does this by predicting the membership function using back-propagation and least square evaluation. In the TSK model, the created values go through a series of logical rules (third layer). TSK is a function with two hypothetical inputs (x, y) and one output (f) that is supported by four rules: (Onu et al. 2020; Anadebe et al. 2020).

$${\text{Rule}}\, 1:\;{\text{if}}\,x\,{\text{is}}\, \beta_{1} \left( x \right),\,{\text{and}}\,y\,{\text{is}}\,\beta_{1} \left( y \right),\; {\text{then}}\; f_{1} = p_{1} x + q_{1} y + r_{1}$$
(7)
$${\text{Rule}}\, 2:\;{\text{if}}\,x\,{\text{is}}\,\beta_{2} \left( x \right),\,{\text{and}}\,y\,{\text{is}}\, \beta_{2} \left( y \right),\,{\text{then}}\,f_{2} = p_{2} x + q_{2} y + r_{2}$$
(8)
$${\text{Rule}}\,3:\;{\text{if}}\,x\,{\text{is}}\, \beta_{1} \left( x \right), \,{\text{and}}\,y\,{\text{is}}\, \beta_{2} \left( y \right),\,{\text{then}}\, f_{3} = p_{3} x + q_{3} y + r_{3}$$
(9)
$${\text{Rule}}\, 4:\;{\text{if}}\, x\, {\text{is}}\, \beta_{2} \left( x \right),\,{\text{and}}\, y\, {\text{is}}\, \beta_{1} \left( y \right),\, {\text{then}}\, f_{4} = p_{4} x + q_{4} y + r_{4}$$
(10)

where β1(x), β1(y), β2(x), β2(y), are nonlinear functions, while p1, p2, p3, p4, q1, q2, q3, q4, r1, r2, r3, r4 are linear functions.

Fig. 2
figure 2

Adaptive neuro-fuzzy inference system (ANFIS) framework

Defuzzification of inference output, using the output membership function, transformed the data obtained after going through the logical rules in the third layer into real numerical output (fourth layer). The final or fifth layer normally uses only one node to indicate the summation of all incoming signals as the final output, which is either a percentage COD reduction or a CTSS reduction.

Results and discussion

LCS and textile wastewater (TW) characterization

The proximate composition of LCS previously documented (Nnaji et al. 2020b) revealed 21.88% crude protein, which is comparable to other published works, defatted LCS crude protein content 42.17–70.65% (Abitogun et al. 2010) and 45.06–50.06% (Adegbite et al. 2017) and non-defatted LCS 28.45% unrefined protein (Salem 2017). Unrefined protein has been identified as a key component in the CF process. Table 1 summarizes the findings of the textile wastewater characterization. The raw textile wastewater sample was dark green-colored. The findings revealed the existence of contamination indices such as high BOD, COD and heavy metals, to name a few. The high CTSS, electrical conductivity, total organic carbon and COD as indicated in Table 1 could be principally due to the use of dye materials and several additives in the textile production line.

Table 1 Characterization results of textile wastewater

FTIR, SEM and XRD characterization

The FTIR is a valuable tool for fully comprehending the sorption mechanism (Joshi et al. 2020). Figure 3a reveals the discovery of a functional group peak of the polymeric-OH and N–H stretching of amide groups normally found in protein structure at 3276.3 cm−1, as well as an asymmetric group of methyl C–H and methylene C–H of the CH2 group found in fatty acids extending between 2951.1 cm−1 and 2914.8 cm−1 in LCS and its extract. In addition, 1707.1 cm−1 could be assigned to carboxylic ketone extension (Dalvand et al. 2016; Al-sameraiy 2017). The polymeric -OH groups and carboxyl extension provide good active site for colloidal attachment (de Souza et al. 2016; Adewuyi and Vargas 2017). The SEM was used to examine the surface characteristics of LCS and its extract. As shown in Fig. 3b, the results showed a fibrous nature with some fissures and pores (Oboh et al. 2015). This indicates the presence of a macroporous structure with active site to aid CF and adsorption processes (Ahmad and Haseeb 2015).

Fig. 3
figure 3figure 3

a FTIR spectra of (LCS) (a), CS-LCSE (b). b SEM graphics (a) LCS, (b) CS-LCSE. c The XRD spectra of (a) LCS, (b) CS-LCSE

The crystalline structure of the material was investigated using X-ray diffraction. The XRD spectra for both LCS and its extract (CS-LCSE) are shown in Fig. 3c. Between the 10 < 2\(\theta\) < 70° strips, the figures display several high peaks, various halos with amorphous humps and a lot of noise. Figure 3c (a) indicates 14 clear peaks, while Fig. 3c (b) shows 13 clear peaks. Upon comparison with standard crystal, peaks were shifted toward left–right axes, which could be as a result of expansion and contraction of LCS (Menkiti et al. 2016). This suits the description of a partly crystalline substance with loosely arranged molecules forming dispersed bands. The material studied is said to be crystalline if it has well-defined peaks, whereas non-crystalline or amorphous material has halos or humps (Menkiti et al. 2018; Zhao et al. 2017).

Preliminary study on individual parameters’ effect

The individual impact of the process variables was first looked into. This was accomplished by analyzing each operating variable one at a time while holding one other parameter constant. The ranges were chosen based on documented evidence and preliminary research (de Souza et al. 2016; Ani et al. 2012; Okolo et al. 2016). Figure 4 shows the results obtained under optimum conditions. The figures depicted the effect of CS-LCSE dosage and wastewater pH on CTSS and COD removal efficiencies at a constant stirring period. From Fig. 4a, for CTSS removal, it could be seen that there was slight decrease in the efficiency removal when dosage increased from 1000 to 1200 mg/L. This was further heightened at 1400 mg/L CS-LCSE. This could be attributed to charge reversal due to overdosing and hence re-stabilization of CTSS. Between 1400 and 1800 mg/L, a progressive increase in removal efficiencies (98.63 – 99.37%) were observed. This could due to incremental destabilization of the negatively charged particles in the wastewater (Ezemagu et al. 2016). Similar results were observed for COD removal. However, the optimum dosage of 1200 mg/L with 99.96% COD removal was an indication that COD in textile wastewater is not only caused by CTSS.

Fig. 4
figure 4

Impact on CTSS (a) and COD (b) removal by bio-coagulant dosage and wastewater pH

For CTSS and COD removal efficiencies against pH displayed in Fig. 4b, similar trend were observed. The pH range with progressive increment in removal efficiencies could be attributed to progressive protonation. In like manner, the pH range with decreased in removal efficiencies, could be as a result of net positive and negative species induced by charge reversal, resulting in re-stabilization and reduction in coagulation/flocculation activities (Menkiti et al. 2016; Ani et al. 2012; Okolo et al. 2016). The mechanism of CTSS and COD removal are hydrolysis, coagulation, bridging effects and precipitation (Onukwuli et al. 2021). While hydrolysis involves all reaction processes with coagulants and water, coagulation is basically charge destabilization, bridging and precipitation is the cohering and linkages of the particle destabilized and eventual settling out of solution.

Generated response models from BBD

The RSM jar test was developed using Design Expert 10. The layout varied over three levels on each of the numerical variables: a high (+ 1), low (− 1) and mid- (0). CTSS and COD are the response variables as indicated in the matrix (see Table 2). Upon analysis using Design Expert 10, the polynomial equations were generated. The trend of second-order regression for Y1 and Y2 removal efficiencies are as indicated in Eqs. (11, 12).

$$\begin{aligned} Y_{{{\text{CTSS}}}} &= 67.14 + 1.30X_{1} - 16.72X_{2} + 0.83X_{3}\\&\quad - 1.44X_{1} X_{2} + 2.66X_{1} X_{3} + 1.30X_{2} X_{3}\\&\quad - + 6.30X_{1}^{2} + 9.28X_{2}^{2} + 5.71X_{3}^{2} \end{aligned}$$
(11)
$$\begin{aligned} Y_{{{\text{COD}}}} &= 73.75 + 1.94X_{1} - 14.69X_{2} + 1.33X_{3}\\&\quad - 1.27X_{1} X_{2 } - 0.23X_{1} X_{3} + 2.18X_{2} X_{3}\\&\quad - + 5.60X_{1}^{2} + 4.23X_{2}^{2} + 5.16X_{3}^{2} \end{aligned}$$
(12)
Table 2 BBD for CTSS and COD removal

Individual factor constants indicate the impact of that variable, while constants linked to multiple and squared factors indicate the interaction between variables and the quadratic effect. A plus sign in front of a constant denotes consensus, while a minus sign denotes disagreement (de Souza et al. 2016; Kim 2016). Equations (13, 14) was created as a follow-up to the removal of non-relevant interaction terms for both CTSS and COD elimination.

$$\begin{aligned} Y_{{{\text{CTSS}}}} &= 67.14 - 16.72X_{2} + 2.66X_{1} X_{3}\\&\quad + 6.30X_{1}^{2} + 9.28X_{2}^{2} + 5.71X_{3}^{2} \end{aligned}$$
(13)
$$\begin{aligned} Y_{{{\text{COD}}}} &= 73.75 + 1.94X_{1} - 14.69X_{2}\\&\quad + 5.60X_{1}^{2} + 4.23X_{2}^{2} + 5.16X_{3}^{2} \end{aligned}$$
(14)

Suitability of the pattern

The pattern's viability was determined using variance analysis (ANOVA) as shown in Table 3. From the table, both models are significant with Prob > F values < 0.0001. The significant terms for CTSS and COD removal were \(X_{1}\),\(X_{2}\),\(X_{1} X_{3}\),\(X_{1}^{2}\), \(X_{2}^{2}\) and \(X_{3}^{2}\) and\(X_{1}\),\(X_{2}\),\(X_{2} X_{3}\),\(X_{1}^{2}\), \(X_{2}^{2}\) and \(X_{3}^{2}\), respectively. Terms with Prob > F value less than 0.050 are significant, while terms with Prob > F value of 0.10 are not significant. The R2 and adj R2 in terms of CTSS and COD elimination for the chosen model are also shown in Table 3. According to the table, the independent variables explained up to 90% of the heterogeneity in the respective responses for both CTSS and COD. Coefficient of regression, R2, determines how well the model outputs fit the experimental data. The closeness of the parameter to 1 reflects better agreement of the model with the experimental data. The high R2 values indicate that the model fits the responses well. Because of R2's close proximity to adj R2, the knowledge obtained from the experiment was fairly consistent (Singh and Kumar 2020; Kim 2016).

Table 3 ANOVA findings for CTSS and COD removal

Analysis of processes

The pronounced effect of dosage and pH on CF-led reactions may be attributed to the initial concentration of the reactant and the effect of solution pH on CF-led reactions. The negatively charged dye particles are quickly destabilized since the amino groups in proteins are usually cationic. Also, because the dye particles held their anionic charge at high pH, the cationic coagulants combined effectively with the particles. This is supported by researches (Karam et al. 2020; Dalvand et al. 2016; Baharlouei et al. 2018; Sangal et al. 2012; Zhang et al. 2020). The quadratic regression model was relevant due to the large f-values obtained for both responses. Similarly, the models' p values, which indicate the pattern's significance in relation to the f value, were < 0.05. As a result, the trend was statistically significant at a 95% confidence level.

Despite the presence of nonsignificant terms, the severity of the lack of fit f-values (Table 3) suggests that the lack of fits is insignificant in comparison to the pure errors. It also showed that a lack of fit F values this high may be due to noise in only 9.31% and 16.40% of the cases, respectively, for CTSS and COD. Since the lack of fit values were not significant, it implies that the models exhibit fitness for prediction. The 3D-surface plots of the %CTSS and %COD removal based on the BB design are shown in Fig. 5. From Fig. 5a, the pH–dosage plot for CTSS indicated better performance at pH 2 and dosage range of 1000–1400 mg/L, while the dosage–stirring time interactive plot has greater CTSS removal efficiency at 1200–1400 mg/L using stirring time of 15–20 min. However, for pH–stirring time, pH 2 and 10–25 min stirring time performed better. Similarly, from Fig. 5b, for COD removal, pH–dosage plot, pH 2 and 1200 mg/L CS-LCSE indicated better performance, while for dosage–stirring time, 1200–1400 mg/L at stirring time of 10–25 min reduced COD more than other points. Also, for pH–stirring time, pH 2 and 10–25 performed better in reducing COD. These are reflected by the orange-colored shades which denote a high-interaction zone. The figures showed fair curvature, which is consistent with quadratic models and suggests a strong interactive impact (Imen et al. 2013).

Fig. 5
figure 5figure 5

a Presentation of 3D-surface for removal efficiency (%) for CTSS. b Presentation of 3D-surface for removal efficiency (%) for COD

The building of ANN and training

The same data were used for three independent variables in ANN as it was in RSM. The responses are also the same. The number of secret layers of neurons is crucial in the ANN process. As the number of hidden neurons in the network grows, training data errors decrease, but the network's complexity grows. A network of two to fifteen neurons was tested. A twelve-neuron hidden layer proposed the best generalization and model complexity.

Three input neurons, twelve hidden layers and one output layer neuron make up the architecture, which is a four-layer feed-forward backdrop network (Khayet et al. 2011). More than ten training functions were evaluated, including Levenberg–Marquardt BP, Scale conjugate gradient BP, gradient descent with adaptive learning rate BP and others, with Levenberg–Marquardt BP yielding the best results. The log-sigmoid transfer function (logsig) was chosen for the hidden neurons, while the linear transfer function was preferred for the output layer neuron (purelin). After that, training was done separately to ensure the best-trained network. The best result was obtained after 12 iterations for both CTSS and COD elimination. The regression coefficient recorded were > 0.9 for CTSS and COD elimination. Figure 6 displays the results of the ANN model training, testing and validation for CTSS and COD removal efficiencies. The coefficient of regression between experimental (0.98994 and 0.98165) and ANN (0.99998 and 0.99122) predicted CTSS and COD removal efficiencies, respectively, during training and validation are indicated in Fig. 6a, b. These regression values indicate the measure of correlation between output and target during training and validation (Ezemagu et al. 2021). The closeness of this parameter to 1 reflects better agreement of the model with the experimental data. The higher value of regression (0.99849 and 0.97874) for testing data set for CTSS and COD removal, respectively, demonstrated the efficacy of ANN in estimating the removal efficiencies of CTSS and COD for the experimental range investigated in the model fitting (Gupta and Kumar 2020). This is evidenced by the low MSE value of 0.0845 and 0.0161 for CTSS and COD, respectively.

Fig. 6
figure 6

a ANN model training, testing, validation and overall plots of the CTSS removal. b ANN model training, testing, validation and overall plots of the COD removal

Adaptive neuro-fuzzy inference system prediction

Fuzzy logic was used to estimate the removal efficiency of CTSS and COD from textile wastewater using complex salt–Luffa cylindrica seed extract (CS-LCSE), despite the use of ANN and RSM techniques. Three membership functions (MF) and a set of 27 rules were used to correlate the input (X1, X2 and X3), output (Y1 or Y2) variables. To generate fuzzy logic, three MF are assigned to each element of the input. The fuzzy logic resulted in a hazy outcome. Finally, the fuzzy output was defuzzified to yield scalar results. Different input MFs were used, but the triangular MF produced the best results. Similarly, linear MF provided better performance prediction. After two epochs of training with triangular MF, an error magnitude of 0.000586 was achieved. This validated the fuzzy network's suitability for modeling the removal of CTSS and COD from textile wastewater using CF. Figure 7ai shows a plot of the experimental data and fuzzy inference system-generated outputs for the ANFIS architecture.

Fig. 7
figure 7

a Exp. against predicted (ANFIS) (i); surface plots of independent variable and the target (CTSS). b Exp. against predicted (ANFIS) (i); surface plots of independent variable and the target (COD)

Figure 8 represents some of the ANFIS formulated rules. The figure is an example of application of the rule viewer using discretization of the continuous triangular input to take the relevant alpha cuts in order to generate the fuzzy inputs. With the generated fuzzy inputs, any variation in the inputs causes a corresponding change in the output. As indicated in the figure, with the inputs, 1400 mg/L, pH 6, at 20 min, 58.1% and 77.1%, respectively, of CTSS and COD were removed from the wastewater. The 3-D surface view developed using the ANFIS rule viewer is shown in Fig. 7aii–iv. A closer look showed an undulating curve with three distinct color shades on the surface. The yellow-colored shade denoted a high-performing area, while the deep blue-colored shade denoted a low-performing area. The relationship between dosage and pH is shown in Fig. 7aii, with better CTSS removal at pH 2 and dosages of 1000–1400 mg/L. The relationship between dosage and stirring time is illustrated in Fig. 7aiii, suggesting that dosage ranges of 1000–1400 mg/L performed better at stirring times of 20–30 min. When it came to the interaction of pH and stirring time, CTSS removal performed better at pH 2 and stirring times of 20–30 min (Fig. 7aiv).

Fig. 8
figure 8

ANFIS rule for input and output response: a CTSS; b COD

Comparison of the models predictive abilities

The effectiveness of RSM, ANN and ANFIS models in predicting and accurately capturing the nonlinear features of COD and CTSS removal from textile wastewater was statistically evaluated. Table 4 displays the predictive strength correlated using coefficient of regression, R2 and MSE, while Table 5 reviews recent researches on the use of optimization tools for modeling textile/dye-based wastewater treatment. Three modeling tools RSM, ANN and ANFIS were considered. Table 4 shows that the three models were fairly accurate in predicting CTSS and COD removal. Despite the fact that most of the results showed close approximation between experimental values and RSM, ANN and ANFIS model predictions, resulting in low not accounted values, ANFIS gave the most reliability in predicting the percentage removal of CTSS- and COD-based higher R2 and negligible MSE values. Coefficient of regression, determines how well the model outputs fit the experimental data. The closeness of the parameter to 1 reflects better agreement of the model with the experimental data.

Table 4 Comparison of RSM, ANN and ANFIS predictive ability
Table 5 Different wastewater treatment modeling methods recently published

The performance of various modeling tools on the optimization of CTSS and COD removal at the operating conditions with CS-LCSE used in this study is listed in Table 5 and compared with other studies. As presented in Tables 4 and 5, ANFIS modeling tool showed higher predictive strength more than RSM and ANN in the present study. The R2 of the present study using ANFIS tool is 0.9997, which indicated higher prediction more than that reported by Onu et al. (2020) and Naghibi et al. (2021). This further evidenced by the mean square error (MSE) values as indicated for ANFIS, ANN and RSM for CTSS and COD, respectively, are 0.0002643, 0.0845014, 1.049412 and 0.0038472, 0.0160658, 0.983140.

Figure 9 conspicuously presents the comparative plots that illustrating graphical relationship between measured result and model predictions by RSM, ANN and ANFIS. The graphs revealed a good fit between the experimental findings and all of the existing framework. Most of the factorial and axial points of the patterns revealed no substantial divergence ( Onu et al. 2020). From the above data, the suitability of ANFIS over ANN and RSM in predicting COD and CTSS removal from textile wastewater using CS-LCSE-induced CF is evidenced.

Fig. 9
figure 9

Experimental data against a RSM, b ANN and c ANFIS predicted percentage CTSS and COD removal

Conclusion

The CF process was used to treat textile wastewater with a bio-coagulant (CS-LCSE) derived from the L. cylindrica seed. The multifactor optimization of the process was investigated using RSM, ANN and ANFIS modeling. This is to evaluate the best approach to model the removal of COD and CTSS and assess the adequacy and predictive potential of three techniques.

The latent qualities of the bio-coagulant for the treatment of textile wastewater were discovered through a comparative evaluation of these optimization techniques on their predictive power using R2 and MSE. These were used to measure the suitability of the RSM equation, ANN and ANFIS models. The ANFIS model, on the other hand, better defined the method, as evidenced by the lowest MSE and highest R2. The result obtained for ANFIS model are: R2 (0.9999) and MSE (0.0002643) for CTSS removal and R2 (0.9978) and MSE (0.00384728) for COD removal, respectively. Hence, it could be concluded that ANFIS is a better optimization tool for predicting the removal of CTSS and COD from textile wastewater.