Next Article in Journal
Responses of Hydrangea macrophylla In Vitro Plantlets to Different Light Intensities
Previous Article in Journal
Zinc Fertilization Enhances Growth, Yield, and Zinc Use Efficiency of Rice (Oryza sativa L. cv. Chai Nat 1) in Contrasting Soil Textures
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Interpreting Machine Learning Models with SHAP Values: Application to Crude Protein Prediction in Tamani Grass Pastures

by
Gabriela Oliveira de Aquino Monteiro
1,*,
Gelson dos Santos Difante
1,
Denise Baptaglin Montagner
2,
Valéria Pacheco Batista Euclides
2,
Marina Castro
3,
Jéssica Gomes Rodrigues
1,
Marislayne de Gusmão Pereira
1,
Luís Carlos Vinhas Ítavo
1,
Jecelen Adriane Campos
4,
Anderson Bessa da Costa
4 and
Edson Takashi Matsubara
4
1
Department of Animal Science, Federal University of Mato Grosso do Sul (UFMS), Campo Grande 79070-900, MS, Brazil
2
Embrapa Beef Cattle, Campo Grande 79106-550, MS, Brazil
3
Mountain Research Center (CIMO), Polytechnic Institute of Bragança, Santa Apolónia Campus, 5300-253 Bragança, Portugal
4
Department of Computer, Federal University of Mato Grosso do Sul (UFMS), Campo Grande 79070-900, MS, Brazil
*
Author to whom correspondence should be addressed.
Agronomy 2025, 15(12), 2780; https://doi.org/10.3390/agronomy15122780
Submission received: 20 June 2025 / Revised: 21 September 2025 / Accepted: 26 September 2025 / Published: 2 December 2025
(This article belongs to the Special Issue Precision Farming Applied to Grazing Lands)

Abstract

Machine learning models such as XGBoost show strong potential for predicting pasture quality metrics like crude protein (CP) content in tamani grass (Panicum maximum). However, their ‘black box’ nature hinders practical adoption. To address this limitation, this study applied SHapley Additive exPlanations (SHAP) to interpret an XGBoost model and uncover how management practices (grazing interval, nitrogen fertilization, and pre- and post-grazing heights) and environmental factors (precipitation, temperature, and solar radiation) jointly influence CP predictions. Data were divided into 80% for training/validation and 20% for testing. Model performance was assessed with stratified 5-fold cross-validation, and hyperparameters were tuned via grid search. The XGBoost model yielded a Pearson correlation coefficient (r) of 0.78, a mean absolute error (MAE) of 1.45, and a coefficient of determination (R2) of 0.57. The results showed that precipitation in the range of 100–180 mm increased the predicted CP content. Application of 240 kg N ha−1 year−1 positively affected predicted CP, whereas a lower dose of 80 kg N ha−1 year−1 had a negative impact, reducing predicted levels of CP. These findings highlight the importance of integrated management strategies that combine grazing height, nitrogen fertilization, and grazing intervals to optimize crude protein levels in tamani grass pastures.

1. Introduction

The productivity of animal production systems that rely on pasture as the primary feed source for ruminants can be enhanced through the adoption of improved technologies and management practices [1]. In this context, monitoring pasture quality is essential to determine the optimal grazing time, balance forage production and nutritive value, and ultimately improve animal performance [2].
Accurate and reliable information on pastures is, therefore, critical for research aimed at developing technologies that optimize production efficiency while reducing resource use, labor, and land requirements [3,4]. This calls for tools that allow rapid and cost-effective data collection. With continuous advances in artificial intelligence, machine learning techniques have gained prominence as they can efficiently analyze complex datasets, extract meaningful insights, and support faster decision-making [5].
Predictive modeling using machine learning has been widely applied to estimate canopy height and biomass from UAV and remote sensing imagery [6,7,8,9]. However, the application of these approaches in pasture-based systems remains challenging due to pronounced spatial and temporal heterogeneity. Although deep learning-based models have demonstrated promising performance, their practical application in field conditions is still constrained. For instance, Wang et al. [10] showed that variations in lighting conditions compromised the accuracy of computer vision models for blueberry detection, underscoring the sensitivity of these algorithms to environmental variability and the need for more robust and interpretable approaches for real-world applications.
Moreover, the effectiveness of machine learning techniques in capturing the interactions between biotic and abiotic factors in predictive modeling remains insufficiently understood [11]. Many models are inherently complex and often function as “black boxes,” making it difficult to interpret the reasoning behind predictions, even when their internal parameters are accessible [12]. Understanding why a model produces a specific output can be as important as predictive accuracy, as it builds user confidence and generates actionable insights [13].
In this regard, SHapley Additive exPlanations (SHAP) have emerged as a powerful framework to improve model interpretability by quantifying the contribution of each variable to the prediction [13,14]. SHAP assigns a value of importance to each feature based on its impact on the prediction, regardless of whether the variable is present in a given estimation [15,16]. This enables both the direction and magnitude of variable effects to be assessed, allowing interpretation at both the local and global levels. Unlike traditional methods such as Random Forest, feature importance, or Linear Regression coefficients, SHAP captures complex, non-linear interactions among variables, making it particularly suited for advanced algorithms such as XGBoost, Neural Networks, and Random Forest [13].
Recent studies have increasingly employed SHAP (SHapley Additive exPlanations) to enhance the interpretability of machine learning models in livestock and grassland systems. For example, SHAP analysis has been applied to GPS-derived features to interpret cattle foraging behavior [17]; environmental and physiological sensor data for predicting core body temperature in dairy cows [18]; satellite-based vegetation indices and agrometeorological data for grassland yield prediction [19]; and hyperspectral bands for biomass and nutrient estimation [20]. While these approaches demonstrate the utility of SHAP in revealing the contribution of spectral, sensor-based, and remotely sensed predictors, there remains a notable gap in applying SHAP analysis to tabular datasets derived from pasture management practices, such as grazing intervals, pre- and post-grazing heights, and nitrogen fertilization. Addressing this gap could provide interpretable, evidence-based insights directly applicable to management decisions in grazing systems.
Accordingly, the objective of this study was to apply SHAP analysis to interpret the influence of management heights, grazing interval, nitrogen doses, light interception, precipitation, temperature, and solar radiation on the predictions of an XGBoost model [21] to estimate the crude protein (CP) content of Megathyrsus maximus cv. BRS Tamani grass leaves.
The contributions of this study are as follows:
  • It provides an interpretation of the XGBoost model for predicting the crude protein (CP) content of Tamani grass leaves using the SHAP technique. This represents an advance in the methodological framework for forage production studies, offering an explainable model that generates insights to support decision-making.
  • The analysis revealed that rainfall within the range of 100–180 mm tends to increase the CP content of Tamani grass leaves, underscoring the value of interpretability in identifying optimal management practices.
  • The findings demonstrated that the application of 240 kg ha−1 year−1 of nitrogen enhances leaf CP content when combined with favorable pasture structural conditions, such as appropriate pre- and post-grazing heights.

2. Materials and Methods

