RESEARCH
Open Access © The Author(s) 2026. Open Access This article is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License, which permits any non-commercial use, sharing, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if you modified the licensed material. You do not have permission under this licence to share adapted material derived from this article or parts of it. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creati vecommons.org/licenses/by-nc-nd/4.0/.
Delgado et al. BMC Veterinary Research (2026) 22:218 https://doi.org/10.1186/s12917-026-05349-3 BMC Veterinary Research *Correspondence:
Olatunbosun Odu o.odu@ui.edu.ng Full list of author information is available at the end of the article Abstract Background Reliable and cost-effective live weight determination is critical for improving both management and selection efficiency in small-scale sheep farming. In recent years, machine learning approaches based on phenotypic biometric measurements have emerged as a practical alternative for producers with limited access to weighing infrastructure. This study aimed to compare the performance of two machine learning algorithms (XGBoost and Random Forest) for estimating live weight based on biometric measurements in Blackbelly sheep (60 females, 60 males) raised in humid tropical climates.
Results Using the obtained biometric measurements, both algorithms were evaluated separately for training and test sets. The XGBoost algorithm demonstrated high accuracy on the training data (R2 = 0.981; MSE = 0.416; RMSE = 0.645; MAE = 0.486; AIC = 150.513 and BIC = 157.841) but had limited generalization to the test data (R2 = 0.813; MSE = 3.296; RMSE = 1.816; MAE = 1.440; AIC = 146.125 and BIC = 150.791). In contrast, the Random Forest algorithm produced more balanced and stable predictions on both training (R2 = 0.969; MSE = 0.630; RMSE = 0.794; MAE = 0.617; AIC = -31.230 and BIC = -21.459) and test data (R2= 0.873; MSE = 2.188; RMSE = 1.479; MAE = 1.105; AIC = 35.401 and BIC = 41.623). Optimal hyperparameters were determined for both models, and model fit criteria were compared. The results revealed that Random Forest offers a more reliable and stable option for estimating live weight. Conclusions The current study demonstrates that machine learning models based on phenotypic biometric measurements can be used in decision-support processes in small-scale sheep farming operations. The Random Forest algorithm stands out as a suitable tool for improving production and selection efficiency in live weight estimation. Furthermore, validation studies encompassing different sheep breeds and larger data sets will strengthen the reliability and generalizability of the developed models.
Application of XGBoost and Random Forest algorithms for body weight prediction in Blackbelly sheep using biometric measurements Miguel Ángel Gastelum Delgado1 , Cem Tırınk2 , Rosa Inés Parra-Cortés3 , Ignacio Vázquez Martínez1
,
Armando Gomez-Vazquez1 , Aldenamar Cruz-Hernandez1 , Enrique Camacho-Pérez4
,
Dany Alejandro Dzib-Cauich5 , Hasan Önder6 , Uğur Şen7 , Kadyrbai Chekirov8 , Yüksel Aksoy9
,
Hilal Tozlu Çelik10 , Olatunbosun Odu11* and Alfonso J. Chay-Canul1
Page 2 of 11 Delgado et al. BMC Veterinary Research (2026) 22:218 Background Sheep have played a significant role in obtaining ani mal-based products (meat, milk, and wool) for many civilizations from the past to the present and maintain their importance as multipurpose small ruminants that contribute to developing rural economies within the framework of sustainable development goals [1]. In this context, sustainable animal breeding practices are critical in preserving the ecological balance and efficient use of natural resources [2]. In addition, using highly adaptable animals for each region within the scope of sustainable animal breeding is extremely important. In this context, Blackbelly sheep, which are perfectly adapted to Mexico’s tropical and subtropical climate conditions, stand out as a species that supports sustainable livestock practices in the region. In particular, the resilience of these sheep and their efficient reproductive capacity, even in conditions of underdeveloped infrastructure, contribute to the devel opment of the Mexican rural economy and play a major role in strengthening the sources of income for local communities [3].
The hair sheep breeds are the main genotypes used in sheep production systems in the tropics [4]. Historically, these production systems used Pelibuey and Blackbelly as maternal breeds. This has led to the development of production systems based on the crossbreeding of flocks of Pelibuey, Blackbelly and Katahdin sheep and their pure-bred progeny [5]. In these systems, the continuous determination of animal growth is a major challenge for smallholder farmers due to several factors [6]. Blackbelly sheep are a genetic resource that is perfectly adapted to the humid tropical climates of Mexico and can be con sidered as a valuable option to improve sheep breeding in the humid tropics of the world. The characterization of carcass tissue composition is essential to promote the economic efficiency of these production systems [7, 8]. In addition to all the sustainable farming practices and genetic adaptation efforts mentioned above, the eco nomic returns obtained from meat animals are based on body weight. Because the incomes obtained by breeders are directly based on the weight of the animals and this weight plays a decisive role in marketing and commercial evaluation processes [9]. In this context, accurate deter mination of animal body weight is of critical importance in order to maximize meat production. Therefore, studies conducted to explain the relationship between biometric measurements and animal weights are of increasing inter est both in terms of scientific research and applied animal husbandry, and the development of methodologies in this field has an important place in achieving sustainable ani mal breeding aims [2]. In this context, body weight (BW) plays an important role in decisions regarding herd man agement as one of the most accurate methods of deter mining growth [10, 11]. The traditional weighing method has a negative impact as it involves transporting sheep to a weighing station, increasing labor, and creating stress ful conditions for animals [11, 12]. Additionally, this can result in a live weight loss of 1.8–2.9 kg or 3.5–5.6% in small ruminants, such as sheep [11, 12]. The lack of por table weighing platforms or their unavailability in small livestock farms makes direct measurement of live weight difficult. However, basic biometric measurements such as heart circumference, withers height, and body length can be easily obtained with simple equipment and provide reliable indicators for estimating live weight. Further more, various techniques are used to identify the body weight of livestock, largely due to technological advances in both hardware and computational algorithms, instead of classical weighing approaches [13]. The identification of BW as a more valuable tool for managing sheep pro duction, monitoring growth and performance, and assist ing producers in making decisions such as optimal feed amount, medicinal doses, marketing price, and optimum slaughtering time per sheep about sustainable livestock farming [2]. It is thought that using both hardware and computational algorithms, rather than classical weighing approaches, will eliminate stress factors that occur espe cially during the weighing of animals, thereby improving animal welfare.
There are many studies in the literature on estimating live body weight in various species such as dog, cattle, rabbit, sheep and camel based on biometric measure ments. In these studies, various statistical techniques such as multiple linear regression, decision trees, Multi variate Adaptive Regression Splines (MARS), and Artifi cial Neural Networks (ANNs), etc., were used in different species and different breeds within species [14–17]. In recent studies on sheep, the subject of our current study, in addition to traditional statistical methods, there has been a trend towards more advanced and higher gener alization ability machine learning techniques, especially regression-based and decision tree-based machine learn ing algorithms. This trend has been observed in recent years, especially due to its capacity to analyze hetero geneous data structures and large data sets more effec tively, further increasing the importance of machine learning techniques in scientific research and industrial applications.
These techniques play a critical role in optimizing sheep farming practices by providing more precise and predictive analyses compared to traditional methods. In this context, especially when the basic assumptions Keywords Random forest, XGBoost, Blackbelly, Sheep, Machine learning
Page 3 of 11 Delgado et al. BMC Veterinary Research (2026) 22:218 of multiple linear regression analysis are not provided, modern statistical approaches that do not require distri bution assumptions provide much more understandable and reliable results. The use of XGBoost and Random Forest algorithms in estimating the body weight of Black belly sheep breed is limited in the literature. Therefore, evaluating these algorithms specifically for this breed is considered to be a valuable contribution to breed-specific studies. This provides an opportunity to evaluate the high predictive performance of the algorithms and their ability to effectively model complex data structures. It is thought that this study will contribute significantly to the existing literature in the field by revealing the potential applica tions and efficiency of these algorithms. In most of the studies to date, multiple linear regression analysis has been used to predict the body weight of ani mals. However, the use of machine learning methods to accurately predict body weight from biometric measure ments appears promising, as the relationship between body weight and biometric measurements is non-linear [18].
In the current study, it is aimed to compare the perfor mances of two machine learning algorithms (XGBoost and Random Forest) for estimating live weight based on biometric measurements in Blackbelly sheep. Materials and methods Animals and experimental area In this study, data from 120 Blackbelly lambs (60 females and 60 males) were analyzed. The animals were obtained from a local farm specializing in the breeding of this genotype.
The experiment was conducted at the Sureste Ovine Integration Center (CIOS, 17°78’N, 92°96’W”; 10 masl). It is in the R/a Alvarado Santa Irene 2da Secc, Centro municipality, Tabasco, Mexico. The area has a humid tropical climate. Temperatures range from 15°C to 44°C, with an average of 26°C.
Each measurement, including body weight (BW), heart circumference (HG), cross-body length (DBL), abdomi nal circumference (AG), body length (BL), withers height (WH), rump height (RH), and hip-width (HW), was recorded, considering animal welfare conditions. The lambs were clinically healthy and were between 6 and 8 months of age. BW was recorded using a fixed platform scale with a capacity of 300 kg and an accuracy of 20 g, while the biometric measurements were taken using a flexible fiberglass tape measure (Truper®) as described by [19].
Statistical analysis An independent-samples t-test was used to assess the effect of sex on the biometric characteristics examined. The level of significance was accepted as p < 0.05. The XGBoost algorithm, which has been continuously improved by many scientists over time, was proposed by Chen and Guestrin in 2016 [20]. XGBoost helps to solve many data science problems, such as prediction and classification problems, by providing fast and accu rate parallel tree boosting [21]. The XGBoost algorithm, an advanced implementation of the gradient boosting algorithm, is designed to be highly efficient, flexible and portable with optimized structure [22]. XGBoost works by creating a collection of decision trees, each trained on a different subset of the data, and the resulting trees are then combined to minimize the error associated with the prediction. By combining the results of several trees, XGBoost can make more accurate predictions than a single decision tree [23]. Unlike other boosting algorithms, the XGBoost algorithm also allows for regu larizations that help prevent overfitting [24]. In this way the algorithm stands out for its ability to perform quickly and effectively, especially on large datasets, in addition to providing adjustments that help prevent overfitting. The algorithm minimizes the error rate while also consider ing the model’s complexity, which allows for balancing the overall model performance. In particular, tuning the hyperparameters of XGBoost allows the model to strike an appropriate balance between bias and variance. These include hyperparameters such as maximum depth, eta, etc [22]. In the current study, two primary hyperparam eters, eta and max_depth, were used for the XGBoost algorithm. The eta hyperparameter determines the mod el’s learning rate; smaller values result in slower learn ing and can reduce the risk of overfitting. Keeping this parameter low allows the model to generate more trees, resulting in a more balanced and generalizable structure. Max_depth represents the maximum depth of each deci sion tree; higher values allow for learning more complex structures but can also lead to overfitting [20]. Under standing the impact of each parameter on the model is critical when determining the optimal parameter combi nation. Therefore, XGBoost continues to be a preferred method for obtaining high-performance and reliable results in machine learning applications, especially when dealing with complex data structures. Considering this information, the XGBoost can be regarded as an excel lent choice for predicting sheep body weight. The Random Forest algorithm (RFR) is a standard procedure among multivariate statistical methods, par ticularly useful for solving regression and classification problems due to its practicality. The RFR algorithm con sists of a process that adds a layer of randomness to the bagging algorithm. The RFR algorithm, proposed by Brei man [25], combines sets of regression trees hierarchically from the root to the leaf, utilizing a set of constraints [26, 27]. The most important advantage of this algorithm is
Page 4 of 11 Delgado et al. BMC Veterinary Research (2026) 22:218 that it can be easily used in nonlinear situations in solv ing classification and prediction-type problems [28]. The algorithm has three phases, and the first phase is assembling several trees (ntree) from the original data. The second phase is to create an untrimmed regression or classification tree for each sample. The final phase involves predicting the final data of the tree obtained from the algorithm [29].
The dataset was randomly divided into two groups: 70% for training and 30% for testing. During the model ing process, 10-fold cross-validation was applied sepa rately for each algorithm to evaluate their generalization performance. The hyperparameter optimization process was carried out using the grid search method which was performed for the XGBoost algorithm using the param eters ‘eta’ (range 0.01–0.3, increments of 0.01) and ‘max_ depth’ (range 3–10, increments of 1) and the Random Forest algorithm using the parameters ‘mtry’ (number of variables starting from 2 to 1, increments of 1) and ‘node size’ (range 1–10, increments of 1). These analyses were conducted using a systematic and highly sensitive screen ing approach to ensure that the algorithms reached opti mal performance levels.
To assess model fit, the dataset was divided into train ing and test sets. Each algorithm was trained using only the training data and then independently evaluated on the test data. Model performance was measured using the coefficient of determination (R2), mean square error (MSE), root mean square error (RMSE), mean absolute error (MAE), Akaike Information Criterion (AIC), and Bayesian Information Criterion (BIC). Reliable algo rithms can be determined by using the highest R2 and the lowest values of MSE, RMSE, MAE, AIC, and BIC. These metrics were calculated separately for both the train ing and test sets to assess the model’s applicability and generalizability.
All statistical analyses were performed using R and Python software [30, 31]. Descriptive statistical meth ods were preferred to establish the necessary definitions for the data sets. Relevant statistics for explanatory and dependent variables were obtained with the “psych” package of the R software [32]. Pearson correlation analy sis was performed to visualize the relationship between explanatory and dependent variables, and the “corrplot” package in R was used during this analysis [33]. The separation of the data set into training and test sets was performed using the “caret” package [34]. The “random Forest” and “xgboost” packages were preferred for apply ing the XGBoost and Random Forest algorithms [29, 35]. Three-dimensional surface plots were visualized using the Python software.
Results In Table 1, descriptive statistics of explanatory and response variables are presented separately for female and male sheep. In addition, significant sex effects were observed on some biometric characteristics from the results of an independent-samples t-test. Significant dif ferences were found between males and females, particu larly in body weight and heart circumference (p < 0.05). The mean body weight (BW) for female sheep was 26.64 ± 0.51 kg, while in male sheep it is 30.71 ± 0.40 kg. The coefficient of variation for BW is 14.87%. The coeffi cient of variation (CV(%)) was calculated to be 14.87% for BW in females, while in males, the CV(%) was calculated to be 10.31% for body weight. In both sexes, CV (%) rates for HG, WH, and RH variables were below 6%, demon strating low variation.
Figure 1 presents the distribution characteristics of explanatory and response variables within the sex factor using box plots. Mean values for variables such as BW, HG, AG, and RH were observed to be higher in males than in females. Means for variables such as BL and HW were slightly higher in females than in males. Error bars indicate the distribution ranges of the variables measured in both sexes and are consistent with the coefficients of variation (as shown in Table 1). This visualization allows for the identification of differences in the distribution of biometrical traits by sex.
Figure 2 shows the Pearson correlation coefficients for biometrical variables by sex. In female Blackbelly sheep, there is a high positive correlation (0.89) between BW and HG, and a significant positive correlation (0.83) Table 1 Descriptive statistics of explanatory and response variables within the scope of sex factor Variables Sex Mean ± Stan dard Error Min-Max Coef ficient of Variation
(%)
Sig.
BW Female
26.64 ± 0.51
19.55–36.45 14.87
0.000
Male
30.71 ± 0.40
23.20–37.00 10.31 HG Female
69.27 ± 0.54
60.00–77.00
6.13
0.000
Male
73.62 ± 0.55
63.00–81.00
5.85
DBL
Female
49.75 ± 0.38
44.00–57.00
6.05
0.141
Male
49.08 ± 0.47
40.00–56.00
7.53
AG Female
75.32 ± 0.72
65.00–88.00
7.45
0.073
Male
76.90 ± 0.62
65.00–88.00
6.32
BL Female
45.00 ± 0.32
40.00–51.00
5.62
0.000
Male
42.40 ± 0.53
34.00–53.00
9.79
WH Female
64.30 ± 0.49
53.00–74.00
5.99
0.196
Male
63.73 ± 0.43
56.00–72.00
5.25
RH Female
63.13 ± 0.44
56.00–72.00
5.44
0.018
Male
64.50 ± 0.46
58.00–77.00
5.61
HW Female
14.54 ± 0.17
11.50–18.20
9.55
0.004
Male
13.88 ± 0.16
11.00–18.00
9.43
BW body weight, HG heart circumference, DBL diagonal body length, AG abdominal circumference, BL body length, WH withers height, RH rump height, HW hip-width Sig: NS = p ≥0.05 (not significant), * = p < 0.05, ** = p < 0.01, *** = p < 0.001
Page 5 of 11 Delgado et al. BMC Veterinary Research (2026) 22:218 between BW and WH. Additionally, a significant correla tion (0.73) is found between HW and BW. In males, the correlation between BW and HG is 0.85, and between BW and AG is 0.75. A positive correlation (0.72) is also observed between BW and HW.
When all individuals are evaluated together, the highest correlation coefficient is between BW and HG, at 0.90. Similarly, the correlations between BW and WH (0.76) and HW (0.49) are also significant. Some sex-related differences in the correlation patterns are noted. For example, the BL (body length) variable shows a higher correlation with BW in males (0.56), while the relation ship is weaker in females (0.19).
Figures 3, 4 and 5, and 6 present detailed performance metrics of the XGBoost and Random Forest algorithms on the training and test datasets, reflecting the effects of the hyperparameter optimization process on model performance. Each graph visually demonstrates both the success of the respective algorithm during the training process and its generalizability to external examples. Figures 3 and 4 show the performance of the XGBoost algorithm in the training and test datasets, respectively. In the training dataset, the XGBoost algorithm pro duced low MSE, RMSE, and MAE values along with a high R2 value (0.98). These results indicate that the model has a high fit on the training data. In the test dataset, a decrease in the R2 value was observed, and an increase in error metrics occurred. This reveals the performance dif ference between the training and test datasets. Figures 5 and 6 present the performance results of the Random Forest algorithm in the training and test data sets. The Random Forest algorithm obtained a high R2 Fig. 2 Correlation analysis results
Fig. 1 Evaluation of biometrical characteristics according to sex with boxplot and error bars
Page 6 of 11 Delgado et al. BMC Veterinary Research (2026) 22:218 value (0.97) in the training dataset, while the R2 value was
0.87 in the test dataset. The MSE, RMSE, and MAE val
ues calculated in the test dataset were lower compared to the XGBoost algorithm. Furthermore, the AIC and BIC values obtained in the test dataset were also found to be lower for the Random Forest algorithm.
When the results presented in Figs. 3, 4, 5 and 6 are evaluated together, it is seen that both algorithms exhibit different performance profiles in the training and test datasets. These findings allow for a comparison of the algorithms in terms of prediction accuracy and error metrics.
Table 2 presents the optimum hyperparameters and model fit criteria for eXtreme Gradient Boosting (XGBoost) and Random Forest. Among the most suit able hyperparameters for the XGBoost algorithm, the maximum depth (max_depth) was determined as five, and the learning rate (eta) as 0.05. In the Random For est algorithm, the best performance was obtained with an mtry value of 4 and a node size value of 1. In addi tion to this information, although no major changes were determined for max_depth for the XGBoost algorithm in Figs. 3, 4, 5 and 6, it was observed that there were major differences in eta values. However, as a result of the Fig. 4 Surface plot for XGBoost algorithm results within the scope of goodness-of-fit criteria (test set)
Fig. 3 Surface plot for XGBoost algorithm results within the scope of goodness-of-fit criteria (train set)
Page 7 of 11 Delgado et al. BMC Veterinary Research (2026) 22:218 examinations made for both node size and mtry hyper parameters in the Random Forest algorithm, it was seen that a more stable model was obtained compared to the hyperparameter changes in XGBoost.
According to the model fit criteria, the performance metrics of both algorithms were evaluated on the train ing and test sets. While a significantly high R-squared (R2 = 0.981) value was obtained for the training set using the XGBoost algorithm, this value was lower for the test set (R2 = 0.813). A similar situation was observed in the Mean Squared Error (MSE), Root Mean Squared Error (RMSE) and Mean Absolute Error (MAE) values. While the performance on the training set was quite good, a decrease in performance on the test set was observed. On the other hand, the Random Forest algorithm pre sented a higher R-squared value (R2 = 0.873) compared to XGBoost on the test set. In addition, the MSE, RMSE and MAE values of the Random Forest algorithm were lower than XGBoost on the test set, indicating that the model generally has a better generalization ability. Fig. 6 Surface plot for Random Forest algorithm results within the scope of goodness-of-fit criteria (test set)
Fig. 5 Surface plot for Random Forest algorithm results within the scope of goodness-of-fit criteria (train set)
Page 8 of 11 Delgado et al. BMC Veterinary Research (2026) 22:218 Model performance was also evaluated using AIC and BIC metrics. For the XGBoost algorithm in the test data set, the AIC and BIC values were calculated as 146.125 and 150.791, respectively. For the Random Forest algo rithm, the AIC and BIC values in the test dataset were obtained as 35.401 and 41.623, respectively. These values allow for a quantitative comparison of the model fit and complexity of both algorithms on the test dataset. Figure 7 shows the variable significance levels (relative significance scores showing the contribution of each vari able to live weight estimation) calculated for the XGBoost and Random Forest algorithms. In both algorithms, the chest circumference (HC) variable was determined to have the highest significance level. The significance level of the HC variable was calculated as 59.91% in the XGBoost algorithm and 49.42% in the Random Forest algorithm.
The AG variable ranks second with a significance level of 21.38% in the XGBoost algorithm and 23.15% in the Random Forest algorithm. The significance level of the sex variable was determined as 7.55% in the Random For est algorithm and 5.36% in the XGBoost algorithm. It was observed that the significance levels of other variables, such as hip width (HW) and rump height (RH), differed between the algorithms.
The results presented in Fig. 7 quantitatively demon strate the relative importance levels of the variables used by both algorithms in live weight estimation. This graph allows us to identify which variables the models give more weight to in the estimation process and objectively visualizes how the relative effects of the variables on live weight differ according to the algorithms. These com parative importance levels of the XGBoost and Random Forest algorithms provide an explanatory framework for the decision-making mechanisms of the algorithms and reveal, with empirical data, which inputs the mod els are more sensitive to. In this way, it becomes possible to understand the differences between the algorithms in variable selection at a numerical level. Discussion This study compared the performance of the XGBoost and Random Forest algorithms for estimating live weight in Blackbelly sheep. Findings obtained on the training and test datasets indicate that the algorithms have dif ferent learning dynamics. While XGBoost demonstrated high accuracy on the training set, it showed more limited Table 2 The optimum hyperparameters and the results of goodness-of-fit criteria Optimal hyperparameters of each algorithm XGBoost Random Forest max_depth
5
mtry
4
eta
0.05
nodesize
1
Goodness-of-fit criteria XGBoost Training Testing Random Forest Training Testing R2
0.981
0.813
R2
0.969
0.873
MSE
0.416
3.296
MSE
0.630
2.188
RMSE
0.645
1.816
RMSE
0.794
1.479
MAE
0.486
1.440
MAE
0.617
1.105
AIC
150.513
146.125
AIC
-31.230
35.401
BIC
157.841
150.791
BIC
-21.459
41.623
R2 coefficient of determination, MSE mean square error, RMSE root mean square error, MAE mean absolute error, AIC Akaike’s information criterion, BIC Bayesian information criterion Fig. 7 Variable importance for each algorithm
Page 9 of 11 Delgado et al. BMC Veterinary Research (2026) 22:218 generalization performance on the test set. In contrast, the Random Forest algorithm was found to offer more balanced and consistent performance on both datasets. These findings suggest that XGBoost may be more sus ceptible to overfitting due to its greater capacity to learn within-sample variance, while Random Forest can pro duce lower-variance estimates thanks to bootstrap sam pling and variable randomization [36].
In the present study, the performance of XGBoost and Random Forest algorithms in estimating live weight from biometric measurements was examined, and the behavior of both algorithms in training and test sets was system atically compared. The findings in this context are consis tent with studies conducted with similar data structures in the literature. For example, in a study conducted on Corriedale sheep by Canazo-Cayo et al. [37], it was reported that the Random Forest algorithm gave supe rior results compared to other methods in performance metrics such as R2, RMSE, and MAE in models created using biometric measurements; this is parallel to the relatively higher generalization ability of Random For est in the test set in the present study. Alsahaf et al. [38] compared the XGBoost and Random Forest algorithms for slaughter weight estimation in pigs and reported that both algorithms achieved high accuracy. However, it is natural that these results differ from those of the cur rent study, especially considering the smaller sample size. Similarly, Hamadani and Ganai [39] compared numerous algorithms for estimating live weight in sheep and dem onstrated that chest circumference and body length are crucial factors in determining model performance. In addition, Faraz et al. [22] stated that XGBoost is an effective and reliable method for estimating live weight in a study conducted on the Kajli sheep breed comparing XGBoost and MARS algorithms. This finding is consis tent with the high performance of XGBoost in explaining a large portion of the training data in the present study. However, the decrease in the generalization performance of this algorithm in the test set has also been reported in other studies in the literature, pointing to the effective ness of factors such as data structure, sample size, and feature distribution that lead to performance variability among different algorithms [40].
In this study, linear measures such as HG, WH, and BL were identified as the most influential variables in the variable importance results. These findings are highly biologically consistent. HG is directly related to lung capacity, rib cage volume, skeletal development, and muscle mass, and is one of the strongest determinants of body weight in ruminants [41–43]. Furthermore, a strong positive relationship between body length, with ers height, and live weight has been reported in many studies [44, 45]. Since these anatomical measures reflect the animal’s skeletal size and muscle tissue capacity, it is natural and expected that the algorithms would assign high importance to these variables [46]. The performance differences observed between the algorithms may largely be due to sample size, variable distribution, breed-specific phenotypic characteristics, and hyperparameter settings. For example, the higher performance of XGBoost in some studies (e.g., Coşkun et al. [47]; Esener and Eşki [48]) can be explained by the model’s sensitivity to sample size. Random Forest’s higher generalization performance on the test set is related to its more stable learning strategy in heterogeneous data structures [25].
In this context, this study, which compares the XGBoost and Random Forest algorithms in the Black belly sheep breed, expands a research area that has received limited coverage in the literature and presents findings on body weight estimation for this breed. The study’s strengths include the compatibility of variable importance ranking with biological underpinnings, a critical analysis of methodological differences, and litera ture comparisons. Future studies, which conduct similar modeling with larger sample sizes, different breeds, and under various environmental conditions, will provide the opportunity to more comprehensively evaluate the gen eralizability and biological validity of the algorithms. In addition to these original contributions, the study’s find ings have implications for practical applications that are also noteworthy.
The findings demonstrate the development of machine learning-based decision support systems that provide fast, economical, and practical body weight estimation in small-scale livestock farms. Specifically, while the XGBoost algorithm demonstrated statistically signifi cant and high performance on the training data, this per formance was not sufficiently reflected in the test data, increasing the risk of overfitting in limited data struc tures. When multicollinearity, a potential factor that can lead to overfitting, was controlled, the XGBoost algo rithm’s sensitivity to complex variable interactions may have led to performance degradation in limited sample sizes. In contrast, thanks to its more flexible structure and high-variance sampling mechanism, the Random Forest algorithm overcame these limitations and produced more consistent and generalizable results across both training and test sets. However, the study has several limitations. The limited sample size, the fact that data were obtained from only a specific geographic region, and the compari son of only two algorithms may limit the generalizability of the results to different populations. Furthermore, the limited range of hyperparameter optimization may have prevented the models from reaching their full poten tial performance. Despite these limitations, the study’s findings point to low-cost, applicable model structures that can be integrated into decision-support processes.
Page 10 of 11 Delgado et al. BMC Veterinary Research (2026) 22:218 Future research will focus on assessing different species, utilizing larger and more diverse datasets, and examin ing diverse environmental conditions. Furthermore, by integrating deep learning and image processing-based methods, we aim to increase model accuracy and gen eralizability, enabling the development of more effective prediction systems that contribute to animal welfare. Authors’ contributions Conceptualization, M.Á.G.D., C.T. and A.J.C.C.; methodology, M.Á.G.D., C.T., R.I.P.C., I.V.M., A.G.V., A.C.H., E.C.P., D.A.D.C., U.Ş., K.C., Y.A., H.T.Ç. and A.J.C.C.; software, M.Á.G.D., C.T., U.Ş. and A.J.C.C.; validation, M.Á.G.D., C.T., R.I.P.C., I.V.M., A.G.V., A.C.H., E.C.P., D.A.D.C., H.,Ö., U.Ş., K.C., Y.A., H.T.Ç., O.O. and A.J.C.C.; formal analysis, C.T., H.Ö., U.Ş. and A.J.C.C.; investigation, M.Á.G.D., C.T., R.I.P.C., I.V.M., A.G.V., A.C.H., E.C.P., D.A.D.C., U.Ş., K.C., Y.A., H.T.Ç., O.O. and A.J.C.C.; resources, M.Á.G.D., C.T., U.Ş. and A.J.C.C.; data curation, M.Á.G.D., C.T., R.I.P.C., I.V.M., A.G.V., A.C.H., E.C.P., D.A.D.C., U.Ş. and A.J.C.C.; writing—original draft preparation, M.Á.G.D., C.T., U.Ş. and A.J.C.C.; writing—review and editing, M.Á.G.D., C.T., R.I.P.C., I.V.M., A.G.V., A.C.H., E.C.P., D.A.D.C., U.Ş., K.C., Y.A., H.T.Ç. and A.J.C.C.; visualization, C.T., U.Ş. and A.J.C.C.; supervision, A.J.C.C.; project administration, M.Á.G.D., R.I.P.C., I.V.M., A.G.V., A.C.H., E.C.P., D.A.D.C. and A.J.C.C.; funding acquisition, M.Á.G.D. and A.J.C.C. All authors have read and agreed to the published version of the manuscript.
Funding This research did not receive any specific grant from funding agencies in the public, commercial, or not-for-profit sectors.
Data availability The datasets generated and/or analyzed during the current study are available from the corresponding author on reasonable request. Declarations Ethics approval and consent to participate The experiment was approved by the Animal Ethics Committee of the Scientific Department of Agricultural Sciences, Autonomous University of Tabasco, in accordance with the Standards for Ethical Animal Research (record no. CIEI: Folio 1173–2022; dated September 29, 2022). The experiment was conducted on a privately owned farm. Prior to sampling, written informed consent was obtained from the farm owner, who provided signed authorization for the use of animals and farm facilities for research purposes. The study did not involve any invasive procedures, and all animal handling strictly complied with ethical standards and institutional guidelines for the care and use of animals in research. All experimental methods followed established ethical and regulatory protocols consistent with the ARRIVE guidelines. During the experimental period, all animals were clinically healthy. Consent for publication Not applicable.
Competing interests The authors declare no competing interests.
Author details 1Division Académica de Ciencias Agropecuarias, Universidad Juárez Autónoma de Tabasco, Carr. Villahermosa-Teapa, km 25, Villahermosa, Tabasco CP 86280, México 2Department of Animal Science, Faculty of Agriculture, Igdir University, TR76000, Iğdır, Türkiye 3Universidad de Ciencias Aplicadas y Ambientales U.D.C.A, Área de Ciencias Agropecuarias, Grupo de Investigación en Ciencia Animal, Bogotá, CP 111166, Colombia 4Facultad de Ingeniería, Universidad Autónoma de Yucatán, Av. Industrias No Contaminantes s/n, Mérida, Yucatán, México 5Tecnológico Nacional de México, Instituto Tecnológico Superior de Calkiní, Av. Ah-Canul, Calkiní, Campeche C.P. 24900, México 6Department of Animal Science, Faculty of Agriculture, Ondokuz Mayis University, TR55139, Samsun, Türkiye 7Department of Agricultural Biotechnology, Faculty of Agriculture, Ondokuz Mayis University, TR55139, Samsun, Türkiye 8Department of Biology, Faculty of Sciences, Kyrgyz Turkish Manas University, Bishkek 720044, Kyrgyzstan 9Department of Animal Science, Faculty of Agriculture, Eskişehir Osmangazi University, TR26160, Eskişehir, Türkiye 10Department of Food Processing, Vocational School of Ulubey, Ordu University, TR52850, Ulubey, Ordu, Türkiye 11Department of Animal Science, Faculty of Agriculture, University of Ibadan, Ibadan, Nigeria Received: 2 October 2025 / Accepted: 30 January 2026 References
1.
Celik S, Eyduran E, Karadas K, Tariq MM. Comparison of predictive perfor mance of data mining algorithms in predicting body weight in Mengali Rams of Pakistan. Braz J Vet Res Anim Sci. 2017;46(11):863–72. https://doi.org/10.15 90/S1806-92902017001100005.
2.
Tirink C. Comparison of bayesian regularized neural network, random forest regression, support vector regression, and multivariate adaptive regression splines algorithms to predict body weight from biometrical measurements in thalli sheep. Kafkas Univ Vet Fak Derg. 2022;28(3):411–9. https://doi.org/10.97 75/kvfd.2022.27164.
3.
Estevez-Moreno LX, Sanchez-Vera E, Nava-Bernal G, Estrada-Flores JG, Gomez- Demetrio W, Sepúlveda WS. The role of sheep production in the livelihoods of Mexican smallholders: evidence from a park-adjacent community. Small Rumin Res. 2019;178:94–101. https://doi.org/10.1016/j.smallrumres.2019.08.0 01.
4.
Magaña-Monforte JG, Huchin-Cab M, Ake-López JR, Segura-Correa JC. A field study of reproductive performance and productivity of pelibuey Ewes in southeastern Mexico. Trop Anim Health Prod. 2013;45:1771–6. https://doi.org /10.1007/s11250-013-0431-2.
5.
García-Cigarroa JC, Luna-Mendicuti AA, Canul-Solís JR, Castillo-Sanchez LE, Herrera-Camacho J, Vargas-Bello-Pérez E, et al. Use of real-time ultrasound measurements of fat thickness and longissimus thoracis muscle characteris tics for predicting body fat depots in crossbred hair Ewes. Small Rumin Res. 2024;241:107400. https://doi.org/10.1016/j.smallrumres.2024.107400.
6.
Salazar-Cuytun R, García-Herrera RA, Muñoz-Benitez AL, Camacho-Pérez E, Muñoz-Osorio GA, Ptacek M, et al. Relationship between body volume and body weight in pelibuey Ewes. Trop Subtrop Agroecosyst. 2021;24(3):1–6.
7.
Almeida A. Barbados blackbelly: the Caribbean ovine genetic resource. Trop Anim Health Prod. 2017;2:239–50. https://doi.org/10.1007/s11250-017-147 5-5.
8.
Escalante-Clemente S, Vázquez-Jiménez S, López-Durán SK, Arcos-Alvarez DN, Arbez-Abnal TA, Piñeiro-Vazquez ÁT, et al. Using the 9th–11th rib section to predict carcass tissue composition in blackbelly sheep. Ital J Anim Sci. 2022;21(1):161–7. https://doi.org/10.1080/1828051X.2021.2002731.
9.
Vazquez-Martinez I, Tirink C, Salazar-Cuytun R, Mezo-Solis JA, Garcia-Herrera RA, Orzuna-Orzuna JF, et al. Predicting body weight through biometric mea surements in growing hair sheep using data mining and machine learning algorithms. Trop Anim Health Prod. 2023;55(5):307–16. https://doi.org/10.100 7/s11250-023-03717-x.
10. Chay-Canul AJ, Tapia-González J, Canul-Solís JR, Casanova-Lugo F, Piñeiro-
Vázquez ÁT, Portillo-Salgado R, et al. Predictive biometrics of hair sheep through digital imaging. Vet Mex. 2023;10(1):11. https://doi.org/10.22201/fmv z.24486760e.2023.1150.
11. Chay-Canul AJ, Camacho-Perez E, Casanova-Lugo F, Rodriguez-Abreo O,
Cruz-Fernandez M, Rodriguez-Resendiz J. Neural Network-Based body weight prediction in pelibuey sheep through biometric measurements. Technol. 2024;12:59. https://doi.org/10.3390/technologies12050059.
12. Wishart H, Morgan-Davies C, Stott AW, Wilson A, Waterhouse T. Liveweight
loss associated with handling and weighing of grazing sheep. Small Rumin Res. 2017;153:163–70. https://doi.org/10.1016/j.smallrumres.2017.06.013.
13. Fuentes S, Viejo CG, Tongson E, Dunshea FR. The livestock farming digital
transformation: implementation of new and emerging technologies using artificial intelligence. Anim Health Res Rev. 2022;23(1):59–71. https://doi.org/ 10.1017/S1466252321000177.
Page 11 of 11 Delgado et al. BMC Veterinary Research (2026) 22:218
14. Khan MA, Tariq MM, Eyduran E, Tatliyer A, Rafeeq M, Abbas F, et al. Estimating
body weight from several body measurements in Harnai sheep without multicollinearity problem. J Anim Plant Sci. 2014;24(1):120–6.
15. Ali M, Eyduran E, Tariq MM, Tirink C, Abbas F, Bajwa MA, et al. Comparison
of artificial neural network and decision tree algorithms used for predicting live weight at post-weaning period from some biometrical characteristics in Harnai sheep. Pak J Zool. 2015;47:1579–85.
16. Olfaz M, Tirink C, Önder H. Use of CART and CHAID algorithms in Karayaka
sheep breeding. Kafkas Univ Vet Fak Derg. 2019;25(1):105–10. https://doi.org/ 10.9775/kvfd.2018.20388.
17. Sabbioni A, Beretti V, Superchi P, Ablondi M. Body weight Estimation from
body measures in cornigliese sheep breed. Ital J Anim Sci. 2020;19:25–30. htt ps://doi.org/10.1080/1828051X.2019.1689189.
18. Ruchay A, Kober V, Dorofeev K, Kolpakov V, Dzhulamanov K, Kalschikov V, et
al. Comparative analysis of machine learning algorithms for predicting live weight of Hereford cows. Comput Electron Agric. 2022;195:106837. https://d oi.org/10.1016/j.compag.2022.106837.
19. Salazar-Cuytun R, Portillo-Salgado R, García-Herrera RA, Camacho-Pérez E,
Zaragoza-Vera CV, Gurgel ALC, et al. Prediction of live weight in grow ing hair sheep using the body volume formula. Arq Bras Med Vet Zootec. 2022;74:483–9. https://doi.org/10.1590/1678-4162-12624.
20. Chen T, Guestrin C. Xgboost: A scalable tree boosting system. Proc 22nd ACM
SIGKDD Int Conf Knowl Discov Data Min. 2016;13–17. https://doi.org/10.1145 /2939672.293978.
21. Punuri SB, Kuanar SK, Kolhar M, Mishra TK, Alameen A, Mohapatra H, et al.
Efficient Net-XGBoost: an implementation for facial emotion recognition using transfer learning. Math. 2023;11(3):776. https://doi.org/10.3390/math11 030776.
22. Faraz A, Tirink C, Önder H, Şen U, Ishaq HM, Tauqir NA, et al. Usage of the
XGBoost and MARS algorithms for predicting body weight in Kajli sheep breed. Trop Anim Health Prod. 2023;55(4):276. https://doi.org/10.1007/s1125 0-023-03700-6.
23. Sagi O, Rokach L. Approximating XGBoost with an interpretable decision tree.
Inf Sci. 2021;572:522–42. https://doi.org/10.1016/j.ins.2021.05.055.
24. Gertz M, Grobe-Butenuth K, Junge W, Maassen-Francke B, Renner C, Sparen
berg H, et al. Using the XGBoost algorithm to classify neck and leg activity sensor data using on-farm health recordings for locomotor-associated diseases. Comput Electron Agric. 2020;173:105404. https://doi.org/10.1016/j.c ompag.2020.105404.
25. Breiman L. Random forests. Mach Learn. 2001;45(1):5–32. https://doi.org/10.1
023/a:1010933404324.
26. Rodriguez-Galiano V, Mendes MP, Garcia-Soldado MJ, Chica-Olmo M, Riberio
L. Predictive modeling of groundwater nitrate pollution using random for
est and multisource variables related to intrinsic and specific vulnerability: A case study in an agricultural setting (Southern Spain). Sci Total Environ. 2014;476:189–206. https://doi.org/10.1016/j.scitotenv.2014.01.001.
27. Wang L, Zhou X, Zhu X, Dong Z, Guo W. Estimation of biomass in wheat
using random forest regression algorithm and remote sensing data. Crop J. 2016;4:212–9. https://doi.org/10.1016/j.cj.2016.01.008.
28. Tirink C, Piwczyński D, Kolenda M, Önder H. Estimation of body weight based
on biometric measurements by using random forest regression, support vector regression and CART algorithms. Animals. 2023;13(5):798. https://doi.o rg/10.3390/ani13050798.
29. Liaw A, Wiener M. Classification and regression by randomforest. R News.
2002;2:18–22.
30. R Core Team. R: A Language and environment for statistical computing.
Vienna: R Foundation for Statistical Computing; 2022.
31. Van Rossum G, Drake FL. The python Language reference. Amsterdam:
Python Software Foundation; 2010.
32. Revelle W. Psych: procedures for personality and psychological research.
Evanston: Northwestern University; 2015.
33. Wei T, Simko V, Levy M, Xie Y, Jin Y, Zemla J. Package corrplot. Statistician.
2017;56:e24.
34. Kuhn M. Caret: classification and regression training. R Package Version.
2022;6:0–93.
35. Chen T, He T, Benesty M, Khotilovich V, Tang Y, Cho H et al. xgboost: Extreme
gradient boosting. R package version 1.7.3. 2023;1.
36. Zhou ZH. Ensemble methods: foundations and algorithms. CRC; 2025.
37. Canaza-Cayo AW, Churata-Huacani R, Çakmakçı C, Rodríguez-Huanca FH, de
Sousa Bueno Filho JS, Fernandes TJ, De La Cruz YCR. Use of machine learning approaches for body weight prediction in Peruvian Corriedale sheep. Smart Agricultural Technol. 2024;7:100419.
38. Alsahaf A, Azzopardi G, Ducro B, Veerkamp RF, Petkov N. Predicting slaughter
weight in pigs with regression tree ensembles. In: Petkov N, Strisciuglio N, Travieso-González CM, editors. Applications of intelligent systems: Proceed ings of the 1st International APPIS Conference. Amsterdam: IOS Press BV; 2018. pp. 1–9. https://doi.org/10.3233/978-1-61499-929-4-1
39. Hamadani A, Ganai NA. Artificial intelligence algorithm comparison and rank
ing for weight prediction in sheep. Sci Rep. 2023;13(1):13242. https://doi.org/ 10.1038/s41598-023-40528-4.
40. Kozaklı Ö, Ceyhan A, Noyan M. Comparison of machine learning algorithms
and multiple linear regression for live weight Estimation of Akkaraman lambs. Trop Anim Health Prod. 2024;56(7):250.
41. Megersa AG, Negash F, Hailu A, Melak A, Assefa A, Aseged T, Sinkie S. (2025).
Prediction of body weight in Indigenous sheep using random forest regres sion, support vector regression, and classification and regression trees algorithms. Veterinary Anim Sci, 100517.
42. Kunene NW, Nesamvuni AE, Nsahlai IV. Determination of prediction equa
tions for estimating body weight of Zulu (Nguni) sheep. Small Ruminant Res. 2009;84(1–3):41–6.
43. Castillo PE, Macedo RJ, Arredondo V, Zepeda JL, Valencia-Posadas M, Haubi
CU. Morphological description and live weight prediction from body mea surements of Socorro Island Merino Lambs. Animals. 2023;13(12):1978.
44. Çam M, Olfaz M, Soydan E. Body measurements reflect body weights and car
cass yields in Karayaka sheep. Asian J Anim Veterinary Adv. 2010;5(2):120–127.
45. Vázquez-Martínez I, Tırınk C, Salazar-Cuytun R, Mezo-Solis JA, Garcia Herrera
RA, Orzuna-Orzuna JF, Chay-Canul AJ. Predicting body weight through bio metric measurements in growing hair sheep using data mining and machine learning algorithms. Trop Anim Health Prod. 2023;55(5):307.
46. Posbergh CJ, Huson HJ. All sheeps and sizes: a genetic investigation of
mature body size across sheep breeds reveals a polygenic nature. Anim Genet. 2021;52(1):99–107.
47. Coşkun G, Şahin Ö, Altay Y, Aytekin İ. Final fattening live weight prediction
in Anatolian Merinos lambs from some body characteristics at the initial of fattening by using some data mining algorithms. Black Sea J Agric. 2023;6(1):47–53. https://doi.org/10.47115/bsagriculture.1181444.
48. Esener N, Eşki HT. Early prediction of final weight in nomadic sheep flocks
using machine learning algorithms. Trop Anim Health Prod. 2025;57(8):420. Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Cita: GASTELUM DELGADO, MIGUEL ÁNGEL, TIRINK, CEM, Parra-Cortés, Rosa Inés, VAZQUEZ MARTINEZ, IGNACIO, Gómez Vázquez, Armando, Cruz-Hernández, Aldenamar, Camacho-Pérez, Enrique, Dzib Cauich, Dany Alejandro, Önder, Hasan, ŞEN, Uğur, Chekirov, Kadyrbai, Aksoy, Yüksel, TOZLU ÇELİK, HİLAL, Odu, Olatunbosun, Chay-Canul, Alfonso Juventino (2026), Application of XGBoost and Random Forest algorithms for body weight prediction in Blackbelly sheep using biometric measurements, Universidad de Ciencias Aplicadas y Ambientales, p. N. https://repository.udca.edu.co/handle/11158/7155