Application of Artificial Neural Network to Predict Biodiesel Yield from Waste Frying Oil Transesterification

Used frying oil (UFO) has a great potential as feedstock for biodiesel production. This study aims to develop an artificial neural network (ANN) model to predict biodiesel yield produced from base-catalyzed transesterification of UFO. The experiment was performed with 100 mL of UFO at three different molar ratios (oil:methanol) (namely 1:4, 1:5, and 1:6), conducted with reaction temperatures of 30 to 55oC (raised by 5oC), and reaction time of 0.25, 0.5, 1, 2, 3, 6, 8, and 10 minutes. Prediction model was based on ANN model consisting of three layers with 27 combinations of three activation functions (tansig, logsig, purelin). All activation function architectures were trained using LevenbergMarquardt train type with 126 data set (87.5%) and learning rate of 0.001. Model validation used 18 data set (12.5%) measured at reaction time of 8 min. Results showed that two ANN models with activation function of logsig-purelin-logsig and purelin-logsig-tansig be the best with RRMSE of 2.41% and 2.44% with R2 of 0.9355 and 0.9391, respectively. Predictions of biodiesel yield using ANN models are significantly better than those of first-order kinetics. Article History:


INTRODUCTION
Biodiesel is an alternative energy source for diesel fuel offering several advantages. First, biodiesel is made from vegetable oils or animal fats so it is classified as a renewable, biodegradable, and nontoxic energy source (Khan et al., 2013). Biodiesel, therefore, is ecologically friendly because the production and application of biodiesel results in lower greenhouse gas (GHG) emissions than petroleum fuels do. Studies in the United States (Sheehan et al., 1998) revealed that based on life cycle analysis biodiesel is able to decrease GHG emission 78% as compared to petroleum diesel fuel. Other works using various feedstock in different countries also reported that biodiesel application results in lower GHG such as in India with jatropha curcas (Kumar et al., 2012;Achten et al., 2010), China with various oils (Hou et al., 2011;Guo et al., 2010), Southeast Asia (Indonesia, Malaysia, Thailand) with palm oil (Siregar et al., 2015;Harsono et al., 2012;Hassan et al., 2011;Silalertruksa & Gheewala, 2012), Brazilia with soybean oil (Oliveira et al., 2017), and Europe with rapeseed oil (Malça & Freire, 2011). Second, unlike fossil fuels which are bestowed to a few countries, oil-plants producing biodiesel feedstock are spread throughout the world so that geopolitically biodiesel can be one that increase energy security (Paltsev, 2016).
The potential of used cooking oil in Indonesia is quite large because the consumption of cooking oil tends to increase from 0.198 L/capita per week in 2007 to 0.205 in 2012 and 0.221 in 2017. This figure is very close with the study of Fujita et al. (2013) in Bogor, which found cooking oil consumption of one family is 3L/month or 36 L/year. With a proper management, UFO has great potential to be used as energy sources in the form of biodiesel to replace diesel oil (Chhetri et al., 2008). The development of biodiesel from UFO will provide a healthier choice in the utilization of UFO.
The reaction usually chosen to produce biodiesel from oil is transesterification with methanol and a basic catalyst (Fajardo et al., 2011). For every mol of triglyceride or vegetable oil, the process stoichiometrically required three mols of methanol to produce three mols biodiesel or FAME (fatty acid methyl ester) and one mol glycerol, as presented in Equation (1). (1)

Triglyceride
Methanol Biodiesel Glycerol Important factors in biodiesel synthesis, among other, include molar ratio (MR) of oil to methanol, reaction temperature (T), and reaction duration (t). Transesterification is a reversible and equilibrium reaction so that to obtain maximum yield should be carried out with excess of methanol (Ejikeme et al., 2010), rather than 1:3 as in Equation 1. The disadvantage of this reaction is that there may be a side reaction in the form of safonification, which will consume the catalyst so that reducing biodiesel yield, especially if the FFA content in UFO is quite high (Narasimharao et al., 2007). The relation of biodiesel yield and dependent variables is unlinear and so complex that require a robust model to accurately predict the yield. Conventional approaches such as Utilization of vegetable oils as feedstock for biodiesel production is more expensive because the cost of raw materials can reach 80 to 85% of operational costs (Canakci & Sanli, 2008;Hindryawati et al., 2014). One potential cheaper raw material is used frying oil (UFO), which is not alowed to be dumped directly because it has a high COD value. In addition, UFO contains toxic compound formed during high temperature heating like hydroperoxides and aldehydes. When these compounds ingested through consumed food, they may be responsible for increasing blood pressure (hypertension) and attributable to cardiovascular diseases and diabetes (Leong et al., 2015;Jaarin et al., 2018). Repeatedly heated cooking oils even produce carcinogenic compounds such as polycyclic aromatic hydrocarbons that relate to the incidence of tumor and cancer diseases (Ganesan et al., 2017). Therefore, using UFO repeatedly to fry food or to make food-related ingredient, such as chili sauce, may endanger human health. kinetics analysis can be applied successfully in certain constrained environments, but it is not flexible in different conditions. The complexity of these relationships can be analyzed using ANN (artificial neural network) models so as to produce high accuracy prediction of biodiesel yield (Lavalle et al., 2012;Seo, 2013). ANN model has been an important tool to solve many problems in a wide range of areas such as pattern recognition, function approximation, categorization, prediction, optimization, associative memory, and control (Jain et al., 1996). Recently, ANN model is explored to predict biodiesel yield (Thoai et al., 2018). The ANN model has also been used to predict biodiesel properties such as viscosity, cloud point, fash point, pour point, and cetane number (Giwa et al., 2015;Al-Shanableh et al., 2016).
The general objective of this study was to predict biodiesel yield resulted from UFO transesterification reaction which is broke down into three specific objectives. First, it was to examine the relationship between molar ratio, reaction temperature, and reaction time as independent variables to biodiesel yield as the dependent variable. Second, it was to develop ANN models to predict biodiesel yield from UFO transesterification reaction. Third, it was to validate ANN models to obtain the most accurate models in predicting biodiesel yield.