2.1. Data Description

Data were collected from a 0.96 ha tamani grass pasture at Brazilian Agricultural Research Corporation (Embrapa Beef Cattle, Campo Grande, MS, Brazil), intensively managed from October 2020 to April 2022, located in the Cerrado biome, Brazil (Figure 1). The experimental area was divided into four blocks, each further subdivided into four paddocks of 0.06 ha. A randomized block design was employed, arranged in a 2 × 2 factorial scheme. The treatments consisted of two grazing frequencies: 90% and 95% light interception (LI); combined with two nitrogen (N) topdressing rates: 80 and 240 kg ha−1 year−1. Grazing intensity was kept fixed at 50% of pasture height in pre-grazing for the four treatments. The grazing method was mob stocking [22].
The variables temperature, precipitation, and solar radiation for the experimental period were collected by the Embrapa Beef Cattle meteorological station, located approximately 2.4 km from the experimental area. The data were organized into the following seasons: 20/21 Rainy (December 2020 to 28 February 2021), transition 21 Rainy-Dry (March and April 2022), 21 Dry-Rainy (first grazing cycle of each treatment after the dry period), 21/22 Rainy (December to 28 February 2022), and 22 Rainy-Dry (March and April 2022).
Forage mass was collected at each grazing cycle using quadrat sampling. The samples were separated into leaf blades, stems, and dead material. Leaf subsamples were ground and analyzed for crude protein (CP) content using NIRS, following Marten et al. [23]. At each grazing cycle, canopy light interception and pre- and post-grazing sward height were measured, and the interval between grazing was calculated as the sum of the rest days.
The dataset comprised 14 variables, including one dependent variable and 13 independent variables (season, temperature, solar radiation, precipitation, nitrogen dose, light interception, grazing interval, and pre- and post-grazing heights), totaling 90 instances. Table 1 summarizes the dataset, indicating the meaning, units, and ranges of all variables. The data were split into 80% for training and validation and 20% for testing. Model evaluation employed stratified 5-fold cross-validation with 100 iterations to mitigate overfitting. Hyperparameter tuning was performed using grid search on the training set and integrated into the cross-validation process to optimize the balance between bias and variance, thereby improving the reliability of the results.

2.2. Machine Learning

Several machine learning algorithms, including Random Forest and Neural Networks, were evaluated. XGBoost was selected for its superior predictive performance, robustness to overfitting, and computational efficiency on tabular data. Based on gradient boosting, XGBoost sequentially builds decision trees by splitting data according to input variable thresholds, capturing complex relationships between predictors and the target variable. This approach creates a hierarchical tree-shaped structure, where the root defines the first division criterion, the internal nodes represent intermediate subdivisions, and the leaves correspond to the final output of the model [13]. The hyperparameter configuration used was shallow trees with a maximum depth of 2, 200 iterations and a learning rate of 0.1 with 60% of the data and 60% of the features per tree (Table 2).
The XGBoost model yielded a Pearson correlation coefficient (r) of 0.78, a mean absolute error (MAE) of 1.45, and a coefficient of determination (R2) of 0.57 in predicting the crude protein content of tamani grass leaves.

2.3. SHapley Additive exPlanations (SHAP)

The SHAP technique was used to interpret and explain prediction results, as well as to provide a measure of the importance of each variable in the XGBoost model for CP prediction. To calculate the model’s SHAP values, we used the TreeExplainer implementation developed by [15], which offers an efficient and accurate method for gradient-boosted tree-based machine learning models. Unlike permutation-based methods, TreeSHAP follows only valid paths in the tree and avoids unrealistic feature combinations. It calculates a weighted average over reachable leaf nodes for each feature coalition and scales linearly with the number of samples and polynomially with the number of features.
Based on Shapley value theory, which originates from cooperative game theory, the SHAP approach fairly distributes the importance of each predictor variable by considering all possible combinations of features. SHAP values quantify the impact of each variable on the model’s prediction by computing the difference between the expected model output; this is the case if no information about the features are known (the base value, E[f(z)]) and the current prediction is f(x). In this framework, SHAP values allow for the measurement of the individual contribution of each feature to a specific prediction. The prediction for a given instance is decomposed into additive contributions assigned to each variable, such that the sum of these parts equals the model’s output exactly—a property known as efficiency. This local decomposition faithfully represents the model’s behavior, as it accounts for all possible combinations of input features and computes their average marginal contribution [15].
Graphs of the overall importance of the variables, SHAP summary graphs to investigate the overall behavior of the model, and SHAP strength graphs to examine the model’s prediction in specific samples were generated [14,15,16]. To implement the SHAP technique, the seasons, temperature, solar radiation, precipitation, nitrogen (N) dose (80 and 240 kg ha−1 year−1 of N), light interception (LI) (90% and 95% LI), interval between grazing (IBG), pre-grazing height (HPRE), and post-grazing height (HPOST) were used as input variables in the XGBoost model to predict the crude protein content (CP) of tamani grass pastures.

3. Results

The experiments were structured into three evaluations seeking to answer the following research questions (RQs):
  • RQ1: When disregarding the effect of the season, does the order of the variables with the greatest impact change?
  • RQ2: How does increasing nitrogen dose (N_DOSE) affect CP content?
  • RQ3: Which precipitation range has positive SHAP values in predicting the CP content of tamani grass?
  • RQ4: Does N_DOSE influence the hierarchy of importance of management and environmental variables in predicting the CP content of tamani grass leaves?
The following sections describe the experiments performed to answer the above questions. The contribution of attributes/characteristics to the estimation of CP content in tamani grass leaves (Figure 2) was classified using the SHAP technique. All input data were considered when comparing the importance of the attributes.
The attribute that has the greatest impact on the magnitude of the model output is IBG, followed by N_DOSE, the 20/21 rainy season, post-grazing height, and pre-grazing height. The variables radiation, precipitation, temperature, and LI have less influence, but still affect the model results depending on the context (Figure 2).

3.1. Answering RQ1: When the Effect of the Season Is Disregarded, Is There a Change in the Order of the Variables That Have the Greatest Impact?

In order to understand whether there is a change in the order of the variables that most impact the prediction of CP content, the variables corresponding to the seasons were excluded from the analysis. Seasons were removed because they represent a combination of climatic factors, which could obscure their individual effects. The revised ranking of variable importance after this exclusion is shown in Figure 3.
The IBG and N_DOSE remained the variables with the greatest impact on the model after excluding the season variables. However, two main changes were observed in the order of importance of the attributes (Figure 3): (i) management heights (HPOST and HPRE) came next after IBG and N_DOSE, and (ii) the order of relevance of climatic factors was modified, with solar radiation having the greatest impact, followed by precipitation, and finally temperature.
In response to RQ1, it can be stated that there is a change in the order of importance of the variables, with the individual contribution of climatic factors being lower than that of the management variables IBG, N doses, and pre- and post-grazing heights.

3.2. Answering RQ2: How Does Increasing Nitrogen Dose (N_DOSE) Affect CP Content?

