Application of Mamdani Fuzzy Inference System in Poultry Weight Estimation

Simple Summary With the rapid technological advances, the application of artificial intelligence (AI) has witnessed significant growth in the agricultural industry, specifically in the poultry sector. The use of AI in estimating poultry weight can significantly impact production economics and overall efficiency in the poultry sector. Therefore, this paper presents an innovative AI approach based on the fuzzy logic (FL) method for estimating poultry weight. The FL models were created using expert knowledge and key input variables such as indoor temperature, humidity, and feed consumption. This study’s findings demonstrate that FL-based methods exhibit great promise for achieving accurate and efficient poultry weight estimation. Integrating the FL technique in the poultry industry can bring numerous benefits, including improved decision-making processes, enhanced efficiency, and reduced costs. Abstract Traditional manual weighing systems for birds on poultry farms are time-consuming and may compromise animal welfare. Although automatic weighing systems have been introduced as an alternative, they face limitations in accurately estimating the weight of heavy birds. Therefore, exploring alternative methods that offer improved efficiency and precision is necessary. One promising solution lies in the application of AI, which has the potential to revolutionize various aspects of poultry production and management, making it an indispensable tool for the modern poultry industry. This study aimed to develop an AI approach based on the FL model as a viable solution for estimating poultry weight. By incorporating expert knowledge and considering key input variables such as indoor temperature, indoor humidity, and feed consumption, FL-based models were developed with different configurations using Mamdani inferences and evaluated across eight different rearing periods in Samsun, Türkiye. This study’s results demonstrated the effectiveness of FL-based models in estimating poultry weight. The models achieved varying average absolute error values across different age groups of broilers, ranging from 0.02% to 5.81%. These findings suggest that FL-based methods hold promise for accurate and efficient poultry weight estimation. This study opens up avenues for further research in the field, encouraging the exploration of FL-based approaches for improved poultry weight estimation in poultry farming operations.


Introduction
The increasing world population is expected to pose significant challenges for meeting the growing food demand in the coming years [1,2]. Poultry meat production has proven to be a crucial factor in meeting this demand due to its ability to efficiently produce highquality protein, making it a key player in the global food system [3]. The world's chicken meat production has been continuously expanding since 2015 and reached 102 million tons in 2022 due to its affordable prices and superior quality nutrition [4]. Although projected to FL enables handling such complex, uncertain, and imprecise information and can improve the accuracy and reliability of decision-making processes [15,[23][24][25].
The literature presents numerous studies that utilize various AI techniques for modeling poultry production data. For example, the authors of [26] implemented a three-layer feedforward artificial neural network to predict body weight in broiler chickens. In ref. [27], the author employed neural network models to predict the growth of broiler chickens over the next 50 days using actual growth data. In the research of [28], a novel approach was proposed for modeling the growth of broiler chickens by introducing a differential recurrent neural network. The researchers in [29] explored the feasibility of analyzing the growth of chickens using a radial basis function neural network approach. In ref. [30], the author developed an artificial neural network model that effectively established the relations between the input and output variables of feed intake, weight gain, and feed conversion ratio. In the investigation of [31], dynamic neural network forecasting models were trained on farm-scale broiler batch production data from 12 batches within the same house. These models were used to forecast future broiler weight while incorporating environmental conditions such as heating, ventilation, temperature, and behavioral factors like feed and water consumption. The study's findings indicated that the model successfully captured the dynamic interconnection between environmental conditions and broiler growth, highlighting the model's ability to accurately predict the future growth patterns of broilers based on the provided inputs. The authors of [32] demonstrated that their neural network model achieved satisfactory performance in predicting the feed conversion of broilers under heat stress.
These studies have contributed significantly to our understanding; however, to the best of our knowledge, this study is a pioneering study that, for the first time, reports the use of FL systems for estimating broiler weights in poultry buildings. Particularly, this study addresses the following research questions: (1) What is the predictive ability of FL systems in estimating bird weights in poultry houses? (2) What is the effect of the different defuzzification methods in the developed FL model for weight estimation? (3) What potential impact will the developed FL model have on the poultry industry? Various research methods were used to address these research questions. After conducting the literature survey and finding the research gaps, the main contribution of the current work will be to provide a novel method for estimating the broiler weights in poultry buildings based on an FL approach.
The remaining sections of the article are organized as follows: Section 2 describes the methodology proposed in the study, detailing the approach for estimating broiler weights in poultry buildings. Section 3 presents the results obtained from implementing the proposed methodology. It includes the findings related to broiler weight estimation using the FL systems and any additional analyses. The discussion section (Section 4) analyzes and interprets the results obtained. It provides insights into the implications of the findings, explores potential limitations faced during the study, and compares the outcomes with previous research. Section 5 summarizes the main findings of the study and highlights their significance. Additionally, it offers recommendations for future research directions.