Biodiesel synthesis
The UFO was collected from fried food pedlars in the vicinity of the University of Lampung. Biodiesel was sinthesized by transesterification reaction using 100 ml UFO with methanol and NaOH. Combination of three different molar ratios (MR) of oil to methanol (1:4; 1:5; 1:6), six temperature (T) levels (30,35,40,45,50, 55 o C), and eight points of reaction time, t (0.25, 0.5, 1, 2, 3, 6, 8, 10 minutes) was run to evaluate their effect on biodiesel yield. Detail of materials and processing method have been recently reported elsewhere (Haryanto et al., 2019). Figure 1 shows a step-by-step ANN model development to validation. The ANN model to be developed is back-propagation type with supervised learning method.  variables, two hidden layers are used, each with five neurons or nodes. Karsoliya (2012) guided that neuron number of hidden layer is less than twice of the number of neurons in input layer.

ANN model development
The ANN model works in three steps, namely feed forward, back-propagation, and weight adjustments which are calculated based on the established equations (Widodo et al., 2013). At the first step, each input node receives an input value, xi (i = 1, 2, 3, ..., n) and forwards the signal to all nodes in the hidden layer. Each hidden layer node will add all the weighted input signals (z_inj), which is xi multiplied by the weight (vij) and added by received bias, bj (j = 1,2,3, ..., p) as in Equation 2. By activation function as in Equation 3, the signal coming out from the hidden layer node is then calculated.
In this work, three activation functions (logsig, tansig, and purelin) were selected that 27 combinations need to be validated. These three functions are defined and presented graphically in Figure 3.
Each output layer node, yk (k = 1,2,3, ..., m), will add up all signals from the hidden layer nodes (multiplied by weight, wjk and added bias, bk) as in Equation 4. The signal coming out of the output node is calculated by using activation function (Equation 5).  The second step (back-propagation) starts by calculating the error information (δk) between each output node (yk) with target value (tk) associated with data for learning as in Equation 6. In order to correct the weight and bias values, correction for weight (Δwjk) and bias (Δbk) are calculated using the predetermined learning rate (α) as given in Equation 7 and Equation 8.
Each output unit is fixed by new value of its weight and bias as in Equations 12 and 13, and similarly, for each hidden unit as in Equation 14 and 15 (Widodo et al., 2013).
The ANN model construction was build using toolbox of MATLAB.

Model training
The ANN training process is preceded by network initialization to determine initial network architecture so that the network training process can be carried out. Twenty seven variations in activation function are combination of logsig, tansig, and purelin (Dorofki et al., 2012). Input data involved molar ratio, reaction time, and reaction temperature; whereas biodiesel yield was target parameter. Out of 144 data set ( Table  1), 126 data pairs (87.5%) were used for the training using Levenberg-Marquardt training type (Anandhi et al., 2012) with learning rate (α) of 0.001 (Amini, 2008). The maximum number of iterations was set at 1000 and the smallest mean square error (MSE) is 0.00001 (Kusuma & Abadi, 2011).