To investigate the effect of N_DOSE on CP content, a SHAP summary plot was used to examine the importance of this attribute, along with the direction and magnitude of its contribution to the model (Figure 4). In the global interpretation of the model using SHAP values, the variables with the greatest influence on predictions appear at the top of the y-axis. Each point in the figure represents an individual instance and is associated with: (i) a categorical value on the y-axis, indicating the variable it refers to; (ii) a real value on the x-axis, representing the SHAP value; and (iii) a color. SHAP values quantify the contribution of each feature to the model’s prediction, where positive values indicate that the variable contributes to increasing the predicted outcome. The color denotes the magnitude of the feature itself: pink corresponds to high values (for binary variables, 1; for continuous variables, the upper range of values), while blue corresponds to low values.
A single variable may be associated with multiple instances, which vary in both color and SHAP values. This variation reflects the specific influence of each value on the model output. For example, for the variable N_DOSE, several pink points show positive SHAP values, indicating that higher N doses contribute to an increase in the prediction. Conversely, blue points show negative SHAP values, suggesting that lower N doses are associated with a reduction in the model output (Figure 4).
However, this relationship is not always linear or easily interpretable. An example of this is the IBG variable, which has blue points with both positive and negative SHAP values. This indicates that low IBG values can either increase or decrease the prediction, depending on the interaction with other variables present in the model. This behavior reinforces the importance of considering the complex relationships between attributes in interpretability analysis (Figure 4).
High values of HPOST, HPRE, and RAD (shown in pink) tend to lower the model output; in other words, the higher these values, the stronger their effect in reducing the predicted CP content. Conversely, lower values of these variables (in blue) drive the model toward higher CP predictions (Figure 4). Regarding RQ2, the results indicate a clear relationship between nitrogen (N) dose and the model’s predictions: a dose of 240 kg ha−1 year−1 increases the predicted CP content, whereas a dose of 80 kg ha−1 year−1 reduces it.

3.3. Answering RQ3: Which Precipitation Range Has Positive SHAP Values in Predicting the CP Content of Tamani Grass?

To facilitate the interpretation of precipitation’s influence on the model, this variable was discretized into four classes, defined by ranges of accumulated values in millimeters (mm). The intervals were: up to 60 mm (PRECIP_60), 60–100 mm (PRECIP_60–100), 100–180 mm (PRECIP_100–180), and 180–1200 mm (PRECIP_180+). This approach (Figure 5) allowed for a clearer assessment of precipitation’s role in the model predictions.
The results show that the following:
  • When discretized precipitation is in the range of 100–180 mm (PRECIP_100–180 = 1), the SHAP value is positive, indicating that it drives the model toward higher predictions of leaf CP content;
  • When precipitation exceeds 180 mm (PRECIP_180+ = 1), the SHAP value is negative, contributing to a decrease in the model’s prediction;
  • Precipitation in the range of 60–100 mm (PRECIP_60–100 = 1) and LI have no significant impact on the model (SHAP value ≈ 0) (Figure 5).
In response to RQ3, precipitation in the range of 100–180 mm shows positive SHAP values, indicating an increase in CP prediction by the model.

3.4. In Response to RQ4: Does N_DOSE Influence the Hierarchy of Importance of Management and Environmental Variables in Predicting the Crude Protein Content of Tamani Grass Leaves?

To assess whether the order of variable importance changes with N dose, the dataset was divided according to the applied N levels. Figure 6 illustrates the impact of the variables on model output at a dose of 80 kg ha−1 year−1 of N (Figure 6a) and at a dose of 240 kg ha−1 year−1 of N (Figure 6b).
The order of variable importance shifts between the two N doses (Figure 6). At 80 kg N ha−1 year−1, precipitation is the most influential factor, followed by HPOST and HPRE (Figure 6a). Among precipitation classes, only 100–180 mm, >180 mm, and LI showed distinct effects. Precipitation in the 100–180 mm class (PRECIP_100–180 = 1; pink) and precipitation outside the >180 mm class (PRECIP_180+ = 0; blue) both exert a positive influence. For LI, management at 90% (blue) has a positive impact on the model, whereas management at 95% (pink) has a negative impact (Figure 6a).
At 240 kg N ha−1 year−1, the hierarchy of importance changes: management variables (HPOST, followed by HPRE) appear at the top, while climatic variables have a lower impact (Figure 6b). In response to P.P. 5, the order of importance of the variables changes according to the N dose. In pastures that received 240 kg ha−1 year−1 of N, management heights have a greater influence. In pastures that received 80 kg ha−1 year−1 of N, precipitation has the greatest influence on the CP content of tamani grass leaves.
Interactions between variables using SHAP
The questions presented above allowed us to identify the main factors influencing the XGBoost model’s prediction of CP content in tamani grass leaves. However, in addition to the importance of each variable, the explanations generated by SHAP also make it possible to explore interactions between climate and management variables, offering additional insights into the behavior of the model.
In this section, we analyze how these interactions affect predictions, identify scenarios in which variables expected to be influential have a reduced impact, and highlight specific contributions at the local level using interpretability tools such as SHAP force plots.
Figure 7, Figure 8, Figure 9, Figure 10 and Figure 11 show force plots illustrating local interpretability for five representative samples. SHAP values represent different forces that drive the increase or decrease in model predictions [14]. Each prediction starts from a base value, corresponding to the average of all outputs for each CP value in the dataset, considering the absence of information about the input attributes [13]. In the present study, the CP content has a base value probability = 12.5% (Figure 7, Figure 8, Figure 9, Figure 10 and Figure 11). The variables that contributed to increasing the prediction are represented in red, while those that contributed to decreasing the output value appear in blue.
When the dose used was 80 kg ha−1 year−1 of N and a RAD value of 1.761 drove the model to reduce the CP prediction from 14.5% to 13.57% (Figure 7). Conversely, when IBG was 26 days, HPOST was 15.5 cm, precipitation was in the 100–180 mm class, and HPRE was 29.3 cm, the model increased the prediction, resulting in a CP content of 13.57% for tamani grass leaves (Figure 7).
The RAD variable, with a value of 1.421, directed the model to decrease the prediction of CP content in tamani grass leaves (Figure 8). The other variables, however, contributed to an increase in the CP prediction. Starting from a base value of 12.5% CP, the combination of precipitation in the range of 100–180 mm, a temperature of 27.22 °C, HPRE of 28.4 cm, HPOST of 13.45 cm, a nitrogen dose of 240 kg ha−1 year−1, and an IBG of 13 days raised the predicted CP content to 16.19%. (Figure 8).
The 27-day IBG and precipitation ranging from 100 to 180 mm increased the predicted CP content in tamani grass leaves (Figure 8). In contrast, a temperature of 28.7 °C, RAD of 1653, HPRE of 38.9 cm, HPOST of 19.5 cm, and a nitrogen dose of 80 kg ha−1 year−1 reduced the model prediction, resulting in a CP content of 10.73% (Figure 9).
Among the variables, only N_DOSE (240 kg ha−1 year−1) contributed to increasing the prediction of CP content in tamani grass leaves, whereas all other variables acted to decrease the prediction (Figure 10). Specifically, precipitation outside the 100–180 mm range, a temperature of 27.42 °C, and a RAD of 1147.5 led the model to predict the baseline CP content of 12.5%. Furthermore, with HPRE of 39 cm, IBG of 32 days, and HPOST of 21 cm, the model reduced the predicted CP content from 12.5% to 10.26% (Figure 10).
HPRE of 26.4 cm and HPOST of 11.65 cm, in combination with a nitrogen dose of 240 kg ha−1 year−1, increased the predicted CP content in tamani grass leaves. Conversely, a 30-day IBG, RAD of 1716, a temperature of 29.13 °C, and precipitation outside the 100–180 mm range reduced the prediction. Collectively, these factors resulted in a predicted CP content of 13.6% (Figure 11).
Relevant interactions between climatic and management variables were identified as having a significant influence on the model’s predictions. Specifically, combinations such as pre-grazing heights below 30 cm, post-grazing heights below 19 cm, precipitation between 100 and 180 mm, IBG shorter than 30 days, and nitrogen fertilization at 240 kg ha−1 year−1 contributed substantially to increasing the predicted CP content (Figure 8).
Moreover, the model revealed contrasting responses to subtle temperature variations: while 27.22 °C increased the predicted CP content (Figure 8), a temperature of 27.42 °C reduced it (Figure 10), underscoring the model’s sensitivity to specific contextual interactions. These findings, derived from the SHAP plots, provide valuable insights that can support evidence-based decision-making through an interpretable modeling approach.