Experimental Building and Data
The research was conducted at a commercial broiler farm located in Samsun, Türkiye (41 • 70 N, 36 • 30 E). The farm had the dimensions of 90 m in length, 14 m in width, and 3.80 m in height. Chickens from the "Ross 308" breeding stock were reared until they reached 40-42 days of age. The farm utilized an automatic control system to regulate ventilation, heating, lighting, feeding, and watering. Chicken weights and feed consumption were recorded weekly over eight rearing seasons. The statistical parameters of indoor temperature, indoor relative humidity, feed consumption, and chicken weights are shown in Table 1.

Fuzzy Logic (FL)
FL was introduced by ref. [33] in the 1960s as a mathematical framework for dealing with uncertainty and ambiguity in decision making. FL extends classical (crisp) set theory by allowing degrees of membership or truth values between 0 and 1 rather than just binary membership (either 0 or 1), as in classical set theory [33].
FL is an expert system composed of fuzzification, knowledge base, inference engine, and defuzzifier parts [34,35]: Fuzzifier: It converts crisp input values (e.g., numerical values) into fuzzy values, representing degrees of membership in fuzzy sets. The fuzzifier takes input values and maps them to fuzzy sets using membership functions, which define the shape of the fuzzy sets and determine how input values are transformed into fuzzy values.
Knowledge Base: It contains the fuzzy rules and the associated fuzzy sets. Fuzzy rules are typically expressed in the form of "If-Then" statements, where the antecedent (input) part consists of fuzzy sets and the consequent (output) part consists of fuzzy sets or crisp values. The knowledge base stores these rules, which are used for making decisions or performing actions based on the fuzzy input values.
Inference Engine: It is responsible for applying the fuzzy rules to the fuzzy input values to determine the fuzzy output values. The inference engine uses FL operations, such as AND, OR, and NOT, to combine the fuzzy sets and perform fuzzy reasoning. The result is a set of fuzzy output values representing the degrees of membership in fuzzy sets for the output variables.
Defuzzifier: It is responsible for converting the fuzzy output values into crisp output values. The defuzzifier takes the fuzzy output values and maps them back to crisp values using various methods, such as centroid, mean of maximum, or weighted average. The crisp output values represent the final decisions or actions based on the fuzzy input values and the fuzzy rules.

Fuzzification
Membership functions are determined as the initial step in designing a Mamdani fuzzy inference system (MFIS), considering the fact that fuzzy inputs are used [36]. The membership functions can take different functional forms to represent different degrees of fuzziness, such as linear, concave, and exponential forms. Among these, the linear triangular and linear trapezoidal membership functions are commonly used in many studies [37].
A triangular fuzzy number is defined by a membership function that assigns membership degrees to values within a certain range (Figure 1a). The membership function for a triangular fuzzy number with the triplet (a, b, c) can be described as follows: Membership functions are determined as the initial step in designing a Mamdani fuzzy inference system (MFIS), considering the fact that fuzzy inputs are used [36]. The membership functions can take different functional forms to represent different degrees of fuzziness, such as linear, concave, and exponential forms. Among these, the linear triangular and linear trapezoidal membership functions are commonly used in many studies [37].
A triangular fuzzy number is defined by a membership function that assigns membership degrees to values within a certain range (Figure 1a). The membership function for a triangular fuzzy number with the triplet (a, b, c) can be described as follows: A trapezoidal fuzzy number is characterized by a membership function that assigns membership degrees to values within a specific range (Figure 1b). The membership function for a trapezoidal fuzzy number with the vertices (a, b, c, d) can be defined as follows:

Fuzzy Rule Base
The establishment of rules holds a central position within a fuzzy inference system (FIS). These rules are typically expressed using linguistic terms, offering a more intuitive representation compared to numerical terms. The commonly adopted format for these rules is the "If-Then" structure, which applies well to implementing fuzzy conditional statements. The utilization of If-Then'' rules is crucial because they provide a means to effectively capture and embody human expertise and knowledge within a fuzzy A trapezoidal fuzzy number is characterized by a membership function that assigns membership degrees to values within a specific range ( Figure 1b). The membership function for a trapezoidal fuzzy number with the vertices (a, b, c, d) can be defined as follows:

Fuzzy Rule Base
The establishment of rules holds a central position within a fuzzy inference system (FIS). These rules are typically expressed using linguistic terms, offering a more intuitive representation compared to numerical terms. The commonly adopted format for these rules is the "If-Then" structure, which applies well to implementing fuzzy conditional statements. The utilization of "If-Then" rules is crucial because they provide a means to effectively capture and embody human expertise and knowledge within a fuzzy framework [38]. When it comes to deriving fuzzy rules, various approaches exist, including integrating expert knowledge and applying fuzzy modeling techniques. The present study implemented a fuzzy model by defining a set of fuzzy linguistic rules based on expert knowledge.

Inference Engine and Defuzzification
The fuzzy interface engine is an essential component of an FL system that processes the inputs and applies the rules to produce a meaningful output. It combines the linguistic variables and fuzzy sets identified in the previous steps to make a decision. The integration process combines the individual fuzzy areas determined in the previous step to generate the overall fuzzy conclusion. This process involves aggregating the fuzzy sets, considering the weights assigned to each rule and output fuzzy set.
The fuzzy inference process used in this step typically employs the "min-max inference" method. This method uses the minimum and maximum operators to determine the degree of membership of the output variable in the fuzzy sets. The minimum operator is used to find the degree of membership of the input variable in the corresponding fuzzy set, while the maximum operator is used to determine the degree of membership of the output variable in the fuzzy set associated with the rule [39].
The result of the integration step is a fuzzy conclusion that provides an output value or a range of values. This output value is then defuzzified to obtain a crisp value that can be used as the final decision or as an input to another system. There are several popular defuzzification approaches, including the center of area method (COA), the bisector of area method (BOA), the mean of maximum method (MOM), the smallest of maximum method (SOM), and the largest of maximum method (LOM) [40]. This paper used these defuzzification methods to prove the model's validity. The predictive abilities of these methods were investigated according to the coefficient of determination (R 2 ), mean absolute error (MAE), and root mean square error (RMSE). The equations are defined below: In addition, the prediction of the MFIS model was made according to the absolute percentage error (APE) as follows: where X mea is the measured value of variables, X est is the estimated value of variables, and X mea,avg and X est,avg are the measured and estimated average values of variables, respectively. n is the sample number.