Model validation
Model validation was performed to assess the accuracy between predicted and observed values. All data values (Table 1) collected at reaction time of eight minutes (12.5%) were used for validation session. In this case, validation was evaluated using relative root mean square error (RRMSE) and coefficient of determination (R 2 ) with a target to obtain the smallest RRMSE and the highest R 2 values.
where n is the number of data, Oi is the observed value of i th , Pi is the predicted value of i th , and O is the average observed value. The predicted yield is classified as ex-cellent with RRMSE < 10%, good (10-20%), fair (20-30%), and poor (> 30%) (Li et al., 2013).
The R 2 is used to assess the closeness of calculated values to the measurement data. The predictions are considered excellent if R 2 close to one (Despotovic et al., 2016).  Table 2 shows a summary of the results from training and validation of 27 models of architectural combination of logsig-tansig-purelin activation functions. Model accuracy was evaluated from the RRMSE and R 2 values of the models. We observed that during training session 24 out of 27 combination models demonstrated excellent accuracy with RRMSE values of less than 10% (between 3.32 and 6.90%) and R 2 of more than 0.90 (between 0.9364 and 0.9860). The remaining three models (purelin-purelin-purelin, purelin-purelin-tansig, and purelinpurelin-logsig) can still be grouped as good models with RRMSE values between 11 and 12.5%; and R 2 values between 0.7589 and 0.8307. During the training session, the best architecture is tansig-tansig-purelin with RRMSE value of 3.32% and R 2 of 0.9860. However, this model failed as the best model during validation session. The RRMSE value of this model rised to 4.53%, and its R 2 decreased significantly to 0.8382.
During the validation session, 25 out of the 27 models met the excelent criteria with RRMSE values of less than 10%. Two models fallen into fair group with RRMSE values of 23.71 and 27.95%. Even three lowest models previously mentioned (which have RRMSE values of greater than 10% in the training session) and exhibited excelent RRMSE (< 10%) during validation. However, if the models are examined from its determination coefficients, some of the best models have very low R 2 values, and five models have even negative R 2 . This means that the accuracy of the results during the training session does not always reflect that the validation results will also be accurate. The mentioned three lowest models in the training session even displayed the worst performance with a negative R 2 values during validation session. Nine architectural models defended themselves as excelent models with R 2 values greater than 0.90 and RRMSE values lest than 10%. During validation session, however, the RRMSE of these models are lower as compared to those values during training session.
Based on the discussion above, the selection of the best activation function network architecture (that in turn will be used as a prediction model) must be based on both the smallest RRMSE value and the highest R 2 value in the validation session. A low RRMSE value indicates a small deviation from all data so that the prediction model successfully achieves a high level of accuracy. On the other side, high R 2 value indicates a very close relationship between calculated and observed biodiesel yields.

Activation function
Training Validation  Among the excellent models appeared during validation session, ANN models with activation function architecture of logsigpurelin-logsig, and purelin-logsig-tansig be the best two with RRMSE of 2.41% and 2.44%, respectively, and R 2 of 0.9355 and 0.9391, respectively. During the training session these models (logsig-purelin-logsig and purelin-logsig-tansig) are also among the excelent models with RRMSE less than 10% and R 2 greater than 0.90. Figures 4 and  5 show the scater between predicted and observed values of biodiesel yield, both in training session and validation session. Previously, we have reported the prediction of biodiesel yield at the same conditions using first order kinetic approach, and the result showed excellent predictions with RRMSE of 3.39%, but R 2 value of 0.8454 (Haryanto et al., 2019). Compared to the results from this study, it is clear that application of ANN model provide better prediction than those of first order kinetic. Other works also reported the superiority of the ANN model for biodiesel prediction compared to other common tools such as linear regression and partial least squares regression (Ozgur & Tosun, 2017;Balabin et al., 2011). For a comparison, Table 3 summarized other studies on the application of ANN in predicting biodiesel content and biodiesel properties. It can be summarized that our result is comparable with other works and further emphasize that ANN model is a powerfull tool to predict biodiesel yield from different reaction conditions.

CONCLUSION
The network architecture of the ANN model consists of three layers with three nodes in the input layer, five nodes in the first and the second hidden layers, and one node in the output layer. The type of training used is the Levenberg-Marquardt with a learning rate of 0.001. Twenty seven (27) architectural combinations of three activation function (logsig, tansig, purelin) have been trained using 126 data set (87.5%) of biodiesel yield observed at three different molar ratios, six different temperatures and seven points reaction time, and have been validated using 18 data set (12.5%) observed at reaction time of eight minutes. Results confirmed that models with activation function of logsigpurelin-logsig and purelin-logsig-tansig be the best with RRMSE of 2.41 and 2.44% with R 2 of 0.9355 and 0.9391%, respectively.

ACKNOWLEDGEMENTS
The research was financially supported by the DGHE (Directorate General of Higher Education), the Ministry of Research, Technology and Higher Education, through research scheme of FUNDAMENTAL with contract: 071/SP2H/LT/ DRPM/IV/2017585 (June 2, 2017). The views expressed in this paper, however, are solely of the authors.

AUTHORS' NOTE
The authors declare that there is no conflict of interest regarding the publication of this article. Authors confirmed that the data and the paper are free of plagiarism.