4. Discussion

The pasture ecosystem is dynamic and influenced by both management and abiotic factors, such as water availability, light, nutrients, and temperature. However, it was observed that management variables are more important in the chemical composition of tamani grass leaves than environmental factors (Figure 3). Among these, IBG is particularly critical for the model, as it influences the maturity stage of the forage at the time of animal defoliation (Figure 4). During the initial weeks of regrowth, protein content and digestibility are at their highest. As regrowth progresses, however, the plant allocates more resources to structural development, leading to culm elongation, a reduction in highly digestible cellular contents, and increased fiber deposition. This structural shift slows down and reduces the efficiency of forage digestion [24], which in turn lowers intake rates and compromises animal performance [25].
The SHAP values showed contrasting behavior between the N doses evaluated, in which the dose of 80 kg ha−1 year−1 had a negative impact on the model’s prediction, while 240 kg ha−1 year−1 had a positive impact (Figure 4). This finding indicates that the higher nitrogen dose was decisive in increasing CP content. Nitrogen is a key factor limiting plant growth and, when adequately managed, enhances both forage yield and nutritional quality [26,27].
Precipitation between 100 and 180 mm increased the predicted CP content of tamani grass (Figure 5, Figure 6, Figure 7, Figure 8 and Figure 9). During the rainy season, under well-managed pastures, forage CP concentration and digestibility tend to be higher, whereas fiber and lignin contents increase during periods of low rainfall [28]. The positive effects of precipitation within this range can therefore be attributed to adequate soil water availability, which promotes vegetative growth and leaf turnover, resulting in younger and higher-quality pastures.
The overall ranking of variable importance (Figure 6) changed when the database was stratified by nitrogen dose. The use of 80 kg N ha−1 year−1 was insufficient for tamani grass, a species with high fertility requirements, for which the recommended nitrogen rates are 100–150 and 200–300 kg N ha−1 year−1 in medium- and high-input production systems, respectively [29].
In pastures receiving low nitrogen doses (Figure 6a), precipitation plays a predominant role in determining the CP content of tamani grass leaves. Under these conditions, precipitation between 100 and 180 mm increased predicted CP content, suggesting that adequate water availability favors the accumulation of nitrogen compounds. Management at 95% LI led the model to predict lower CP content (Figure 6a), likely due to the reduced tiller population density caused by limited nitrogen availability. This condition may delay the achievement of the LI target for grazing, resulting in taller canopy heights and consequent changes in forage chemical composition.
In pastures that have reached maturity or are managed improperly, CP content typically declines while fiber content increases [30]. Therefore, when there is no adequate supply of nutrients, even if the management goals are respected, if there is no precipitation, the CP content of tamani grass may be compromised.
On the other hand, when nitrogen is adequately supplied (240 kg ha−1 year−1) (Figure 6b), the management height variables HPOST and HPRE become decisive for the chemical composition of tamani grass. Under these conditions, height control must be implemented rigorously, as the canopy rapidly reaches the grazing target when water is available. These dynamics demand greater management precision to prevent plants from advancing to more mature stages, which can compromise forage quality, particularly with respect to CP content. Adequate nitrogen supply shortens the interval between grazing events in tropical pastures [31] by accelerating plant metabolism and promoting rapid regeneration of leaf tissue after defoliation [32]. Younger plants are known to have higher protein concentrations compared to more mature plants [33,34], which contributes to more efficient utilization of the forage offered to animals.
Lower pre-grazing heights (HPRE less than 30 cm) and post-grazing heights (HPOST less than 19 cm), combined with precipitation between 100 and 180 mm and a grazing interval of 26 days, increased the CP content. In contrast, a nitrogen dose of 80 kg ha−1 year−1 and radiation reduced the predicted CP content in sample 15, which was managed at 90% LI during the 21/22 rainy season (Figure 7). This result reinforces that controlling the canopy height of tamani grass enables more effective regulation of pasture structure, directly influencing its chemical composition [35]. However, in sample 58, under the same seasonal conditions and LI, but with a nitrogen dose of 240 kg ha−1 year−1 (Figure 8), the interval between grazing events was reduced to 13 days, half of that observed with 80 kg ha−1 year−1 of N (Figure 7). This contrast highlights the critical role of nitrogen fertilization in regrowth dynamics, as the higher N dose, under adequate precipitation, accelerated tamani grass growth and shortened the time required for the canopy to reach the target grazing height (Figure 8). Such conditions allow forage accumulation to be optimized within a shorter period, thereby improving grazing efficiency.
The predicted CP content of 10.73%, below the average of 12.5%, observed in sample 7 (Figure 9), resulted from conditions that limited the CP concentration in tamani grass leaves. Although precipitation in the 100–180 mm range and a 27-day grazing interval had positive effects, they were not sufficient to offset the negative influence of other variables. The data from sample 7 correspond to the onset of pasture management in the 20/21 rainy season, which, combined with a low nitrogen dose, may have reduced tiller population density. This, in turn, led to lower soil cover and reduced leaf expansion per unit area, thereby decreasing the canopy’s light interception efficiency [36]. As a compensatory strategy, the plants increased canopy height at the expense of tiller density to achieve the target LI for grazing.
The high nitrogen dose increased the CP content of tamani grass (Figure 10 and Figure 11), with predictions ranging from 10.26% to 13.60% CP. This variation can be attributed to different combinations of environmental and management factors. The highest prediction (Figure 11) suggests that, under the lowest pre-grazing height, the younger canopy favored leaf tissue renewal and a higher concentration of nitrogen compounds, resulting in greater CP content. Moreover, sample 68 (Figure 11) was managed under the 90% LI strategy during the second year of pasture management, whereas sample 63 (Figure 10) corresponded to the 95% LI strategy in the first year of pasture management. In this latter strategy, the canopy reaches 95% LI at a greater height compared to 90% LI, which explains the higher pre- and post-grazing heights and IBG observed (Figure 10). These findings are consistent with the literature, which highlights pasture height as a practical indicator of LI and an effective tool for regulating canopy structure, thereby influencing both productivity and chemical composition [37,38]. The model thus recognizes that the isolated effect of fertilization is insufficient to increase CP levels when structural conditions are unfavorable.
The effect of solar radiation in reducing predicted CP content in tamani grass leaves (Figure 7, Figure 8, Figure 9, Figure 10 and Figure 11) may be related to the increase in the photosynthetic rate induced by high radiation levels, which favors the synthesis of structural carbohydrates at the expense of nitrogenous compounds. Under high radiation intensities, accelerated grass growth can dilute CP concentration due to greater deposition of structural carbohydrates and lignin [39].
Temperature around 27 °C exhibited antagonistic effects on the model (Figure 8 and Figure 10), highlighting the complex interactions between plant and environment. For instance, under lower grazing heights (HPRE 28.4 cm and HPOST 13.45 cm), a short IBG (13 days), a nitrogen dose of 240 kg ha−1 year−1, and precipitation between 100 and 180 mm, a temperature of 27.22 °C promoted an increase in crude protein (CP) content (Figure 10). In contrast, when the temperature was 27.42 °C with the same nitrogen dose but combined with higher grazing heights (HPRE 39 cm and HPOST 21 cm), a longer IBG (32 days), and precipitation above 180 mm, an imbalance among growth factors occurred, resulting in reduced CP (Figure 10).
These results indicate that the combination of appropriate management targets can control plant growth responses to abiotic conditions, allowing the cultivar to express its potential and influencing pasture structure, which ultimately affects animal performance [28]. The SHAP analysis further revealed that even small changes in environmental variables, such as temperature, can lead to contrasting effects on predicted CP, demonstrating that tamani grass responses are highly non-linear and context-dependent. For agronomic practice, this suggests that minor variations in temperature, precipitation, or nitrogen application can significantly impact forage quality, and management decisions should account for these interactions.
The SHAP technique is a powerful tool for interpreting machine learning models, providing consistent and quantitative explanations of each variable’s individual contribution to model predictions. In the context of pasture management, SHAP translates complex model outputs into agronomically relevant information, facilitating the identification of key factors such as nitrogen rates and precipitation patterns. This approach has the potential to transform the use of predictive models in field decision-making by offering transparency and interpretability without compromising predictive performance. However, additional studies with larger datasets and across diverse environments and cultivars are needed to strengthen the generalizability of SHAP-based interpretations. Future research should broaden the dataset to include different ecosystems and environmental conditions, while the integration of more diverse data sources could further enhance model performance.
The reported R2 of 0.57 indicates a moderate predictive capacity. While this level of fitness is sufficient to capture general trends in crude protein content and provide guidance for pasture management decisions, it may not fully account for all sources of variability in the field. Consequently, these predictions should be used as a support tool rather than a definitive guide. Further improvements in model precision could be achieved by increasing the dataset size and enhancing the reliability of predictions for more fine-tuned management strategies.

