2.1. Theoretical determination of animal manure, biogas, and energy potential
In the study, 2018 data from the Turkstat of Antalya, Isparta, and Burdur were used. As it is known, the Covid-19 Pandemic started in 2019. Therefore, data from 2018 were used in this study. The post-pandemic situation and its effect on livestock are the subjects of future studies. Information on the number of animals is given in Fig. 2. Each animal species was evaluated separately in its category. In the calculation of the manure amount, the data obtained from the farms of the relevant provinces were used for the live mass values according to the animal species and breed for each age group. In determining the daily amount of fresh manure, the percentage of live weight values was used, since a value that can represent Turkey, in general, is not available. These values were taken as 6% for cattle, 5% for small ruminants, and 4% for poultry. Using these values, the daily fresh manure values were calculated separately for each province according to the age and type of cattle and small ruminants, and poultry separately, and the total amount of manure was determined. The amount of animal manure varies according to the feeding, climatic conditions, and reproduction type. Availability coefficient (AC) according to animal species was taken as 50% for cattle, 13% for small ruminants, and 99% for poultry, respectively (Avcioǧlu and Türker 2012; Afazeli et al. 2014; Scarlat et al. 2015).
Details of the animal species are given in Tables 2, 3, and 4 (Dong et al. 2006). In these tables, VS, B0, MCF, MS (defined in Table 5) data used as parameters in CH4 calculation are also given. These parameters were used in the Tier 2 approach. Table 1 is a summary of Tables 2, 3, and 4 (Avcioǧlu and Türker 2012).
Table 1. Manure characteristics and biogas yields by animal breeds (Avcioǧlu and Türker 2012).
Animal
|
Age Range Month (Categorical)
|
Live Mass
(kg)
|
Fresh Manure Amount
|
Solid Manure
(SM)
(%)
|
Availability (AC)
|
Biogas yield
l/kg
|
% Mass
|
kg/day
|
Staying time in the barn (%)
|
Cattle
|
x<12
12<x<24
X<24
|
200-900
|
5-6
|
10-20
|
5-25
|
Dairy 65
Beef 25
|
200-350
|
Small Ruminant
|
x<6
6<x<12
12<x<24
X<24
|
20-100
|
4-5
|
2
|
30
|
13
|
100-310
|
Poultry
|
|
2-10
|
3-5
|
0.08-0.1
|
10-35
50-90
|
99
|
310-620
550-650
|
Animal
|
Age Range Month (Categorical)
|
Live Mass (kg)
|
VS
|
B0
|
MCF(%)
|
MS(%)
|
Table 2
Parameters and values used for cattle (Avcioǧlu and Türker 2012).
Dairy Cattle (Pure culture, female)
|
x < 12
|
300
|
2.8
|
0.13
|
0.2
|
0.38
|
Dairy Cattle (Pure culture, male)
|
x < 12
|
350
|
Dairy Cattle (Pure culture, heifer)
|
12 < x < 24
|
400
|
Dairy Cattle (Pure culture, cow)
|
24 < x
|
600
|
Dairy Cattle (Culture hybrid, female )
|
x < 12
|
350
|
Dairy Cattle (Culture hybrid, male)
|
x < 12
|
350
|
Dairy Cattle (Culture hybrid, heifer)
|
12 < x < 24
|
500
|
Dairy Cattle (Culture hybrid, cow)
|
24 < x
|
600
|
Dairy Cattle (Native, male)
|
x < 12
|
200
|
Dairy Cattle (Native, female)
|
x < 12
|
200
|
Dairy Cattle (Native, male)
|
12 < x < 24
|
250
|
Dairy Cattle (Native, cow)
|
24 < x
|
275
|
Dairy Cattle (Buffalo, heifer)
|
12 < x < 24
|
400
|
Dairy Cattle (Buffalo, cow)
|
24 < x
|
450
|
Pure Culture Cattle (Female)
|
x < 12
|
300
|
2.3
|
0.1
|
0.35
|
1
|
Pure Culture Cattle (Calf)
|
x < 12
|
350
|
Pure Culture Cattle (Bullock)
|
12 < x < 24
|
500
|
Pure Culture Cattle (Ox)
|
24 < x
|
850
|
Pure Culture Cattle (Bull)
|
24 < x
|
900
|
Hybrid Cattle (Bullock )
|
12 < x < 24
|
600
|
Hybrid Cattle (Bull)
|
24 < x
|
800
|
Hybrid Cattle (Ox)
|
24 < x
|
900
|
Native Cattle ( Bullock )
|
12 < x < 24
|
475
|
Native Cattle (Ox)
|
24 < x
|
475
|
Native Cattle (Bull)
|
24 < x
|
600
|
Buffalo (Male)
|
x < 12
|
250
|
Buffalo (Female)
|
x < 12
|
250
|
Buffalo (Bulllock)
|
12 < x < 24
|
400
|
Buffalo (Ox)
|
24 < x
|
500
|
Animal
|
Age Range Month (Categorical)
|
Live Mass (kg)
|
VS
|
B0
|
MCF(%)
|
MS(%)
|
Table 3
Parameters and values used for small ruminants (Avcioǧlu and Türker 2012).
Sheep (Merino, female-male, lamb)
|
x < 6
|
25
|
0.32
|
0.13
|
0.015
|
1
|
Sheep (Merino, female-male, yearling)
|
06 < x < 12
|
45
|
Sheep (Merino, female-male, yearling)
|
12 < x < 24
|
65
|
Sheep (Merino, female sheep)
|
24 < x
|
80
|
Sheep (Merino, ram)
|
24 < x
|
100
|
Sheep (Native, female-male, lamb)
|
x < 6
|
20
|
Sheep (Native, female-male, yearling )
|
6 < x < 12
|
35
|
Sheep (Native, female-male, yearling )
|
12 < x < 24
|
55
|
Sheep (Native, female)
|
24 < x
|
70
|
Sheep (Native, ram )
|
24 < x
|
90
|
Goat (Hair goat, female-male, yearling)
|
x < 6
|
20
|
0.35
|
Goat (Native, female-male,yearling )
|
6 < x < 12
|
35
|
Goat (Native, female-male, yearling)
|
12 < x < 24
|
55
|
Goat (Native, female)
|
24 < x
|
60
|
Goat (Native, male)
|
24 < x
|
80
|
Animal
|
Live Mass (kg)
|
VS
|
B0
|
MCF(%)
|
MS(%)
|
Table 4
Parameters and values used for poultry (Avcioǧlu and Türker 2012).
Turkey
|
10
|
0.02
|
0.24
|
0.015
|
1
|
Goose
|
4
|
Duck and Guinea fowl
|
2
|
Laying hen
|
2
|
Figure 3. was used in the calculation of biogas production from manure (Scarlat et al. 2015; Abdeshahian et al. 2016; Khan et al. 2021; Şenol et al. 2021). It also gives the standard coal, CO2 emission (Gao et al. 2019; Khalil et al. 2019) and the estimated electricity conversion (Scarlat et al. 2015; Benito et al. 2015; Khalil et al. 2019).
If animal manure is not collected and processed in a biogas production system, CH4 gas is naturally produced and released into the atmosphere. Agriculture and livestock production has a significant impact on the formation of greenhouse gas emissions, especially CH4, into the atmosphere (Riaño and García-González 2015).
Different methods are used to calculate CH4 emissions. Tier 1 is the simplest approach in which just the number of each animal type and the emissions per animal are multiplied. The more advanced approach is Tier 2, which is used in most developed countries. It is the product of several parameters per animal species. The assumed emission factors based on average annual temperature are given by the IPCC for each of the proposed livestock categories. Emission factors represent the range in manure volatile solids content and manure management application of each region and were evaluated based on the annual temperature for each climatic region. The formula in Table 5 and the emission factors of the relevant regions in table 10.11 of IPCC-2006 were used to calculate the CH4 emission with the Tier 1 approach. The formulas in Table 5 and the parameter values in Tables 2–4 were used in the calculation with the Tier 2 approach (Dong et al. 2006; Vanderzaag et al. 2013; Baek et al. 2014; Noorollahi et al. 2015; Shin et al. 2016; Ngwabie et al. 2018; Chen et al. 2020; Herrera et al. 2021; Zubir et al. 2022; Basak et al. 2022).
Table 5. Formulas for CH4 emission (Tier 1, Tier 2 approximations) (Dong et al. 2006; Vanderzaag et al. 2013; Baek et al. 2014; Noorollahi et al. 2015; Shin et al. 2016; Ngwabie et al. 2018; Chen et al. 2020; Herrera et al. 2021; Zubir et al. 2022; Basak et al. 2022).
2.2. Machine learning algorithms and performance evaluations
In this study, the characteristics and theoretical calculations of cattle, small ruminants, and poultry belonging to the provinces of Antalya, Isparta, and Burdur in 2018 were used. Modeling of biogas amount, CO2 emission, coal, electricity-thermal energy, and CH4 values was carried out by using general and specific information about animals, age, number, and manure of animals. To determine the model with the best results, machine learning algorithms SVM, MLP, and LR were used and hyper-parameter optimization was performed. The proposed algorithms have been preferred because of their popularity in the literature, their successful results in problem-solving in many fields, and their easy-to-understand structure. Matlab R2019a and PyCharm 2021.1 programs and scikit-learn 0.24 library were used for hyper-parameter optimizations and training of algorithms. Parameters of machine learning algorithms can greatly affect model success. For this reason, while determining the most suitable model for the related problem, training should be carried out with algorithms with appropriate optimum parameters. In this study, grid search was used to perform hyper-parameter optimization of machine learning algorithms. The grid search method creates a model for each determined combination of hyper-parameters and evaluates the performance so that the most optimal parameters of the relevant algorithm are determined (Pillai et al. 2019).
2.2.1. Support vector machine (SVM)
SVM is one of the most common machine learning algorithms and is used for both classification and regression problems (Smola and Schölkopf 2004). The SVM algorithm is a method based on pre-training, and it tries to create a linear or nonlinear kernel called a hyperplane to separate the classes of the data or to make a regression-based value estimation. In the literature on the SVM algorithm, kernels such as linear, polynomial, and radial basis functions (RBF) are used, and support vectors that can express the data most optimally are tried to be determined (Pisner and Schnyer 2020). v-SVM which is a different variant of SVM uses the nu parameter for controlling the number of support vectors for regression tasks.
2.2.2. Multi-Layer perceptron (MLP)
MLP is a supervised learning algorithm that learns target values by training on the data it receives as input. MLP uses the input layer, hidden layer, and output layer for classification or regression. In the feedforward neural network structure, which is preferred in this study, the cells are arranged in layers and the outputs of the cells in the layer can only be given as inputs to the next layer's overweights (Goodfellow et al. 2016). The output value of the cells is calculated with activation functions such as sigmoid, hyperbolic tangent, and rectifier linear unit (ReLU) (Cui et al. 2017). For the training of the MLP model, algorithms such as scaled conjugate gradient, Levenberg-Marquardt, and Bayesian editing methods are available from backpropagation methods. In addition to these, L-BFGS-B, SGD (Stochastic Gradient Descent) and adaptive moment estimation (Adam) methods have also achieved very good results in recent years. The scaled matched gradient method is an algorithm developed to reduce the direct search time and is based on merging reliable regions (Møller 1993). The Levenberg-Marquardt algorithm is a method based on the maximum neighborhood structure. The bayesian method updates the weight and bias values using the Levenberg Marquardt method (MacKay 1992; Dan Foresee and Hagan 1997). The SGD method provides gradient estimates using a specified number of samples from the data distribution. The Adam algorithm was created by increasing the momentum of the Rmsprop method (Goodfellow et al. 2016). L-BFGS-B is a gradient-based approach that has limited memory and is based on the trust region technique for solving large-scale optimization problems (Byrd et al. 1995).
2. 2. 3. Linear regression (LR)
LR allows the modeling of the output values by fitting a linear function to the input data. Regulation (regularization) is used in linear regression to solve the problem of multicollinearity and increase efficiency. Lasso regression (Least absolute shrinkage and selection operator), which is one of the frequently used regulation types, adds a penalty to the least-squares loss function by using the L1-norm penalty; Ridge regression, on the other hand, uses the L2-norm penalty to reduce the multicollinearity problem in linear regression that arises in models with many parameters (Tibshirani 1996). Ridge regression is seen in Eq. (1).
$$c={\left({\text{X}}^{\text{T}}\text{X}+\lambda \text{I}\right)}^{-1}{\text{X}}^{T}y$$
1
In Eq. (1), y is the output, X is the Vandermonde matrix, I is the identity matrix, and the ridge parameter λ ≥ 0 serves as the constant shifting of the diagonals of the moment matrix (Khalaf and Shukur 2005). One of the differences between Lasso and Ridge regression is that Lasso can discard other attributes while selecting important attributes, while ridge regression does not discard attributes completely. Elastic net, on the other hand, is another regulation technique and overcomes the limitations of the Lasso method by using a penalty function (Zou and Hastie 2005).
2. 2. 4. Grid search parameters
In this study, for SVM, one of the hyper-parameters determined for Grid search; {SVM, v-SVM} as algorithm type, {Linear, 2-3-4 degrees Polynomial, RBF} as kernel, {0.25, 0.45, 0.65, 0.85, 1.0} as ε/ν parameters and {100, 500, 1000} values were used as the number of iterations. For MLP, {L-BFGS-B, Sgd, Adam, Scg, Br, Lm} were used as the learning algorithm, {4, 8, 12, 16} as the number of hidden layer neurons, and {100, 500, 1000} as the number of iterations. For LR; {Ridge Regression, Lasso Regression, Elastic net, No regularization} methods including regularization or its variant were used. Other parameters that are not included in the grid search and are considered fixed are; Tolerance or learning rate of 0.005 was used in all algorithms with a Cost (C) value of 1 for SVM and an activation function of ReLU in MLP. The hyper-parameter values according to the models and algorithms are shown in Table 6.
Model
|
Algorithm
|
Kernel Type/Neuron size
|
ε/ν parameter
|
Iteration
|
Table 6
Hyper-parameter values for models and algorithms.
SVM
|
SVM, v-SVM
|
Linear, 2nd-3rd-4th degree polynomial, RBF
|
0.25, 0.45, 0.65, 0.85, 1.0
|
100, 500, 1000
|
MLP
|
L-BFGS-B, Sgd, Adam, Scg, Br, Lm
|
4, 8, 12, 16
|
-
|
100, 500, 1000
|
LR
|
Ridge Regression, Lasso Regression, Elastic net, No regularization
|
-
|
-
|
-
|
2 .2. 5. Performance metrics
Various metrics are used in the literature to measure the performance values of models trained with machine learning. Mean square error (MSE), root mean square error (RMSE), mean absolute error (MAE), and coefficient of determination (R2) were used in this study to determine the best model. MSE, RMSE, MAE, and R2 formulas are given in (Eqs. (2)-(5)), respectively.
$$MSE=\frac{1}{n}\sum _{i=1}^{n}{\left({Y}_{i}-{\widehat{Y}}_{i}\right)}^{2}$$
2
$$RMSE=\sqrt{\frac{1}{n}\sum _{i=1}^{n}{\left({Y}_{i}-{\widehat{Y}}_{i}\right)}^{2}}$$
3
$$MAE=\frac{1}{n}\sum _{i=1}^{n}\left|{Y}_{i}-{\widehat{Y}}_{i}\right|$$
4
In Eq. (2–4), Y is the target value, \(\widehat{Y}\) is the predicted value, and n is the number of samples.
$${R}^{2}=1-\frac{\sum _{i=1}^{n}{\left({Y}_{i}-{\widehat{Y}}_{i}\right)}^{2}}{\sum _{i=1}^{n}{\left({Y}_{i}-{\stackrel{-}{Y}}_{i}\right)}^{2}}$$
5
In Eq. (5), Y represents the target value, \(\widehat{Y}\) the predicted value, \(\stackrel{-}{Y}\) the mean of the target value, and n the number of samples.
In this study, Leave One Out Cross Validation (LOOCV), which is used to separate training and test data, was used to obtain more statistically accurate values while measuring the performance of machine learning algorithms. Cross-validation is an indication of how well a model can predict when it is trained to make new predictions for data it has not seen before. To overcome the problem known as overfitting in model training, when training a model, the entire dataset should not be used for training, but some of it should be used as test data, which creates data that the learner has never seen. Especially in small data sets containing less than 100 samples, the LOOCV method is used (Wong 2015). In the LOOCV method, only one sample is taken as the test set, and all the remaining samples in the data set are used as the training set. This process is repeated for each of the samples in the current data set, and the error of the model is found by averaging the results (Pasini 2015).