Results
The determination of membership functions is a critical step in developing an accurate and reliable FIS. It requires expert knowledge, careful analysis, and sound judgment. This paper used triangular and trapezoidal membership functions due to their simplicity and good computational efficiency. We employed five fuzzy sets of membership functions for the inputs and outputs of the MFIS (FIS 1, FIS 2, FIS 3, FIS 4, FIS 5, and FIS 6). The fuzzy sets were represented in the form of linguistic rating variables, such as "Very Low", "Low", "Medium", "High", and "Very High" for the weeks of the rearing period, as shown in Table 2. The memberships of the inputs and output of the MFIS are illustrated in Figures 2 and 3, respectively.          µ M ( f c) = 0.00 160.00 + 0.10 162.00 + · · · + 1.00 170.00 + · · · + 0.10 198.00 + 0.00 200.00 (11)  + · · · + 0.50 210.00 + · · · + 0.90 218.00 + 1.00 220.00 (14) After determining the fuzzy sets in the form of linguistic rating variables, the next step was to establish rules based on expert knowledge. In this case, a total of 97 possible rules were formed from the six FISs: 10 rules for FIS1, 20 rules for FIS2, 15 rules for FIS3, 15 rules for FIS4, 17 rules for FIS5, and 20 rules for FIS6. For example, if the indoor temperature is "Low", indoor relative humidity is "Low", and feed consumption is also "Very Low", then the weight for FIS1 output is "Very Low". Another example of a rule is, if the indoor temperature is "Medium", indoor relative humidity is "Medium", and feed consumption is also "Very High", then the weight for FIS6 output is "High". However, since there were too many rules to display, only some of the dominant rules in the proposed model are listed in Table 3.  In the last step of the MFIS, a defuzzification process was performed to obtain crisp values. We applied various defuzzification methods, including COA, BOA, MOM, SOM, and LOM, to demonstrate the model's validity. The R 2 , RMSE, and MAE results of these models are presented in Figure 4a-c. These figures indicate that the COA defuzzification method outperformed the others based on the R 2 , RMSE, and MAE criteria. The BOA, MOM, and SOM methods followed closely behind, while the LOM method was the least accurate model. Therefore, the COA method was used for the defuzzification process in further experiments. In the last step of the MFIS, a defuzzification process was performed to obtain crisp values. We applied various defuzzification methods, including COA, BOA, MOM, SOM, and LOM, to demonstrate the model's validity. The R 2 , RMSE, and MAE results of these models are presented in Figure 4a-c. These figures indicate that the COA defuzzification method outperformed the others based on the R 2 , RMSE, and MAE criteria. The BOA, MOM, and SOM methods followed closely behind, while the LOM method was the least accurate model. Therefore, the COA method was used for the defuzzification process in further experiments.
The measured and estimated broiler weight values and their corresponding APE values are presented in Table 4. The APE values for FIS1, FIS2, FIS3, FIS4, FIS5, and FIS6 ranged between 0.02-5.78%, 0.21-5.81%, 0.12-4.84%, 0.41-4.29%, 0.15-3.66%, and 0.37-2.47%, respectively, depending on the season.     Table 4. The APE values for FIS1, FIS2, FIS3, FIS4, FIS5, and FIS6 ranged between 0.02-5.78%, 0.21-5.81%, 0.12-4.84%, 0.41-4.29%, 0.15-3.66%, and 0.37-2.47%, respectively, depending on the season.  Figure 5 illustrates box plots that depict the distribution of the data. As shown in the figure, the measured weight values ranged from 146 g to 2666 g, while the estimated values ranged from 154.4 g to 2649.83 g. The data indicated that the MFIS models exhibited higher accuracy in predicting broiler weight.  Figure 5 illustrates box plots that depict the distribution of the data. As shown in the figure, the measured weight values ranged from 146 g to 2666 g, while the estimated values ranged from 154.4 g to 2649.83 g. The data indicated that the MFIS models exhibited higher accuracy in predicting broiler weight.

Discussion
Physical growth characteristics are critical factors that determine the efficiency of poultry production. Body weight is a crucial indicator of overall poultry health and development and is a key factor in determining the market value of poultry [6]. Traditional methods of measuring poultry weight can compromise bird welfare and may even lead to lower quality and yield or death [8]. FL represents a promising alternative approach to poultry weight estimation that can handle uncertain and imprecise data while modeling complex, nonlinear relations among variables.
AI models for poultry growth prediction offer several advantages over traditional methods, including faster predictions, greater accessibility, and the ability to simultaneously analyze a wide range of variables [20,41,42]. However, it is crucial to handle the data appropriately to ensure that the model's predictions are accurate and unbiased.
The application of AI models in poultry growth prediction is expanding. For instance, in the investigation of [17], the utilization of AI models with various training inputs resulted in a prediction accuracy of growth and body weight in broiler chickens ranging