5. Conclusions

SHAP analysis indicates that precipitation between 100 and 180 mm increases the crude protein (CP) content of Tamani grass leaves. Nitrogen fertilization of 240 kg N ha−1 year−1 positively affects predicted CP, mitigating the influence of environmental conditions, particularly precipitation, whereas a lower dose of 80 kg N ha−1 year−1 reduces CP and makes it more sensitive to environmental factors.
Under the evaluated conditions, combining 240 kg N ha−1 year−1 with adequate precipitation and maintenance of recommended grazing heights can optimize leaf CP content. These findings provide practical guidance for producers and extension specialists, offering support for fertilization and grazing management decisions to improve forage quality.
Future work
Future research should expand the dataset to improve model robustness and enhance predictive performance and generalization. Validation across different ecosystems is also required to test model transferability and broaden applicability to diverse production systems.

Author Contributions

Conceptualization, G.O.d.A.M., G.d.S.D., D.B.M. and V.P.B.E.; methodology, G.O.d.A.M., J.G.R., M.d.G.P. and J.A.C.; software, G.O.d.A.M., J.A.C., E.T.M. and A.B.d.C.; validation, G.O.d.A.M., J.A.C., A.B.d.C. and E.T.M.; formal analysis, G.O.d.A.M.; investigation, G.O.d.A.M.; resources, G.d.S.D., D.B.M., V.P.B.E., A.B.d.C. and E.T.M.; data curation, G.O.d.A.M.; writing—original draft preparation, G.O.d.A.M.; writing—review and editing, G.d.S.D., D.B.M., V.P.B.E., M.C., J.G.R., L.C.V.Í., A.B.d.C. and E.T.M.; visualization, G.O.d.A.M.; supervision, G.d.S.D. and E.T.M.; project administration, G.d.S.D. and E.T.M.; funding acquisition, V.P.B.E. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

The original contributions presented in this study are included in the article. Further inquiries can be directed to the corresponding author(s).

Acknowledgments

