Classification of different light colors applied during the incubation period based on small intestine morphology with XGBoost algorithm Authors: Uğur Şen, Elif Cilavdaroğlu, İsa Coşkun, Cem Tırınk, Gökhan Filik, Hüseyin Çayan, İrem Ceren Kızılköy, Olatunbosun Odu Published: 2026 ABSTRACT AbstractBackgroundLight is a significant environmental stimulus affecting embryonic development during incubation, and it is known that different wavelengths can have distinctive effects on incubation performance and post-hatching physiological characteristics. However, the extent to which the traces left by different light colors applied during incubation on the small intestine morphology of chicks can be classified has not yet been sufficiently clarified. Therefore, the aim of this study is to evaluate the classifiability of different light colors (red, white, and green) applied during incubation based on the small intestine morphological characteristics of chicks using the XGBoost algorithm.MethodsFertilized eggs were incubated under red, green, white, or dark conditions. At hatching, the small intestines of chicks were excised and divided into the duodenum, jejunum, and ileum. The villus characteristics in the duodenum, jejunum, and ileum were stained with hematoxylin and eosin and examined using an image analysis programme. Villus height, crypt depth, and morphological ratios based on these, obtained from the duodenum, jejunum, and ileum, were used as classification inputs.ResultsThe XGBoost model was trained over different hyperparameter combinations, and the best performance was achieved with max_depth = 5, eta = 0.1, and nrounds = 100. Optimized with 5-fold cross-validation, the model achieved 78.95% accuracy in classifying light groups in an independent test set. Furthermore, the macro precision, macro recall, and macro F1-score of the model were 0.7896, 0.7930, and 0.7878, respectively. These findings demonstrate that different light colors applied during incubation create discernible structural changes in the small intestine morphology of chicks, and these differences hold promising potential for classification using machine learning methods.ConclusionsThese findings demonstrate that intestinal histomorphology has promising biomarker potential not only for assessing biological effects but also for determining incubation lighting conditions using machine-learning-based approaches. The study reveals that using predictive models to explain the biological effects of incubation lighting can be an important tool for sustainable poultry production.Keywords: Incubation lighting, Small intestine morphology, Light colors, XGBoost, Machine learning, Poultry Background Light is an important environmental cue that regulates embryonic development and post-hatching physiology in birds. While classical incubation studies have focused on temperature, humidity, and turning as key determinants of hatching rate and chick quality, growing evidence suggests that light exposure during embryogenesis can influence developmental trajectories, hatching performance, and later-life phenotypes in poultry [1–5]. Experimental studies using monochromatic and white LED sources have reported wavelength-specific effects on hatchability, embryonic growth rate, and post-hatching growth and behavior, demonstrating that light stimuli during hatching are a manipulable factor with both biological and practical importance [3–5]. However, the effects of light on digestive system development during embryonic periods, particularly on small intestine morphology and associated absorption capacity, have not yet been fully elucidated. Histomorphological indicators such as villus height, crypt depth, and villus/crypt ratio are considered important physiological markers in evaluating intestinal development, functionality, and nutrient absorption capacity [6, 7]. However, for accurate interpretation of the physiological effects observed in the embryo, it is necessary to consider not only the external light conditions applied but also the light signal that actually reaches the embryo. In this regard, the eggshell acts as a natural filter, determining the transmittance and spectral composition of light, thus shaping the biological effectiveness of the light stimulus [3, 8]. The eggshell significantly regulates the light environment experienced by the embryo: pigmentation and shell thickness determine spectral transmittance, so both the absolute irradiance and the spectral quality reaching the embryonic tissues vary according to genotype and shell characteristics [9]. Consequently, responses to the same external lighting regimes can differ among breeds and between broiler and laying hen eggs [10, 11]. This filtering partially explains why some studies report improved hatchability under certain light spectrums, while others find no effect [11, 12]. Consistent findings across multiple studies indicate that green light applied during hatching promotes somatic growth and muscle development and is associated with positive changes in digestive tract morphology. Green LED stimulation during embryogenesis has been shown to increase post-hatching body weight, enhance pectoral myogenesis through satellite cell activation [13], and increase villus height and the villus height: crypt depth ratio in the small intestine; these morphological changes plausibly increase absorptive surface area and improve feed efficiency [14]. In contrast, red light and broad-spectrum white light have been associated with increased hatchability or changes in behavioral and stress responses in some reports; these results may be mediated by differential regulation of photoreceptor/opsin expression and endocrine signaling [3]. However, the effects appear to depend on the egg type, the spectral composition of the light source, and the experimental protocol (e.g., continuous or intermittent illumination, intensity, and timing), so the precise consequences on intestinal morphology and nutrient utilization remain unclear. Despite these advances, persistent knowledge gaps remain. First, relatively few studies have examined intestinal histomorphology (duodenum, jejunum, ileum villi/crypt measurements and mucosal thickness) in domestic or slow-growing breeds incubated under different monochromatic LED spectra [14]. Second, breed-specific differences in shell permeability and embryonic photosensitivity mean that findings from commercial broilers cannot be generalized to domestic genotypes [10, 11]. The current study addresses these gaps by evaluating the effects of red, white, and green LED exposure during incubation on the morphology of the small intestine and subsequent growth in Gerze chicks, a locally important Turkish genotype. Understanding how specific wavelengths affect intestinal structure during embryonic development has both mechanistic and practical value. Morphological expansion of absorptive surface area shortly after hatching may accelerate the transition to exogenous feeding, thereby increasing early nutrient intake, improving welfare during the critical hatching period, and enhancing lifelong production efficiency. By integrating histological endpoints with hatching and growth outcomes in a local breed, this study will inform both fundamental developmental photobiology and practical lighting recommendations for sustainable poultry production. In addition to this biological framework, current studies in humans and animal models highlight the necessity of examining multidimensional biological data, such as intestinal morphology, not only in terms of mean differences but also in terms of patterns, classifiable structures, and the distinguishability of spectral groups with morphological signatures [15–17]. Therefore, it is increasingly important to model the differences in intestinal histomorphology induced by the light colors applied during incubation, not only with statistical tests but also with modern machine learning methods [18–20]. eXtreme Gradient Boosting (XGBoost), in particular, has become a widely used method in animal sciences and morphological studies in recent years due to its ability to classify complex morphological features, handle variable significance, and achieve high accuracy with biological data [21–24]. In this context, it offers an innovative and complementary perspective on the ability of small intestinal villi and crypt measurements to distinguish light groups and to determine whether specific wavelengths leave distinct, classifiable morphological signatures in intestinal structure. Therefore, the aim of this study is to determine whether the application of monochromatic red, white, and green LEDs to Gerze eggs alters hatching performance, to investigate their effects on the small intestinal morphology of chicks after hatching, and to demonstrate the extent to which intestinal morphological parameters can classify these light groups using the XGBoost algorithm. This approach will both identify the direction of biological differences and assess their detectability using machine learning, providing a more comprehensive framework for the morphological effects of incubation light treatments. Materials and methods Animals and ethical statement The research was conducted at the Research Farm of the Agricultural Faculty at Ondokuz Mayıs University, Samsun, Türkiye (41°21’40.5"N, 36°11’01.1"E, and 22 m above sea level). The animal study protocol was approved by the Local Animal Care and Ethics Committee of Ondokuz Mayıs University, which also approved the experimental procedures, ensuring compliance with the EC Directive 86/609/EEC for animal experiments (protocol code: 2023-51, dated June 22, 2023). Fertilized eggs obtained from 200 Gerze breed hens, 38–40 weeks old, were used as the study material. The eggs selected for the experiment weighed between 45 and 50 g and exhibited no deformities. All eggs were collected over a period of five days and stored under controlled conditions of 18 ◦C and 60% relative humidity. Incubation conditions Çimuka T2400S incubators and Çimuka T2400H hatchers (Çimuka Hatchery Industry and Trade Ltd. Co., Ankara, Türkiye) were used in each trial, with their front windows covered in cardboard to prevent light from entering the machines. Randomly selected one incubator was operated with the conventional dark incubation method, one incubator was outfitted with cool white LED strips (YuLED Silicone Strip LED 220 V, HBCV0000023KPV, Wavelength: 6000–6500 K), one with red LED strips (YuLED Silicone Strip LED 220 V, HBCV000006R87Z, Wavelength: 610–625 nm), and one with green LED strips (YuLED Silicone Strip LED 220 V; HBCV000006R885, Wavelength: 515–525 nm) [5]. LED lights were on each level, with two strips running the length of the racks. The strips were attached to metal frames, which were in turn attached to the bottom of the rack above them. For the top rack, light strips were held in place by a metal frame designed to rest on the top rack. Two egg trays were set on each rack, with each tray holding 48 eggs, for a total of six trays over two levels, equaling 192 eggs/incubator. The incubators were maintained at standard temperature and humidity levels of 37.5 °C and 55% relative humidity [5]. The eggs were incubated for 18 days, at which time they were moved into the hatchers, which were maintained at standard temperature and humidity levels of 36.5 °C and 65% relative humidity [5]. The hatchers had no lights, and the eggs were in complete darkness. Small intestinal sampling and post-hatch procedures At hatching, all chicks from each treatment group were weighed, and ten randomly selected chicks from each treatment group were sacrificed by decapitation. Then, the small intestines of chicks were excised and divided into the duodenum (from the gizzard outlet to the end of the pancreatic loop), jejunum (from the pancreatic loop to Meckel’s diverticulum), and ileum (from Meckel’s diverticulum to the cecum junction). The contents of the duodenum, jejunum, and ileum (aseptically) were emptied by gentle pressure, and then 1.5 cm pieces were placed in 10% formalin for histomorphological analysis and stored at 4 °C [25]. Histological analysis of the small intestinal morphology The villus characteristics in the duodenum, jejunum, and ileum were assessed by the hematoxylin and eosin histological staining technique [25] (Fig. 1). Tissue sections were dehydrated in gradient ethanol (75%; 1 h, 80%; 1 h, 90%; 1 h, 100%; 1 h, and 100%; 1 h), transparentized in pure xylene (15 min), and finally embedded in molten paraffin wax at 70 °C for 1 h, three times. Paraffin blocks were sectioned with a microtome at a thickness of 10 μm, and at least three sections per sample were floated in a 45 °C water bath. Afterwards, the sections were mounted onto glass slides and dried overnight on a slide warmer set at 50 °C. The sections were then stained with hematoxylin for 5 min and with eosin for 1 min. Each section was then dehydrated, transparentized, and sealed with Entellan (Merck, 1.07961.0100). A microscope (Zeiss, PrimoStar HD light microscope equipped with AxioCam ERc 5s 5mp digital microscope camera) was used to view the sections, and ZEN 2012 SP2 (Carl Zeiss, Jena, Germany) image analysis programme was used to scan the images. Four visual fields were randomly selected per section of duodenum, jejunum, and ileum, and villus height, villus width, crypt depth, mucosa thickness, and villus height to crypt depth ratio were quantified using ImageJ software [25]. Pictures of hematoxylin and eosin histological staining of the villus in the (a) duodenum, (b) jejunum, and (c) ileum Statistical analyses In the current study, the XGBoost algorithm was used to classify light groups based on intestinal morphological features. In this context, XGBoost is an iterative gradient boosting algorithm proposed by Chen and Guestrin [26]. The basic component of the Gradient Boosted Decision Trees (GBDT) model used in the XGBoost algorithm is the structure expressed as a regression tree, also called CART (Classification and Regression Tree) [27]. In this structure, each decision tree is constructed to minimize the residual values calculated according to the loss function. Split nodes are determined based on improvements in the loss function, and the contributions of each tree are added to the model prediction. The final output is obtained as the sum of the contributions of all trees. The most important advantages of the XGBoost algorithm include its strong generalization ability, regularization mechanisms that help resist overfitting, and high computational efficiency [28]. In this context, XGBoost is an ensemble learning method created by sequentially training decision trees, each focused on reducing the errors of the previous model. In XGBoost, the final prediction model is defined as the linear sum of numerous sequentially generated decision trees. The predicted value for a given observation is expressed as follows: where, represents the estimated class score for the i-th observation. represents each regression tree and T represents the total tree for the XGBoost algorithm. In addition, it is a CART tree that divides the feature space each into leaf nodes [21]. The XGBoost algorithm aims to reduce the Objective function given below. Here, is a differentiable loss function (e.g., the squared error term for regression-type problems); represents a hyperparameter that solves the model complexity. represents the weight of the j-th leaf, while γ controls the complexity of the tree. λ is a regulatory parameter that reduces overfitting [26]. In the Gradient Boosting process, the model was generated iteratively. In addition, each new tree is added to reduce the errors of the previous model. The prediction in the t-th iteration is updated as follows: Here, represents the learning rate and controls the level of contribution of each tree to the model. Low values allow the model to learn more slowly but more stably, while high values can lead to fast learning but with the risk of overlearning [29]. The learning process in Gradient Boosting requires the controlled regulation of each decision tree’s contribution to the model. The model’s complexity, learning speed, and generalization ability are directly dependent on the selection of hyperparameters used in the boosting process [26, 29]. Therefore, for the XGBoost algorithm to provide reliable and stable classification performance on biological data, the structural and learning-related hyperparameters of the model must be carefully determined. Below, the hyperparameters used in this study and the criteria considered in evaluating model performance are described in Table 1. Table 1The hyperparameters used in the XGBoost algorithm, their definitions, and their impact on model complexity and generalization performanceHyperparametersExplanationsThe effects on the prediction modelReferencemax_depthIt represents the maximum depth a decision tree can have.It limits the complexity of the tree structure; high values can cause the model to overfit the data, while low values create more generalizable models.Hastie et al. [40]; Chen and Guestrin [26]eta (learning rate)The learning rate determines the contribution rate of each decision tree to the model.Low eta values allow the model to learn more slowly but more stably; high values lead to faster learning but can increase the risk of overlearning.Friedman [29]; Natekin and Knoll [41]nroundsThis represents the total number of trees (iterations) created during the boosting process.This determines the model’s learning capacity; insufficient iterations can lead to incomplete learning, while excessive iterations can reduce generalization performance.Friedman [29]; Chen and Guestrin [26] The hyperparameters used in the XGBoost algorithm, their definitions, and their impact on model complexity and generalization performance To evaluate the model performances for classifying the lights of incubation time; accuracy, sensitivity, specificity, precision and F1-score were used. These metrics were chosen to reveal the power of differentiation between classes in a multifaceted manner. Statistical analyses and machine learning applications were performed using R software [30]. The dplyr package was used for preprocessing, organizing, and summarizing the dataset [31]. The Pearson correlation coefficients for each group provided by using GGally package in R software [32]. The dataset was split into training (80%) and test (20%) sets using the caret package with a stratified random sampling approach, ensuring that the proportional distribution of light treatment groups was preserved across both subsets [33]. A multi-class XGBoost model (xgboost package) was applied to classify light groups [34]. Different hyperparameter combinations were evaluated during model training, and model performance was assessed using accuracy, sensitivity, specificity, precision, and F1-score metrics calculated on the test dataset. MLmetrics and caret packages were used to calculate the performance metrics [35]. To evaluate the model’s discriminative power, ROC curves were generated and AUC values were calculated using the pROC package [36]. In the XGBoost model, the contributions of variables to classification were evaluated based on gain, cover, and frequency measures. One-way analysis of variance (ANOVA) was applied to statistically evaluate morphological differences between groups; Duncan’s multiple comparison test was performed using the agricolae package for variables found to be significant [37]. The SHAP values were calculated by SHAPforxgboost package and the visualization of the SHAP values by using ggplot2 package [38, 39]. Results Table 2 presents descriptive statistics and analysis of variance results for histomorphological features measured in the duodenum, jejunum, and ileum regions under different light incubation conditions. The findings show that both the light groups and the intestinal segments had significant effects on the parameters examined (p < 0.0001). Table 2Descriptive statistics and analysis of variance results for characteristics according to light groups and intestinal regions. (NDark= 65; NWhite= 40; NRed= 40; NGreen= 45)VariableColourDuodenumJejunumIleumP-value (Region)VillusDark380.32 ± 76.44cA354.06 ± 68.20bB249.35 ± 43.09bC< 0.0001White477.14 ± 102.02bA422.37 ± 62.46aB367.06 ± 123.89aC< 0.0001Red550.19 ± 98.54aA273.02 ± 55.80cB262.70 ± 136.91bB< 0.0001Green378.99 ± 75.29cA257.98 ± 50.02cB190.23 ± 68.71cC< 0.0001P-value (Colour)< 0.0001< 0.0001< 0.0001CryptDark14.04 ± 7.31B18.03 ± 8.14aA8.94 ± 2.59bC< 0.0001White14.37 ± 7.0412.07 ± 3.22b11.74 ± 5.39a0.0665Red11.75 ± 4.09A12.00 ± 3.19bA9.92 ± 3.56bB0.0232Green12.24 ± 4.52A10.48 ± 2.66bB9.38 ± 3.03bB< 0.001P-value (Colour)0.1092< 0.00010.0018MucosaDark42.43 ± 14.57cB10.51 ± 5.63bC52.51 ± 19.81bA< 0.0001White53.38 ± 15.36bA16.34 ± 5.95aB59.45 ± 24.90abA< 0.0001Red62.30 ± 25.20aA10.88 ± 4.91bB61.40 ± 11.98abA< 0.0001Green61.70 ± 22.80aA11.29 ± 3.70bB68.50 ± 24.83aA< 0.0001P-value (Colour)< 0.0001< 0.00010.0017Villus/CryptDark32.57 ± 14.25cA24.31 ± 13.03bB31.12 ± 13.74abA0.0015White44.15 ± 27.69b37.80 ± 13.76a34.76 ± 14.30a0.0979Red52.50 ± 24.03aA25.17 ± 11.35bB26.93 ± 10.65bB< 0.0001Green34.34 ± 11.76cA26.12 ± 8.56bB21.27 ± 8.49cC< 0.0001P value (Colour)< 0.0001< 0.0001< 0.0001a, bDifferent lowercase letters within the same column indicate significant differences among light groups according to Duncan’s multiple range test (P < 0.05). A, BDifferent uppercase letters within the same row indicate significant differences among intestinal regions within the same light group, as determined by Duncan’s multiple-range test (P < 0.05). No letters are shown when the overall comparison was not significant (P ≥ 0.05). P-value (Region): comparison among intestinal regions within each light group. P-value (Colour): comparison among light groups within each intestinal region Descriptive statistics and analysis of variance results for characteristics according to light groups and intestinal regions. (NDark= 65; NWhite= 40; NRed= 40; NGreen= 45) a, bDifferent lowercase letters within the same column indicate significant differences among light groups according to Duncan’s multiple range test (P < 0.05). A, BDifferent uppercase letters within the same row indicate significant differences among intestinal regions within the same light group, as determined by Duncan’s multiple-range test (P < 0.05). No letters are shown when the overall comparison was not significant (P ≥ 0.05). P-value (Region): comparison among intestinal regions within each light group. P-value (Colour): comparison among light groups within each intestinal region According to the results obtained in Table 2, statistically significant differences were determined among the light groups in terms of villus height in all intestinal regions (P < 0.0001 in all regions). The highest value was found in the Red group in the duodenum (550.19 ± 98.54), and in the White group in the jejunum and ileum (422.37 ± 62.46 and 367.06 ± 123.89, respectively). Furthermore, the fact that villus height was generally highest in the duodenum and lowest in the ileum in all light groups suggests that the proximal intestinal segments have a more advantageous structure in terms of absorptive surface development. Regarding crypt depth, no significant difference was found in the duodenum (P = 0.1092), while significant differences were determined in the jejunum (P < 0.0001) and ileum (P = 0.0018). Regional comparisons showed that the jejunum segment had higher crypt values ​​in most light groups, suggesting that epithelial renewal and cellular proliferation may be more active in this region. In the White group, however, the difference in crypt between intestinal regions was not statistically significant (P = 0.0665). Mucosal thickness changed significantly in all intestinal regions according to light applications (P < 0.0001 for duodenum and jejunum; P = 0.0017 for ileum), with lower values ​​observed in the jejunum segment in all groups, while higher measurements were obtained in the duodenum and ileum. Higher mucosal development was particularly noticeable in the duodenum and ileum regions in the red and green groups. Significant differences were found in the villus/crypt ratio among all light groups in all regions (P < 0.0001 in all regions), with the highest ratio in the duodenum observed in the red group (52.50 ± 24.03), and in the jejunum and ileum in the white group (37.80 ± 13.76 and 34.76 ± 14.30, respectively). While significant differences were observed among the dark, red, and green groups in regional comparisons, the difference between intestinal segments in the white group was not significant (P = 0.0979), suggesting a more homogeneous structural distribution in that group. Considering all results, it is clear that different light spectra affect the morphology of the small intestine in chicks, with this effect varying across intestinal segments. In particular, the fact that Red and White light applications produced higher values in parameters related to absorption capacity, such as villus height and villus/crypt ratio, suggests that the light spectrum can modulate early intestinal development. The correlation matrix given in Fig. 2 shows the relationships between villus (V), crypt (C), mucosa (M), and villus/crypt ratio (VC) variables of the duodenum (D), ileum (I), and jejunum (J) regions on a total dataset and light group basis. General and light group–specific correlation matrix of intestinal histomorphological traits. Corr= correlation When general correlation coefficients are examined in Fig. 2, it is seen that some morphological features within the same bowel segment show stronger relationships with one another. In particular, a moderately positive correlation between DV and DM (r = 0.48), a positive correlation between DV and DVC (r = 0.41), and a moderately positive correlation between IV and IC (r = 0.49) are noteworthy. These findings suggest that villus development, mucosal thickness, and structural ratios can change together in certain segments. Conversely, negative correlations were also determined in some pairs of variables. Specifically, a strong negative correlation was found between DC and DVC (r = -0.68), between JC and JM (r = -0.65), and a moderate negative correlation between IC and IVC (r = -0.40). This indicates that the villus/crypt ratio can decrease as crypt depth increases, and that there is an inverse balance between structural components in some regions. When light groups are evaluated separately, the correlation patterns show variability. For example, in the green group, a very strong negative correlation is found between the DV and the IV (r = -0.81), whereas in the red group, the same correlation is positive (r = 0.83). Similarly, in the white group, the correlation between IV and IM is very strong and positive (r = 0.79), whereas it is weaker in other groups. These results show that different light applications can affect not only the average values ​​but also the structural relationships between variables within intestinal morphology. Considering all results in Fig. 2, the correlation matrix shows that morphological organization among intestinal segments is not homogeneous and that complex relationship patterns can vary with the light spectrum. In particular, the relationships among villus height, crypt depth, and the villus/crypt ratio suggest that the effects of light treatments on intestinal development should be considered in a multidimensional manner. Table 3 presents the search space (grid) evaluated within the scope of hyperparameter optimization of the XGBoost model, and the optimum hyperparameter combination determined in terms of model performance. During the model tuning process, values ranging from 3 to 7 for the max_depth parameter, representing the maximum depth of decision trees, four different levels in the range of 0.01–0.3 for the eta parameter, representing the learning rate, and values ranging from 50 to 300 for the nrounds parameter, indicating the number of boosting iterations, were systematically tested. This comprehensive search aimed to achieve a balance between model complexity, learning rate, and generalization performance. Table 3Hyperparameter grid and optimal parameter set used for the XGBoost modelHyperparameterValuesmax_depth3, 4, 5, 6, 7eta0.01, 0.05, 0.1, 0.3nrounds50, 100, 200, 300Optimum Hyperparameters max_depth5 eta0.1 nrounds100 Hyperparameter grid and optimal parameter set used for the XGBoost model As a result of the grid search, the hyperparameter combination consisting of 5 for max_depth, 0.1 for eta, and 100 for nrounds was determined as the optimum structure providing the highest classification performance on the test dataset. A moderate tree depth allowed the model to capture complex patterns in intestinal morphological features while limiting the risk of over-learning. Similarly, a learning rate of 0.1 supported both fast and stable convergence of the model; and the 100-iteration boosting process provided sufficient learning capacity, contributing to a balanced optimization of model performance. These findings demonstrate that the selected optimal hyperparameters offer a suitable structure that maximizes the XGBoost algorithm’s ability to distinguish light groups based on morphological features. Table 4 presents the validation and independent test set performance results of the XGBoost model optimized with 5-fold cross-validation. Table 4Validation and test performance metrics of the XGBoost model optimized with 5-fold cross-validationValidation StrategyAccuracyMacro PrecisionMacro RecallMacro F1-score5-fold CVa0.758 ± 0.0710.772 ± 0.0730.752 ± 0.0700.755 ± 0.070Test Set0.78950.78960.79300.7878a5-fold cross-validation results are presented as mean ± standard deviation Validation and test performance metrics of the XGBoost model optimized with 5-fold cross-validation a5-fold cross-validation results are presented as mean ± standard deviation According to the results presented in Table 4, the accuracy of 0.758 ± 0.071 obtained in the cross-validation process indicates that the model generally exhibits consistent, acceptable performance across different data splits. Similarly, the macro precision (0.772 ± 0.073), macro recall (0.752 ± 0.070), and macro F1-score (0.755 ± 0.070) values ​​indicate a balanced predictive power across classes. The accuracy of 0.7895 in the standalone test set indicates that the model successfully generalizes the patterns learned during training to new data. Furthermore, the fact that the macro precision (0.7896), macro recall (0.7930), and macro F1-score (0.7878) values in the test set were consistent with and slightly higher than the cross-validation results supports the model’s ability to achieve reliable classification performance without overlearning. The XGBoost algorithm shows promising performance in distinguishing morphological patterns of the small intestine across different light groups. Figure 3 presents the confusion matrix of the optimal XGBoost model. The results show that the model generally classifies light groups successfully, but there is limited overlap between some groups. 10 of 13 samples in the Dark group were correctly classified, while the remaining 3 were assigned once each to the White, Red, and Green groups. In the White group, 7 out of 9 samples were correctly predicted, with one sample each classified as Dark and Red. In the Red group, 6 out of 8 samples were correctly classified, with two samples assigned to the Green group. In the Green group, 7 out of 8 samples were correctly predicted, with only one sample classified as Dark. Confusion matrix for the optimal XGBoost model. Freq= frequency The concentration of misclassifications between specific group pairs suggests that some light applications may yield partially similar patterns of intestinal histomorphology. The mixing of Red samples with the Green group, in particular, suggests that these two applications may produce similar effects in certain morphological features. Conversely, the higher rates of correct classification in the White and Green groups indicate that the model distinguishes the intestinal structural features of these groups more clearly. Considering all results in Fig. 3, the confusion matrix findings indicate that different incubation light conditions produce identifiable and classifiable differences in the morphology of the small intestine in chicks. Table 5 presents the classification performance metrics of the optimal XGBoost model based on light groups. The results in Table 5 show that, while the model’s performance is generally balanced across groups, it shows higher discrimination in some classes. The White group stands out as one of the most successful classes, with 0.875 precision, 0.8235 F1-score, and 0.8716 balanced accuracy. This suggests that the morphological patterns of the White group are more distinctly differentiated from those of other groups. The Green group showed the highest performance in capturing true positives, with a sensitivity of 0.875, but the precision of 0.700 indicates that some samples may have been misclassified as Green from other classes. In the Dark group, 0.8333 precision and 0.8446 balanced accuracy support the model’s reliable predictive performance, while the red group exhibited a more balanced but relatively moderate performance of approximately 0.75 across all basic metrics. Balanced accuracy values above 0.84 across all groups indicate that the model can distinguish between light groups with acceptable accuracy, regardless of class imbalance. Furthermore, the class-based performance metrics presented in Table 5 support the confusion matrix findings in Fig. 2. The sensitivity and precision values for each class indicate that the correct classification rates and incorrect prediction patterns are consistent at the class level. These results suggest that different light incubation conditions produce class-identifiable structural differences in the morphology of the small intestine in chicks. Table 5Class-based performance metrics of the optimal XGBoost modelGroupsSensitivitySpecificityPrecisionF1-scoreBalanced AccuracyDark0.76920.920.83330.80.8446White0.77780.96550.8750.82350.8716Red0.750.93330.750.750.8417Green0.8750.90.70.77780.8875 Class-based performance metrics of the optimal XGBoost model Figure 4 shows the ROC curves obtained using the one-vs-rest approach for each light group (Dark, White, Red, and Green) of the XGBoost model trained with optimum hyperparameters. The ROC curves allow for the evaluation of the model’s ability to distinguish each light group from others through the balance between sensitivity and specificity. The fact that the curves lie significantly above the diagonal reference line reveals that the model exhibits superior discrimination performance compared to random classification for all light groups. According to Fig. 4, the AUC values are indeed above 0.90 across all classes, supporting the model’s strong classification capacity. The highest AUC value was observed in the green group (0.9464), suggesting that this group is more clearly differentiated from the other groups in terms of intestinal histomorphological features. This is followed by the White group (0.9292), showing that patterns belonging to the white group can also be identified with high accuracy. The AUC value of 0.9167 in the red group indicates that this class can also be strongly distinguished, while the value of 0.9138 in the Dark group similarly indicates high classification success. Overall, the findings in Fig. 4 show that the XGBoost model can identify small-intestine morphological changes induced by different light incubation conditions with high accuracy and demonstrates promising performance in multi-class classification. ROC curve for each light group according to the results of the optimal XGBoost algorithm Figure 5 presents the relative importance levels (gain) of the intestinal histomorphological variables used to classify light groups in the optimal XGBoost model. The findings show that not all variables contribute equally to the model’s decision-making mechanism, and some features are significantly more effective in classification. The highest importance level was assigned to the JV (Jejenum Villus) variable (Gain = 0.3382), indicating that jejunum villus height is the strongest determinant in distinguishing light groups. DV (Duodenum Villus) ranked second (0.1607), and JC (Jejenum Crypt) ranked third (0.1363). These findings indicate that villus and crypt structures, particularly those in the jejunum and duodenum, play a critical role in model performance. Variables showing moderate importance include IV (Ileum Villus) (0.1069), DM (Duodenum Mucosa) (0.0657), DVC (Duodenum Villus/Crypt ratio) (0.0528), and IVC (Ileum Villus/Crypt ratio) (0.0501). This indicates that mucosal thickness and the villus/crypt ratio, although less significant than villus height, also contribute to the classification process. In contrast, the IC (Ileum Crypt) variable had the lowest significance level (0.0060), suggesting a limited role in model decisions. Relative importance (Gain) of morphological variables used in classifying light groups in the XGBoost model Figure 6 presents the SHAP beeswarm plot of the optimal XGBoost model, showing the direction and magnitude of each histomorphological variable’s contribution to the model predictions. Each point on the graph represents an individual observation, and the SHAP value on the horizontal axis reflects the effect of the variable on the probability of predicting a particular class. Values to the right of the zero line indicate a positive contribution to the model prediction, while values to the left indicate a negative contribution. A wider distribution of variables on the horizontal axis indicates a higher impact on model decisions. Analysis of the findings reveals that the JV (Jejunum Villus) variable has the widest SHAP distribution and is the feature that most significantly affects model predictions. Similarly, the DV (Duodenum Villus), IV (Ileum Villus), and JC (Jejunum Crypt) variables also showed wide ranges of influence, playing a significant role in classification. The concentration of positive observations related to specific light groups in some variables suggests that these features contribute more significantly to the differentiation of the relevant classes. In contrast, the clustering of SHAP values around zero for variables such as IC (Ileum Crypt) and JVC (Jejunum Villus/Crypt ratio) indicates that these features contribute less to model decisions. The results in Fig. 6 reveal that the model’s decision-making mechanism is shaped by a few dominant morphological variables, and that measurements related to villus and crypt structure are particularly decisive for classification. Class-wise beeswarm SHAP contributions for light groups of intestinal regions in the optimal XGBoost model The findings in Fig. 6 are largely consistent with and support the variable importance results presented in Fig. 5. The fact that the JV variable, which has the highest Gain value in Fig. 5, also shows the widest SHAP distribution in Fig. 6 confirms that this variable plays the most dominant role in model predictions. Similarly, the DV, IV, and JC variables, which ranked highly in Fig. 5, also stand out with high contribution levels in Fig. 6. In contrast, the limited impact of variables such as IC and, to some extent, JVC, which have low significance levels in Fig. 5, is evident in the SHAP graph, revealing consistency between the two explainability approaches. These results demonstrate that the model not only performs well but also prioritizes biologically significant variables in its decision-making. In the current study, the effects of different light colors applied during incubation on the small intestine morphology of chicks were comprehensively evaluated using a combination of classical statistical methods and machine learning-based approaches. Analysis of variance and multiple comparison tests performed on individual morphological features revealed significant differences between light groups in terms of villus length, crypt depth, mucosal thickness, and related ratios. To reveal how these biological differences are organized within a holistic and multivariate structure, the XGBoost classification model was applied. The model demonstrated acceptable accuracy and balanced performance metrics in the test dataset, confirming that small intestine morphology carries distinctive information for each light group. Gain-based variable significance analyses obtained from the model outputs showed that morphometric features, particularly those related to villus and mucosa, played a dominant role in the classification process, while the intestinal region variable offered a more limited but significant global contribution. However, SHAP-based explainability analyses revealed that behind this moderate global significance of the intestinal region, the duodenum, jejunum, and ileum exhibited effects in different directions and magnitudes specific to the light groups. In particular, some intestinal segments strongly supported classification in certain light groups, while the distinctiveness of other segments was weakened. These holistic results demonstrate that the light spectra applied during incubation shape not only overall intestinal development but also morphological differentiation at the regional level, and that these complex biological patterns can be successfully captured with machine learning and SHAP analysis. Discussion The results of this study reveal that different light spectra applied during incubation significantly affect small intestine morphology in chicks, both generally and regionally. Classical statistical analyses show that basic histomorphometric parameters such as villus length, crypt depth, and mucosal thickness differ depending on the light groups, while machine learning-based classification results confirmed that these morphological changes, when considered together, form a distinctive structural signature of the light colors. The results, particularly supported by the high explanatory power of the XGBoost model and SHAP analyses, suggest that light shapes digestive system development during embryonic development not only through quantitative growth but also through differentiation specific to intestinal segments. In this context, while the current findings are consistent with previous studies addressing the effects of light applications during incubation on intestinal development, they offer a new perspective to the literature by being presented in a local genotype and within a multivariate analytical framework. The fact that multiple metrics of small intestinal morphology exhibit a distinctive structure when considered together suggests that morphological data may be functional indicators reflecting biological responses to environmental conditions. The ability to classify these differentiations in intestinal histomorphology created by applied light spectra during the embryonic period with high accuracy using machine learning-based models indicates that morphology should be considered not only a descriptive but also a predictive source of information. This approach parallels recent studies examining the relationship between morphological features and ecological performance and environmental adaptation through multivariate and predictive models. Studies addressing the predictive potential of morphological features reveal that such data carry functional indicators reflecting environmental and ecological differences. In this context, Madrigal-Roca [42] demonstrated that morphological data in birds offer high classification success in distinguishing primary lifestyles; in analyses conducted on a large-scale dataset, morphological features showed statistically significant differences between lifestyles, and tree-based machine learning models achieved accuracy values above 78%. While not entirely consistent with this conceptual framework, the present study addresses the morphology-environment relationship at the level of developmental plasticity dependent on light spectra applied during the embryonic period, rather than long-term interspecies adaptations. The combined evaluation of criteria related to small intestinal villi, crypts, and mucosa enabled the successful classification of light groups, while SHAP analyses revealed that morphological contributions varied in direction and magnitude specific to the group and intestinal region. This demonstrates that morphological features carry dynamic and predictive biological signatures reflecting not only ecological lifestyles but also structural responses to early environmental stimuli. The advantages offered by gradient boosting algorithms under limited data conditions provide an important framework supporting the methodological choices of the present study. Kyrychek [43] demonstrated that XGBoost, LightGBM, and HistGradientBoosting algorithms exhibit high generalization ability in classification problems with limited training data thanks to their regularization, shrinkage, and subsampling mechanisms. In that study, it was emphasized that internal regularization structures provide resistance to over-learning and enable high classification accuracy even with small sample sizes. These findings explain the successful classification of light groups using multidimensional biological data such as small intestine morphology, but with relatively limited sample sizes, in the present study. The balanced learning process provided by the XGBoost algorithm through its structural components such as hyperparameter optimization, learning rate, and tree depth, in line with the theoretical framework defined by Kyrychek [43], enabled the model to capture morphological patterns without overfitting. Therefore, this study validates the potential of gradient boosting methods in solving complex classification problems under limited data conditions in a biological and developmental context; it provides a complementary contribution to the literature by presenting an experimental application of the methodological recommendations presented in Kyrychek [43]. The flexibility and high discrimination offered by the XGBoost algorithm in complex and high-dimensional data structures are becoming increasingly evident in studies conducted across different disciplines. Samat et al. [44] evaluated the performance of XGBoost in the context of hyperspectral image classification; they showed that the meta-XGBoost approach, developed using spectral-spatial features enriched with morphological profiles, provides superiority over traditional and ensemble-based methods in terms of both classification accuracy and computational efficiency. In this study, the combined evaluation of CART, DART, linear, and random forest-based enhancers revealed the capacity of the XGBoost architecture to adapt to different data representations. These findings methodologically support the ability of the XGBoost model used in the present study to successfully classify light groups by considering multiple criteria related to small bowel morphology and intestinal region information together. While Samat et al. [44] morphological profiles play a decisive role in distinguishing spatial patterns in this study structural features associated with villi, crypts, and mucosa stand out as distinctive signatures reflecting the effects of an environmental stimulus (light spectrum) in a biological system. The key point common to both studies is that when morphology-based multivariate features are used in conjunction with the XGBoost algorithm, they can achieve high generalization success in complex classification problems. In this respect, the findings of Samat et al. [44] in the field of remote sensing demonstrate that the power of XGBoost in working with morphological data is not limited to image analysis; it can also be used as a similarly effective classification tool in biological and developmental data. The effectiveness of machine learning-based approaches in interpreting biological data becomes particularly evident in high-dimensional and unbalanced data structures. In this context, Mustapha and Saeed [45] evaluated the performance of the XGBoost algorithm in predicting biological activity based on quantitative descriptors of molecular structure and showed that the algorithm provided higher accuracy compared to common methods such as Random Forest, Support Vector Machines, artificial neural networks, and Naïve Bayes in both balanced and severely class-unbalanced datasets. Its ability to successfully distinguish underrepresented biological activity classes, in particular, highlights XGBoost’s superiority in capturing complex biological signals. These findings are methodologically consistent with the results observed in the classification of light groups in the present study. The combined evaluation of multiple structural criteria of small intestine morphology and intestinal region information demonstrates that XGBoost can model biological variation not only through dominant patterns but also through more subtle and group-specific differences. While Mustapha and Saeed [45] consider molecular descriptors as inputs reflecting the structural basis of biological activity, in this study, morphological parameters represent the structural effects of an environmental stimulus (light spectrum) at the organism level. A key element common to both approaches is that XGBoost offers both high discrimination and strong generalization capabilities in complex biological data. This supports the idea that XGBoost is a powerful predictive tool capable of effectively integrating structural information at different scales in biological systems. One of the recent studies demonstrating the classification performance of the XGBoost algorithm in the health field is by Rais et al. [46], who evaluated the effectiveness of XGBoost in determining hypertension levels and showed that model performance could be significantly improved with hyperparameter optimization. In this study, the XGBoost model optimized with the grid search method exhibited reliable classification success on clinical data, providing 93.3% accuracy, high precision (Precision = 97%), and strong discrimination (AUC = 0.935). These findings reveal that XGBoost can create models resistant to overlearning and generalizable in biological and medical data thanks to its regularization mechanisms and hyperparameter adjustment flexibility. Similarly, in the present study, it was observed that light groups could be classified significantly as a result of modeling multiple structural criteria of intestinal morphology with the XGBoost algorithm, and the model performance was balanced with hyperparameter optimization. While Rais et al. [46] used individual clinical parameters to predict disease levels, this study considers morphological indicators as distinctive features reflecting the effects of an early environmental factor (light spectrum) on biological structure. When both studies are evaluated together, it is clear that XGBoost is a powerful method capable of successfully solving complex classification problems at different biological scales—from clinical phenotypes to tissue-level morphological structures. In their study, Hubu and Pratama [47], who examined the performance of algorithms in classification problems against unbalanced data structures using training data, comparatively evaluated the XGBoost, Gradient Boosting, and KNN algorithms. In the study, both balanced and unbalanced data schemas were used to predict student graduation status; it was shown that the XGBoost algorithm significantly improved its classification performance, especially after correcting data imbalance with the SMOTE-TOMEK technique. The fact that XGBoost achieved accuracy, precision, sensitivity, and an F1-score of 1,000 on the balanced dataset reveals that the algorithm has high discrimination and generalization ability in complex and unbalanced data structures. These findings are methodologically consistent with the results obtained in the present study; because here too, the XGBoost model developed using multivariate morphological data successfully classified light groups and exhibited a balanced performance profile, especially in the test set. While Hubu and Pratama [47] used a heterogeneous feature space consisting of academic and administrative indicators, this study presented tissue-level morphological criteria as input to the model. Nevertheless, both studies clearly show that XGBoost can achieve high classification success in different fields and with different data characteristics thanks to its regularization structure and boosting architecture. This supports the idea that XGBoost is a powerful and reliable method not only in classical application areas such as education or health, but also in the analysis of biological and experimental data. The power of machine learning approaches based on morphological features in biological classification problems was clearly demonstrated in the study conducted by Yu et al. [48] on the differentiation of subtypes of primary intestinal T-cell lymphomas. In this study, the XGBoost model, developed using quantitative nuclear morphometric features obtained from histopathological images, classified two lymphoma subtypes defined according to WHO criteria with high accuracy, and the AUC value reaching 0.966 showed that morphological data carry strong and distinctive biological signatures in disease classification. This approach conceptually aligns with the findings obtained in the present study, where criteria related to small intestinal morphology were classified based on light spectra. While morphological features served to differentiate pathological subtypes in Yu et al. [48]’s study, in this study, the same type of quantitative morphological criteria were used to reveal the structural effects of an environmental factor (light color) applied during the embryonic period at the tissue level. Both studies highlight XGBoost’s capacity to reduce high-dimensional morphological data, present biologically interpretable variable significance, and successfully capture subtle differences between classes. This demonstrates that morphology-based machine learning approaches can be used as a powerful analytical tool not only in clinical applications such as disease diagnosis, but also in developmental biology and environmental sensitivity studies. The study by Bentéjac et al. [49], which systematically compared different variants of gradient boosting algorithms in terms of performance, generalization ability, and hyperparameter sensitivity, provides important methodological findings explaining why XGBoost is widely preferred in complex structures such as biological and experimental data. In this study, XGBoost, LightGBM, and CatBoost algorithms were evaluated in terms of training speed, generalization success, and hyperparameter tuning requirements. While CatBoost showed limited superiority in overall accuracy and AUC, LightGBM stood out in terms of training speed, and XGBoost exhibited balanced performance in terms of both accuracy and computational efficiency. In particular, XGBoost’s scalable structure, regularization mechanisms, and controlled response to hyperparameter tuning allow for the development of models resistant to overlearning in limited or noisy datasets. These findings methodologically support the preference for XGBoost in the classification of multidimensional metrics of small bowel morphology in the present study. Indeed, the results obtained in the present study show that XGBoost not only provides high accuracy but also produces biologically interpretable outputs through variable significance and SHAP analyses. Therefore, the comparative framework presented by Bentéjac et al. [49] provides a theoretical basis confirming that XGBoost is a suitable algorithm in this study in terms of both performance and interpretability. The study by Bernal et al. [50], focusing on interpretability and misclassification problems in tree-based machine learning models, shows that SHAP analyses are not limited to explaining variable significance but can also be used as a strategic tool to improve model performance. In the study, it was revealed that a large portion of the samples misclassified through SHAP values in classification models developed using Extra Trees, Random Forest, GBM, and XGBoost algorithms were located within the feature ranges specific to the opposing class. This finding shows that SHAP-based feature analyses allow for a better understanding of the model’s decision limits and the systematic identification of ambiguous samples. In the present study, SHAP outputs obtained using the XGBoost model revealed that the contributions of small intestine morphology criteria to the light group discrimination process varied in both direction and magnitude. The fact that villi, crypts, and mucosal features differ under different light spectra, particularly depending on the intestinal region, supports the power of SHAP analyses in revealing interpretable decision patterns in a biological context, as highlighted by Bernal et al. [50]. Therefore, this study demonstrates that SHAP-based interpretation approaches not only increase model transparency but also contribute to more reliably analyzing the relationship between complex biological features, such as morphological data, and environmental factors. As a result of the XGBoost-based classification and SHAP-supported interpretation approach used in this study demonstrates conceptual continuity with methods successfully applied in a wide range of disciplines in the literature, including ecology, biomedical sciences, remote sensing, chemical modeling, and educational sciences. This reveals that such machine learning-based models are not limited to data-intensive or high-tech fields but also offer strong analytical potential in livestock research where biological variation and environmental sensitivity are significant. The ability to classify biological structures, such as intestinal morphology, which are multivariate and limited to interpretation by classical statistical approaches, in relation to environmental factors, indicates that these methods can be used more widely and systematically in the field of animal husbandry. Therefore, this study not only reveals the effects of light spectra applied during incubation but also demonstrates that machine learning-based, interpretable, and generalizable models can be used as a powerful tool in animal sciences for evaluating the biological consequences of environmental manipulations. Conclusion This study investigated the effects of different light spectra applied during incubation on small intestine morphology in Gerze chicks using a multivariate and interpretable machine learning approach. The findings show that morphological criteria related to villi, crypts, and mucosa differed significantly among light groups, and these structural differences could be successfully classified using the XGBoost algorithm. In particular, the accuracy, sensitivity, and F1-score values obtained by the model trained with optimal hyperparameters in the test set revealed that morphological data carry distinctive signatures specific to the light spectra. SHAP-based interpretive analyses not only supported model performance but also showed that the contributions of different intestinal regions and morphological criteria to the classification process varied in direction and magnitude. This suggests that light spectra exposure during embryonic exposure creates region-specific developmental responses in the small intestine, and that these responses should be evaluated not only through average differences but also through holistic morphological patterns. In conclusion, this study demonstrates that machine learning-based classification and interpretability approaches offer a powerful and complementary tool for assessing the early biological impacts of environmental factors in livestock research. Addressing the multivariate nature of morphological data with such approaches, when developing strategies for optimizing incubation conditions, can make significant contributions to both fundamental developmental biology and applications in sustainable poultry production. In addition, future studies that evaluate histomorphological results alongside indicators of digestive enzyme activity, intestinal barrier integrity, and nutrient transport mechanisms will contribute to a more comprehensive and holistic understanding of the effects of light conditions during the incubation period. Acknowledgements Not applicable. Authors’ contributions Conceptualization, U.Ş. and E.C.; methodology, U.Ş., E.C., İ.C., C.T., G.F., H.Ç., İ.C.K. and O.O.; validation, U.Ş., E.C. and C.T.; formal analysis, U.Ş., C.T. and O.O.; investigation, U.Ş. and E.C.; re-sources, U.Ş., E.C., İ.C., C.T., G.F., H.Ç., İ.C.K. and O.O.; data curation, U.Ş., E.C., İ.C., C.T., G.F., H.Ç., İ.C.K. and O.O.; writing—original draft preparation, U.Ş., E.C., C.T. and O.O.; writing—review and editing, U.Ş., E.C., İ.C., C.T., G.F., H.Ç., İ.C.K. and O.O.; visualization, U.Ş., E.C., C.T. and O.O.; super-vision, U.Ş. and E.C.; project administration, U.Ş. and E.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 analysed during the current study are available from the corresponding author on reasonable request. Declarations Ethics approval and consent to participate The animal study protocol was approved by the Local Animal Care and Ethics Committee of Ondokuz Mayıs University, which also approved the experimental procedures, ensuring compliance with the EC Directive 86/609/EEC for animal experiments (protocol code: 2023-51, dated June 22, 2023). The experiment was conducted on the livestock farm of Ondokuz Mayıs University. Prior to sampling, written informed consent was obtained from the institution’s livestock farm, which provided signed authorization for the use of animals and farm facilities for research purposes. 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. Footnotes Publisher’s Note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. References Associated Data Data Availability Statement The datasets generated and/or analysed during the current study are available from the corresponding author on reasonable request.