Discussion
Physical growth characteristics are critical factors that determine the efficiency of poultry production. Body weight is a crucial indicator of overall poultry health and development and is a key factor in determining the market value of poultry [6]. Traditional methods of measuring poultry weight can compromise bird welfare and may even lead to lower quality and yield or death [8]. FL represents a promising alternative approach to poultry weight estimation that can handle uncertain and imprecise data while modeling complex, nonlinear relations among variables.
AI models for poultry growth prediction offer several advantages over traditional methods, including faster predictions, greater accessibility, and the ability to simultaneously analyze a wide range of variables [20,41,42]. However, it is crucial to handle the data appropriately to ensure that the model's predictions are accurate and unbiased.
The application of AI models in poultry growth prediction is expanding. For instance, in the investigation of [17], the utilization of AI models with various training inputs resulted in a prediction accuracy of growth and body weight in broiler chickens ranging from 98% to 99%. In another study, conducted for ref. [26], the AI approach appeared highly satisfactory, and the performance was very high, at approximately 99%. This level of performance was deemed acceptable by broiler researchers. The authors of [43] aimed to enhance the prediction of live weight using various artificial neural network techniques, such as Bayesian regulation, Levenberg-Marquardt, scaled conjugate gradient, and gradient descent. Among these, Bayesian regulation exhibited the best performance with an R 2 value of 0.98 for predicting broiler weight. Ref. [27] utilized various neural network models to forecast the growth of broiler chickens for a subsequent 50 days, based on actual growth data. The study concluded that differences between the response of the neural network models and the actual poultry could be attributed to a variety of factors, including the pattern of the data, the examples used for training and testing, the architecture of the network, and the training process of each model.
These above-mentioned studies can provide valuable insights into the factors that influence poultry growth and help producers optimize their operations for greater efficiency and profitability. However, no study has been conducted about using FL systems to estimate poultry building broiler weights. This paper introduces a novel FL-based approach for estimating broiler weights in poultry buildings. The proposed method achieved mean absolute percentage errors (MAPEs) of 2.83%, 2.95%, 2.52%, 2.08%, 2.03%, and 1.20% based on rearing weeks, demonstrating its effectiveness. Similarly, in the studies conducted by the authors [44,45], neural networks achieved MAPEs ranging from 1.32% to 1.99% and 1.83% to 4.07%, respectively, for biological growth modeling. These findings highlight the potential of neural networks as an alternative approach to regression analysis for accurately modeling biological growth processes.
FL-based models have several limitations, despite their usefulness in handling uncertainty and imprecision. Foremost among them, these models can become highly complex, especially when dealing with multiple input variables and numerous linguistic rules. The more complex the system becomes, the more difficult it can become to interpret and manage it effectively. Moreover, building an accurate FL model often requires expert input to refine the linguistic variables and membership functions. However, eliciting expert knowledge can be time-consuming and subjective, leading to biases in the model. Like other AI models, FL models are also prone to overfitting if the training data does not adequately represent the entire domain. Overfitting can lead to poor generalization and inaccurate predictions. Despite these limitations, FL remains a valuable tool for certain problems, especially in the presence of uncertainty and vagueness, and when expert knowledge is readily available to build a useful model.
While this study produced noteworthy results, it is important to consider its limitations. Specifically, this study only focused on researching the use of FL for weight estimation. Future studies should explore practical approaches for the automatic weight estimation of live broiler chickens using machine vision and FL, which could have significant implications for the poultry industry.

Conclusions
Accurately estimating poultry body weight is a critical task for the poultry industry, as it directly affects farm management and profitability. To this end, researchers have explored various approaches to estimating poultry body weight, including traditional methods and advanced AI techniques. This research introduces a novel technique for the weight estimation of broiler chickens utilizing an FL approach. The developed Mamdani FL model was evaluated using different defuzzification methods to obtain the best results, with the COA method ultimately used for the defuzzification process. The FL models (FIS1, FIS2, FIS3, FIS4, FIS5, and FIS6) showed APE values (%) ranged between 0.02-5.78, 0.21-5.81, 0.12-4.84, 0.41-4.29, 0.15-3.66, and 0.37-2.47, respectively, depending on the season.
These results suggest that FL systems with Mamdani inference, which include triangular and trapezoidal membership functions of input-output variables and COA defuzzification, have potential for accurately and efficiently estimating the weight of poultry and could pave the way for further research in this field. However, there is still room for further research to develop more accurate and practical methods for automatic weight estimation of live broiler chickens using machine vision. By exploring innovative approaches, the poultry industry can continue to improve its management practices and ensure the optimal growth and productivity of poultry flocks.

Data Availability Statement:
The data presented in this study are available on request from the corresponding author.