The authors thank the Embrapa Beef Cattle, Federal University of Mato Grosso do Sul Foundation, through the Postgraduate Program in Animal Science, the National Council for Scientific and Technological Development (CNPq), the Higher Education Personnel Improvement Coordination (CAPES, Finance Code 001), and the Foundation for the Support of the Development of Education, Science and Technology of the State of Mato Grosso do Sul (FUNDECT).

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Wani, S.; Kanth, R.H.; Tantry, R.A. Intensification of Forage Production and Quality Parameters: A Review. Asian J. Agric. Ext. Econ. Soc 2022, 40, 513–552. [Google Scholar] [CrossRef]
  2. Silva, R.O.; Miotto, F.R.C.; Neiva, J.N.M.; Silva, L.F.F.M.; Freitas, I.B.; Araújo, V.L.; Restle, J. Efeitos do aumento dos níveis de nitrogênio no capim Mombaça em pastagem características, composição química e desempenho da pecuária de corte nos trópicos úmidos da Amazônia. Trop. Anim. Health Prod. 2020, 52, 3293–3300. [Google Scholar] [CrossRef]
  3. Manyika, J.; Chui, M.; Miremadi, M.; Bughin, J.; George, K.; Willmott, P.; Dewhurst, M. A Future That Works: Automation, Employment, and Productivity; McKinsey Global Institute: Beijing, China, 2017; Available online: https://www.mckinsey.com/global-themes/digital-disruption/harnessing-automation-for-a-future-that-works (accessed on 15 April 2025).
  4. Röös, E.; Bajželj, B.; Smith, P.; Patel, M.; Little, D.; Garnett, T. Greedy or needy? Land use and climate impacts of food in 2050 under different livestock futures. Glob. Environ. Change 2017, 47, 1–12. [Google Scholar] [CrossRef]
  5. Wolfert, S.; Ge, L.; Verdouw, C.; Bogaardt, M.J. Big data in smart farming—A review. Agric. Syst. 2017, 153, 69–80. [Google Scholar] [CrossRef]
  6. Bretas, I.L.; Valente, D.S.M.; De Oliveira, T.F.; Montagner, D.B.; Euclides, V.P.B.; Chizzotti, F.H.M. Canopy height and biomass prediction in Mombaça guinea grass pastures using satellite imagery and machine learning. Precis. Agric. 2023, 24, 1638–1662. [Google Scholar] [CrossRef]
  7. Bretas, I.L.; Valente, D.S.; Silva, F.F.; Chizzotti, M.L.; Paulino, M.F.; D’áUrea, A.P.; Paciullo, D.S.; Pedreira, B.C.; Chizzotti, F.H. Prediction of aboveground biomass and dry—Matter content in Brachiaria pastures by combining meteorological data and satellite imagery. Grass Forage Sci. 2021, 76, 340–352. [Google Scholar] [CrossRef]
  8. Dos Reis, A.A.; Werner, J.P.S.; Silva, B.C.; Figueiredo, G.K.D.A.; Antunes, J.F.G.; Esquerdo, J.C.D.M.; Coutinho, A.C.; Lamparelli, R.A.C.; Rocha, J.V.; Magalhães, P.S.G. Monitoring pasture aboveground biomass and canopy height in an integrated crop–livestock system using textural information from PlanetScope imagery. Remote Sens. 2020, 12, 2534. [Google Scholar] [CrossRef]
  9. Defalque, G.; Santos, R.; Bungenstab, D.; Echeverria, D.; Dias, A.; Defalque, C. Machine learning models for dry matter and biomass estimates on cattle grazing systems. Comput. Electron. 2024, 216, 108520. [Google Scholar] [CrossRef]
  10. Wang, C.; Han, Q.; Li, J.; Li, C.; Zou, X. YOLO-BLBE: A novel model for identifying blueberry fruits with different maturities using the I-MSRCR method. Agronomy 2024, 14, 658. [Google Scholar] [CrossRef]
  11. Stumpe, C.; Leukel, J.; Zimpel, T. Prediction of pasture yield using machine learning-based optical sensing: A systematic review. Precis. Agric. 2024, 25, 430–459. [Google Scholar] [CrossRef]
  12. Lubo-Robles, D.; Devegowda, D.; Jayaram, V.; Bedle, H.; Marfurt, K.J.; Pranter, M.J. Machine learning model interpretability using SHAP values: Application to a seismic facies classification task. In SEG International Exposition and Annual Meeting; SEG: Houston, TX, USA, 2020; p. D021S008R006. [Google Scholar] [CrossRef]
  13. Lundberg, S.M.; Lee, S.I. A unified approach to interpreting model predictions. Adv. Neural Inf. Process. Syst. 2017, 30. Available online: https://proceedings.neurips.cc/paper/2017/hash/8a20a8621978632d76c43dfd28b67767-Abstract.html (accessed on 15 April 2025).
  14. Molnar, C. Interpretable Machine Learning: A Guide for Making Black Box Models Explainable. 2020. Available online: https://christophm.github.io/interpretable-ml-book (accessed on 12 April 2025).
  15. Lundberg, S.M.; Erion, G.G.; Lee, S. Consistent individualized feature attribution for tree ensembles. arXiv 2018, arXiv:1802.03888. [Google Scholar] [CrossRef]
  16. Lundberg, S.M.; Erion, G.; Chen, H.; DeGrave, A.; Prutkin, J.M.; Nair, B.; Katz, R.; Himmelfarb, J.; Bansal, N.; Lee, S.-I. From local explanations to global understanding with explainable AI for trees. Nat. Mach. Intell. 2020, 2, 56–67. [Google Scholar] [CrossRef]
  17. Wang, Y.; Yu, R.; Li, X.; Chen, R.; Liu, J. Grazing regime rather than grazing intensity affect the foraging behavior of cattle. Ecol. Inform. 2025, 85, 102996. [Google Scholar] [CrossRef]
  18. Li, D.; Yan, G.; Li, F.; Lin, H.; Jiao, H.; Han, H.; Liu, W. Optimized Machine Learning Models for Predicting Core Body Temperature in Dairy Cows: Enhancing Accuracy and Interpretability for Practical Livestock Management. Animals 2024, 14, 2724. [Google Scholar] [CrossRef] [PubMed]
  19. Klingler, A.; Dujakovic, A.; Vuolo, F.; Mayer, K.; Gaier, L.; Pötsch, E.M.; Schaumberger, A. Prediction of grassland yield in Austria: A machine learning approach based on satellite, weather, and extensive in situ data. Eur. J. Agron. 2025, 170, 127701. [Google Scholar] [CrossRef]
  20. Zhao, Y.; Xu, D.; Li, S.; Tang, K.; Yu, H.; Yan, R.; Li, Z.; Wang, X.; Xin, X. Comparative Analysis of Feature Importance Algorithms for Grassland Aboveground Biomass and Nutrient Prediction Using Hyperspectral Data. Agriculture 2024, 14, 389. [Google Scholar] [CrossRef]
  21. Chen, T.; Guestrin, C. XGBoost: A scalable tree boosting system. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, San Francisco, CA, USA, 13–17 August 2016; pp. 785–794. [Google Scholar] [CrossRef]
  22. Allen, V.G.; Batello, C.; Berretta, E.J.; Hodgson, J.; Kothmann, M.; Li, X.; McIvor, J.; Milne, J.; Morris, C.; Peeters, A.; et al. An international terminology for grazing lands and grazing animals. Grass Forage Sci. 2011, 66, 2–28. [Google Scholar] [CrossRef]
  23. Marten, G.C.; Shenk, J.S.; Barton, F.E. Near Infrared Reflectance Spectroscopy (NIRS): Analysis of Forage Quality; United States Department of Agriculture, Agricultural Research Service: Beltsville, MD, USA, 1985; p. 643. [Google Scholar]
  24. Tesk, C.R.M.; Pedreira, B.C.; Pereira, D.H.; Pina, D.D.S.; Ramos, T.A.; Mombach, M.A. Impact of grazing management on forage qualitative characteristics: A review. Sci. Electron. Arch. 2018, 11, 188–197. [Google Scholar] [CrossRef]
  25. Benvenutti, M.A.; Gordon, I.J.; Poppi, D.P.; Crowther, R.; Spinks, W. Foraging mechanics and their outcomes for cattle grazing reproductive tropical swards. Appl. Anim. Behav. Sci. 2008, 113, 15–31. [Google Scholar] [CrossRef]
  26. Delevatti, L.M.; Romanzini, P.; Fabiano, J.; Koscheck, W.; Luis Da Ross De Araujo, T.; Renesto, D.M.; Ferrari, A.C.; Pavezzi Barbero, R.; Mulliniks, J.T.; Reis, R.A. Forage management intensification and supplementation strategy: Intake and metabolic parameters on beef cattle production. Anim. Feed Sci. Technol. 2019, 247, 74–82. [Google Scholar] [CrossRef]
  27. Euclides, V.P.B.; Montagner, D.B.; de Araújo, A.R.; de Aragão Pereira, M.; dos Santos Difante, G.; de Araújo, I.M.M.; Barbosa, L.F.; Barbosa, R.A.; Gurgel, A.L.C. Biological and economic responses to increasing nitrogen rates in Mombaça guinea grass pastures. Sci. Rep. 2022, 12, 1–14. [Google Scholar] [CrossRef]
  28. Hughes, M.; Mlambo, V.; Jennings, P.G.A.; Lallo, C.H.O. The accuracy of predicting in vitro ruminal organic matter digestibility from chemical components of tropical pastures varies with season and harvesting method. Trop. Agric. 2014, 91. Available online: https://journals.sta.uwi.edu/ojs/index.php/ta/article/view/927 (accessed on 15 April 2025).
  29. Pereira, L.E.T.; Nishida, N.T.; Carvalho, L.D.R.; Herling, V.R. Recomendações Para Correção e Adubação de Pastagens Tropicais; Faculdade de Zootecnia e Engenharia de Alimentos da USP: Pirassununga, Brazil, 2018; 56p. [Google Scholar] [CrossRef]
  30. Pedreira, B.C.; Pereira, L.E.T.; Paiva, A.J. Eficiência produtiva e econômica na utilização de pastagens adubadas. Simpósio Matogrossense Bov. Corte 2013, 2, 2013–2017. [Google Scholar]
  31. Cunha, A.M.Q.; Macedo, V.H.M.; de Oliveira, J.K.S.; Melo, D.d.M.; Domingues, F.N.; Cândido, E.P.; Faturi, C.; Rêgo, A.C.D. Nitrogen fertilisation as a strategy for intensifying production and improving the quality of Massai grass grown in a humid tropical climate. J. Plant Nutr. 2022, 45, 2213–2227. [Google Scholar] [CrossRef]
  32. Sousa, C.C.C.; Montagner, D.B.; Araujo, A.R.; Euclides, V.P.B.; Difante, G.S.; Gurgel, A.L.C.; Souza, D.L. The soil-plant interface in Megathyrsus maximus cv. Mombasa subjected to different doses of nitrogen in rotational grazing. Rev. Mex. Ciências Pecuárias 2021, 12, 1098–1116. [Google Scholar] [CrossRef]
  33. Lima, M.A.; Paciullo, D.S.C.; Silva, F.F.; Morenz, M.J.F.; Gomide, C.A.M.; Rodrigues, R.A.R.; Bretas, I.L.; Chizzotti, F.H.M. Evaluation of a long-established silvopastoral Brachiaria decumbens system: Plant characteristics and feeding value for cattle. Crop Pasture Sci. 2019, 70, 814–825. [Google Scholar] [CrossRef]
  34. van Cleef, F.O.S.; van Cleef, E.H.C.B.; Longhini, V.Z.; Nascimento, T.S.; Ezequiel, J.M.B.; Ruggieri, A.C. Feedlot performance, carcass characteristics, and meat characteristics of lambs grown under silvopastoral systems. Can. J. Anim. Sci. 2019, 100, 385–388. [Google Scholar] [CrossRef]
  35. Hodgson, J. Grazing Management: Science into Practice; Logman Group UK Ltd.: Harlow, UK, 1990; p. 203. [Google Scholar]
  36. Sbrissia, A.F.; da Silva, S.C.; Nascimento Júnior, D. Ecofisiologia de plantas forrageiras e o manejo do pastejo. Simpósio Sobre Manejo Pastagem 2007, 24, 1–27. [Google Scholar]
  37. Carnevalli, R.A.; Da Silva, S.C.; Bueno, A.D.O.; Uebele, M.C.; Bueno, F.O.; Hodgson, J.; Silva, G.N.; Morais, J.P.G. Herbage production and grazing losses in Panicum maximum cv. Mombaça under four grazing managements. Trop. Grassl. 2006, 40, 165. [Google Scholar]
  38. Pedreira, B.C.; Pedreira, C.G.S.; Silva, S.C.D. Acúmulo de forragem durante a rebrotação de capim-xaraés submetido a três estratégias de desfolhação. Rev. Bras. Zootec. 2009, 38, 618–625. [Google Scholar] [CrossRef]
  39. Van Soest, P.J. Nutritional Ecology of the Ruminant, 2nd ed.; Cornell University 1250 Press: New York, NY, USA, 1994. [Google Scholar]
Figure 1. Experimental area of tamani grass pastures outlined in red.
Figure 1. Experimental area of tamani grass pastures outlined in red.
Agronomy 15 02780 g001
Figure 2. Global interpretation of the XGBoost model using SHAP values for the CP prediction task: SHAP global feature importance graph. IBG: interval between grazing, N_DOSE: nitrogen dose, HPRE: pre-grazing height, HPOST: post-grazing height, TEMP: temperature, RAD: solar radiation, LI: light interception.
Figure 2. Global interpretation of the XGBoost model using SHAP values for the CP prediction task: SHAP global feature importance graph. IBG: interval between grazing, N_DOSE: nitrogen dose, HPRE: pre-grazing height, HPOST: post-grazing height, TEMP: temperature, RAD: solar radiation, LI: light interception.
Agronomy 15 02780 g002
Figure 3. Global interpretation of the XGBoost model using SHAP values for the CP prediction task: SHAP global feature importance graph disregarding the seasons. IBG: interval between grazing; N_DOSE: nitrogen dose; HPRE: pre-grazing height; HPOST: post-grazing height; TEMP: temperature; RAD: solar radiation; LI: light interception.
Figure 3. Global interpretation of the XGBoost model using SHAP values for the CP prediction task: SHAP global feature importance graph disregarding the seasons. IBG: interval between grazing; N_DOSE: nitrogen dose; HPRE: pre-grazing height; HPOST: post-grazing height; TEMP: temperature; RAD: solar radiation; LI: light interception.
Agronomy 15 02780 g003
Figure 4. Global interpretation of the XGBoost model using SHAP values for crude protein (CP) prediction: SHAP summary plot. Variables with the greatest influence on the predictions appear at the top of the y-axis. SHAP values on the x-axis indicate the direction and magnitude of their contribution, while color represents the feature value (pink = high, blue = low).
Figure 4. Global interpretation of the XGBoost model using SHAP values for crude protein (CP) prediction: SHAP summary plot. Variables with the greatest influence on the predictions appear at the top of the y-axis. SHAP values on the x-axis indicate the direction and magnitude of their contribution, while color represents the feature value (pink = high, blue = low).
Agronomy 15 02780 g004
Figure 5. Global interpretation of the XGBoost model using SHAP values for crude protein (CP) prediction: SHAP summary plot with discretized precipitation. The variable Precipitation was divided into four classes: PRECIP_60, PRECIP_60–100, PRECIP_100–180, and PRECIP_180+. SHAP values on the x-axis indicate the direction and magnitude of their contribution, and color denotes feature value (pink = high; blue = low).
Figure 5. Global interpretation of the XGBoost model using SHAP values for crude protein (CP) prediction: SHAP summary plot with discretized precipitation. The variable Precipitation was divided into four classes: PRECIP_60, PRECIP_60–100, PRECIP_100–180, and PRECIP_180+. SHAP values on the x-axis indicate the direction and magnitude of their contribution, and color denotes feature value (pink = high; blue = low).
Agronomy 15 02780 g005
Figure 6. SHAP summary plot for CP prediction, divided into two datasets: (a) 80 kg ha−1 year−1 of N and (b) 240 kg ha−1 year−1 of N.
Figure 6. SHAP summary plot for CP prediction, divided into two datasets: (a) 80 kg ha−1 year−1 of N and (b) 240 kg ha−1 year−1 of N.
Agronomy 15 02780 g006
Figure 7. SHAP force plot illustrating the contribution of individual features to the predicted CP value for sample 15. Features pushing the prediction higher are shown in red, while those pushing it lower are in blue.
Figure 7. SHAP force plot illustrating the contribution of individual features to the predicted CP value for sample 15. Features pushing the prediction higher are shown in red, while those pushing it lower are in blue.
Agronomy 15 02780 g007
Figure 8. SHAP force plot illustrating the contribution of individual features to the predicted CP value for sample 58. Features pushing the prediction higher are shown in red, while those pushing it lower are in blue.
Figure 8. SHAP force plot illustrating the contribution of individual features to the predicted CP value for sample 58. Features pushing the prediction higher are shown in red, while those pushing it lower are in blue.
Agronomy 15 02780 g008
Figure 9. SHAP force plot illustrating the contribution of individual features to the predicted CP value for sample 9. Features pushing the prediction higher are shown in red, while those pushing it lower are in blue.
Figure 9. SHAP force plot illustrating the contribution of individual features to the predicted CP value for sample 9. Features pushing the prediction higher are shown in red, while those pushing it lower are in blue.
Agronomy 15 02780 g009
Figure 10. SHAP force plot illustrating the contribution of individual features to the predicted CP value for sample 63. Features pushing the prediction higher are shown in red, while those pushing it lower are in blue.
Figure 10. SHAP force plot illustrating the contribution of individual features to the predicted CP value for sample 63. Features pushing the prediction higher are shown in red, while those pushing it lower are in blue.
Agronomy 15 02780 g010
Figure 11. SHAP force plot illustrating the contribution of individual features to the predicted CP value for sample 68. Features pushing the prediction higher are shown in red, while those pushing it lower are in blue.
Figure 11. SHAP force plot illustrating the contribution of individual features to the predicted CP value for sample 68. Features pushing the prediction higher are shown in red, while those pushing it lower are in blue.
Agronomy 15 02780 g011
Table 1. Description of the variables that make up the dataset. There are 14 variables in total, 5 of which are categorical and 9 are numerical. The independent variable is crude protein (CP).
Table 1. Description of the variables that make up the dataset. There are 14 variables in total, 5 of which are categorical and 9 are numerical. The independent variable is crude protein (CP).
Variable (Symbol)MeaningUnitRange
20/21 Rainyseasonbinary var. (1/0)[0; 1]
21 Rainy-Dryseasonbinary var. (1/0)[0; 1]
21 Dry-Rainyseasonbinary var. (1/0)[0; 1]
21/22 Rainyseasonbinary var. (1/0)[0; 1]
22 Rainy-Dryseasonbinary var. (1/0)[0; 1]
TEMPaverage temperaturedegrees °C[22.72; 30.35]
RADsolar radiationKJ/m2[673.79; 2184.90]
PRECprecipitationmm[0; 1136.4]
PRECIP.100–180discretized precipitation mm[100; 180]
PRECIP.180+discretized precipitation mm[180; 1136.4]
PRECIP.60–90discretized precipitation mm[60; 90]
N DOSEnitrogen dosekg ha−1 year−1[80; 240]
LIlight interception%[90; 95]
IBGinterval between grazingdays[12; 69]
HPREpre-grazing heightcm[24.5; 51]
HPOSTpost-grazing heightcm[11; 26]
CPcrude protein% of DM[6.6; 18.51]
DM: dry matter.
Table 2. Hyperparameters and intervals on the XGBoost model.
Table 2. Hyperparameters and intervals on the XGBoost model.
ModelHyperparametersInterval
XGBoostColsample bytree: 0.6, learning rate: 0.1, max depth: 2, n estimators: 200, reg alpha: 0.6, reg
lambda: 2, subsample: 0.6
Colsample bytree: [0.6, 0.8, 1.0], learning rate: [0.001, 0.01,0.1], max depth: np.arange(2, 8, 2), n estimators: [200, 600,1000], reg alpha: [0, 0.2, 0.6], reg lambda’: [1, 1.5, 2]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Monteiro, G.O.d.A.; Difante, G.d.S.; Montagner, D.B.; Euclides, V.P.B.; Castro, M.; Rodrigues, J.G.; Pereira, M.d.G.; Ítavo, L.C.V.; Campos, J.A.; da Costa, A.B.; et al. Interpreting Machine Learning Models with SHAP Values: Application to Crude Protein Prediction in Tamani Grass Pastures. Agronomy 2025, 15, 2780. https://doi.org/10.3390/agronomy15122780

AMA Style

Monteiro GOdA, Difante GdS, Montagner DB, Euclides VPB, Castro M, Rodrigues JG, Pereira MdG, Ítavo LCV, Campos JA, da Costa AB, et al. Interpreting Machine Learning Models with SHAP Values: Application to Crude Protein Prediction in Tamani Grass Pastures. Agronomy. 2025; 15(12):2780. https://doi.org/10.3390/agronomy15122780

Chicago/Turabian Style

Monteiro, Gabriela Oliveira de Aquino, Gelson dos Santos Difante, Denise Baptaglin Montagner, Valéria Pacheco Batista Euclides, Marina Castro, Jéssica Gomes Rodrigues, Marislayne de Gusmão Pereira, Luís Carlos Vinhas Ítavo, Jecelen Adriane Campos, Anderson Bessa da Costa, and et al. 2025. "Interpreting Machine Learning Models with SHAP Values: Application to Crude Protein Prediction in Tamani Grass Pastures" Agronomy 15, no. 12: 2780. https://doi.org/10.3390/agronomy15122780

APA Style

Monteiro, G. O. d. A., Difante, G. d. S., Montagner, D. B., Euclides, V. P. B., Castro, M., Rodrigues, J. G., Pereira, M. d. G., Ítavo, L. C. V., Campos, J. A., da Costa, A. B., & Matsubara, E. T. (2025). Interpreting Machine Learning Models with SHAP Values: Application to Crude Protein Prediction in Tamani Grass Pastures. Agronomy, 15(12), 2780. https://doi.org/10.3390/agronomy15122780

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop