Pig growth performance and environment excrement collaborative prediction method and system
By deeply integrating Bayesian mechanistic models and machine learning models, a collaborative prediction method for pig growth performance and environmental excrement is constructed, which solves the problems of insufficient prediction accuracy and interpretability in existing technologies and achieves high-precision and highly interpretable prediction results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANDONG AGRICULTURAL UNIVERSITY
- Filing Date
- 2026-02-04
- Publication Date
- 2026-05-12
AI Technical Summary
Existing technologies struggle to achieve high-precision and highly interpretable predictions of pig growth performance and environmental excrement within a unified dynamic framework. Mechanistic models and machine learning models operate independently and cannot effectively collaborate, resulting in large prediction biases and poor interpretability.
A collaborative prediction method for pig growth performance and environmental excrement was developed. Preliminary prediction results were generated through a Bayesian mechanistic model, and a machine learning model was constructed using the residuals to make corrections. Finally, a collaborative prediction report was output, achieving a deep integration of the mechanistic model and the machine learning model.
It significantly improves the accuracy and interpretability of pig growth performance and environmental excrement prediction, provides accurate and reliable decision support, and overcomes the prediction bias and insufficient interpretability of existing models.
Smart Images

Figure CN122020174A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of smart agriculture and artificial intelligence technology, and in particular relates to a method and system for the collaborative prediction of pig growth performance and environmental excrement. Background Technology
[0002] In modern intensive pig farming, precision feeding is a core element in improving production efficiency, reducing feed costs, and minimizing environmental pollution. The key lies in dynamically and accurately predicting the future growth performance (such as daily weight gain and feed efficiency) of pigs under specific diets, genetic backgrounds, and farming environments, as well as the closely related key environmental excretions such as nitrogen and phosphorus.
[0003] Currently, mainstream predictive models can be broadly categorized into two types based on their construction principles. The first type is mechanistic models, such as classic models like NRC and InraPorc. These models are based on the "first principles" of animal physiology, biochemistry, and nutrition, describing the metabolic pathways of nutrients through mathematical equations. Their clear structure, often referred to as a "white box" or "glass box," provides excellent interpretability and helps nutritionists understand the underlying regulatory mechanisms. However, these models have inherent technical limitations: the core physiological metabolic parameters (such as maintenance requirements and deposition efficiency coefficients) are typically set to fixed values or simple functions. This "parameter rigidity" makes it difficult for the models to adapt to dynamic changes caused by different genetic strains, health conditions, and complex environmental stresses, resulting in systematic predictive biases. Their predictive accuracy is insufficient to meet the demands of commercial precision breeding for refined management at the individual or small-group level.
[0004] To compensate for the insufficient accuracy of mechanistic models, a second type of data-driven machine learning model, such as gradient boosting decision trees and neural networks, has been applied in this field. These models can learn complex nonlinear relationships between inputs and outputs from massive amounts of historical production data, typically achieving higher prediction accuracy on specific datasets. However, pure machine learning models suffer from a fatal "black box" characteristic: their decision-making process is highly complex and opaque, unable to provide explanations consistent with biological logic, making it difficult for production managers to trust their predictions, and making it impossible to trace the biological roots of prediction deviations. Furthermore, their effectiveness is highly dependent on the quantity and quality of training data; for new situations not covered by data (such as novel feed ingredients), their generalization ability and reliability face significant risks.
[0005] To combine the advantages of both, attempts have been made to construct hybrid models in existing technologies. However, most existing hybrid models adopt a 'parallel' structure (i.e., training the mechanistic model and the machine learning model separately, and then weighting the results) or a simple 'serial' structure (using only the final output value of the mechanistic model as a feature of the machine learning model). These methods fail to uncover the 'process variables' within the mechanistic model. In fact, latent state variables such as 'phosphorus balance state' and 'restrictive amino acid types' calculated within the mechanistic model contain extremely valuable biological diagnostic information. Existing technologies have failed to establish a 'latent state transmission channel' from the mechanistic model to the input of the machine learning model, causing the machine learning model to still blindly fit the data and fail to truly understand the biological reasons behind growth deviations.
[0006] Therefore, there is an urgent need in this field for a new technical solution that can collaboratively achieve high-precision and highly interpretable prediction of growth performance and environmental excrement within a unified dynamic framework. Summary of the Invention
[0007] This invention proposes a method and system for the synergistic prediction of pig growth performance and environmental excrement, in order to solve the problems existing in the prior art.
[0008] To achieve the above objectives, the present invention provides a method for synergistic prediction of pig growth performance and environmental excrement, comprising: Acquire multi-source data on live pigs and preprocess the multi-source data to obtain standardized input data; Based on the standardized input data, a first-level Bayesian mechanism model is constructed to generate preliminary prediction results; Based on the difference between the preliminary prediction results and the actual observed values, the residuals are obtained; Based on the residuals, a second-level machine learning residual correction model is constructed to generate residual prediction values; Based on the preliminary prediction results and the residual prediction values, the final prediction results are obtained; Based on the final prediction results, a synergistic prediction report on growth performance and environmental excrement is output.
[0009] Optionally, obtaining standardized input data includes: Based on animal performance data and nutritional intake data, obtain the core dataset; Based on the feed ingredient composition data, obtain the formula dataset; Based on the core dataset and the formula dataset, data integration is performed to obtain the standardized input data.
[0010] Optionally, obtaining the core dataset includes: Based on initial weight, number of test days, and daily weight gain data, obtain a subset of performance data; Based on the intake data of crude protein, net energy, amino acids, total phosphorus, digestible phosphorus, and calcium, a nutrient subset is obtained; The core dataset is constructed based on the performance subset and the nutrient subset.
[0011] Optionally, generating preliminary prediction results includes: Based on the standardized input data, the prior distribution of the model parameters is set; Based on the prior distribution, the model parameters are inferred using the Markov chain Monte Carlo sampling algorithm, and the intermediate metabolic variables of the nutrient metabolic pathway are calculated. Based on the aforementioned intermediate metabolic variables, protein deposition, lipid deposition, nitrogen excretion, and phosphorus excretion are calculated to generate the preliminary prediction results.
[0012] Optionally, obtaining intermediate metabolic variables includes: A genetic maximum protein deposition potential curve was constructed, and the decline trend of protein deposition capacity in the later stage of pig growth was simulated using a double logistic difference function. The potential protein deposition amounts restricted by different amino acids are calculated, and a differentiable smooth minimum function is applied to weight and integrate the genetic potential and the amino acid restriction potential to obtain the effective protein deposition potential. The phosphorus growth requirement is decomposed into soft tissue phosphorus requirement related to protein deposition and bone phosphorus requirement related to ash deposition. The total phosphorus growth requirement is obtained by calculating the phosphorus requirement independently based on the amount of protein deposition and the amount of ash deposition, and then summing them.
[0013] Optionally, obtaining the residual includes: Calculate the residual value based on the actual daily weight gain data and the daily weight gain in the preliminary prediction results; Based on the residual values, a residual dataset is constructed for training the second-level model.
[0014] Optionally, generating the residual prediction values includes: Based on the residuals, a feature set is constructed; Based on the feature set, a gradient boosting decision tree model is trained to obtain the residual prediction value.
[0015] Optionally, the construction of the feature set includes: Based on the functional classification of feed ingredients, obtain the polymerization characteristics of the ingredients; Based on the ratio of nutrients, obtain the characteristics of nutrient interactions; Based on the intermediate metabolic variables in the preliminary prediction results, the mechanism linkage characteristics are obtained, including: Digestible phosphorus balance is used to characterize the nonlinear effect of the deviation of phosphorus supply from biological requirements on growth performance. Net energy share of production is used to characterize the competitive pressure on energy allocation for maintenance needs; The limiting factor index is used to transmit the specific nutrient category that is currently limiting growth to the second-level model, helping the model to identify growth bottlenecks; The feature set is constructed based on the raw material polymerization characteristics, the nutrient interaction characteristics, and the mechanism linkage characteristics.
[0016] Optionally, obtaining the final prediction result includes: The final daily weight gain is calculated based on the daily weight gain in the preliminary prediction results and the residual prediction value. Based on the principle of mass balance, calculate the total nitrogen excretion and the total phosphorus excretion separately: Total nitrogen excretion = Total nitrogen intake – Nitrogen deposition predicted by the model; Total phosphorus excretion = Total phosphorus intake – Phosphorus deposition predicted by the model; Phosphorus excretion is further categorized according to its excretion pathway: Fecal phosphorus excretion = Total phosphorus intake – Standard ileal digestible phosphorus intake; Urinary phosphorus excretion = Standard ileal digestible phosphorus intake – Model-predicted phosphorus deposition; The final prediction result is constructed based on the final daily weight gain and the nitrogen and phosphorus excretion in the preliminary prediction results.
[0017] The present invention also provides a synergistic prediction system for pig growth performance and environmental excrement, for performing the method described herein.
[0018] Compared with the prior art, the present invention has the following advantages and technical effects: This invention significantly improves the accuracy and interpretability of predicting swine growth performance and environmental excretion through a structured and deep fusion of mechanistic and machine learning models. The method utilizes a Bayesian mechanistic model to construct a biologically meaningful predictive framework, systematically corrects its inherent biases using a machine learning model, and quantifies the key factors influencing the prediction results using interpretability analysis tools. Within a unified framework, it achieves dynamic and synergistic prediction of growth performance and nitrogen and phosphorus excretion, overcoming the technical limitations of existing models such as large prediction bias, poor interpretability, and a disconnect between growth and environmental impact predictions. This provides accurate and reliable decision support for precision feeding and formula optimization. Attached Figure Description
[0019] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings: Figure 1 This is a flowchart illustrating the overall architecture of the method according to an embodiment of the present invention; Figure 2 This is a schematic diagram of the internal logic of the Bayesian mechanism model in an embodiment of the present invention; Figure 3 This is a schematic diagram of the "mechanism-machine learning" information feedback loop in an embodiment of the present invention; Figure 4 This is an example diagram showing the SHAP interpretability analysis results of an embodiment of the present invention. Detailed Implementation
[0020] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0021] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0022] Example 1 like Figure 1 As shown, this embodiment provides a method for synergistic prediction of pig growth performance and environmental excrement, including: Acquire multi-source data on live pigs and preprocess the multi-source data to obtain standardized input data; Based on standardized input data, a first-level Bayesian mechanism model is constructed to generate preliminary prediction results; Based on the difference between the preliminary prediction results and the actual observed values, the residuals are obtained; Based on the residuals, a second-level machine learning residual correction model is constructed to generate residual prediction values; Based on the preliminary prediction results and the residual prediction values, the final prediction results are obtained; Based on the final prediction results, a synergistic prediction report on growth performance and environmental excrement will be output.
[0023] Specifically, the following steps are included: Step 1: Acquisition and preprocessing of multi-source heterogeneous data; This step aims to prepare standardized input data for subsequent model building.
[0024] The standardized input data obtained includes: Based on animal performance data and nutrient intake data, a core dataset is obtained. The core dataset includes: a performance subset based on initial body weight, number of trial days, and daily weight gain data; a nutrient subset based on intake data of crude protein, net energy, amino acids, total phosphorus, digestible phosphorus, and calcium; a core dataset is constructed based on the performance subset and the nutrient subset; a formulation dataset is obtained based on feed ingredient composition data; and standardized input data is obtained by integrating the core dataset and the formulation dataset.
[0025] The following is a detailed introduction: Data Acquisition: Retrieve at least two types of data from a database or data file: Core performance and nutrient intake data: This includes the status information of pigs in each observation period (such as initial body weight (Initial_BW_kg), trial days (Trial_Duration_days), performance (such as average daily weight gain (ADG_g_per_d)), and detailed daily nutrient intake. This invention specifically requires that the following be included: crude protein (CP), net energy (NE, which may include multiple sources such as NE_intake1, NE_intake2), standard ileal digestible (SID) amino acids (lysine, threonine, methionine + cysteine, tryptophan, valine, isoleucine, etc.), total phosphorus (Total_P_intake_g_per_d), standard ileal total digestible phosphorus (STTD_P_intake_g_per_d), and calcium (Ca_intake_g_per_d).
[0026] Feed ingredient composition data: This includes the percentage (%) of each ingredient added in the feed formula that corresponds one-to-one with the above performance data.
[0027] Data preprocessing and calculation of derived variables: Data integration: The two types of data mentioned above are merged according to the observation period to form a comprehensive analysis dataset containing information on animals, nutrition, and raw materials.
[0028] Growth stage division: Based on the pig's weight (BW_kg), according to the preset weight boundaries (such as [0, 25, 70, 150] kg), each observation period is automatically divided into different growth stages (such as Nursery, Growing, Finishing), and a stage index (stage_idx) is generated.
[0029] Calculation of dynamic physiological parameters: Based on the pig's body weight, dynamic physiological parameters that change with growth are calculated using piecewise linear interpolation (np.interp), including the water ratio in protein deposition (water_ratio), the ash ratio in protein deposition (ash_ratio), and the maximum permissible fat / protein deposition ratio (max_lp_ratio).
[0030] Effective net energy calculation: Based on the growth stage of the pig, the feed waste coefficient (wastage_coeffs) corresponding to that stage is applied to discount the net energy ingested (NE) to obtain the effective net energy (NE_net) used for body metabolism.
[0031] Step 2: Construct the first-level Bayesian mechanism model (e.g.) Figure 2 ), to make preliminary predictions about growth and excretion; This step is the core of the "glass box" of the present invention, which constructs a comprehensive mechanistic model integrating energy, protein, nitrogen and phosphorus metabolism through a Bayesian inference framework (such as PyMC).
[0032] The process of generating preliminary prediction results includes: setting a prior distribution of model parameters based on the standardized input data; simulating nutrient metabolism pathways based on the prior distribution and obtaining intermediate metabolic variables, wherein obtaining intermediate metabolic variables includes: constructing a genetic maximum protein deposition potential curve and using a double logistic difference function to simulate the declining trend of protein deposition capacity in the later stages of pig growth. The potential protein deposition amounts restricted by different amino acids are calculated, and a differentiable smooth minimum function is applied to weight and integrate the genetic potential and the amino acid restriction potential to obtain the effective protein deposition potential. The phosphorus growth requirement is decomposed into soft tissue phosphorus requirement related to protein deposition and bone phosphorus requirement related to ash deposition. The total phosphorus growth requirement is obtained by calculating the phosphorus requirement independently based on the amount of protein deposition and the amount of ash deposition, and then summing them.
[0033] Specifically, it can be divided into the following steps: Prior distribution setting of model parameters: A prior probability distribution consistent with domain knowledge is set for all biological parameters to be estimated in the model. This demonstrates the superiority of Bayesian thinking, enabling the integration of existing scientific knowledge. Key parameters include: Genetic potential parameters (A1, w1, k1, A2, w2, k2): These are curves describing the maximum protein deposition potential determined by genetics. Their prior distribution is set based on the known growth patterns of pig breeds.
[0034] Maintenance requirements and efficiency parameters (lys_maint_coef, activity_factor, cost_excess_CP_in_NE, etc.): their prior distribution mean is set with reference to authoritative standards such as NRC (2012).
[0035] Phosphorus metabolism parameters: Phosphorus maintenance requirement coefficient (p_maint_coef): set to a normal distribution centered at 8.5 mg / kg BW^0.75.
[0036] The proportion of phosphorus in the sediment ash (p_in_ash_ratio): set to a normal distribution centered at 17.5%.
[0037] The proportion of phosphorus in deposited proteins (p_in_protein_ratio): set to a normal distribution centered at 0.75%.
[0038] Mechanistic computation of core metabolic flux (Metabolic Cascade): Within the model, a series of mathematical equations simulate the metabolic distribution pathways of nutrients. Calculation of genetic maximum protein deposition potential (PDmax_genetic): A double logistic curve difference function (pdmax_func_differential_logistic) is used. This function accurately simulates the complete bell-shaped pattern of protein deposition potential with body weight growth, which is "rising-plateauing-falling", by using the difference between two S-shaped curves. This overcomes the deficiency of traditional single S-curves in simulating the downward trend during maturity.
[0039] Calculation of amino acid-limited protein deposition potential (PDmax_from_AA): Based on the intake of each SID amino acid and its deposition requirement coefficient in in vivo, the maximum amount of protein deposition that each amino acid can support is calculated.
[0040] Determining the effective protein deposition potential (PDmax_val) (the innovation of this invention): A potential vector is constructed by combining the genetic potential and the potential of all amino acid restrictions. Instead of using the traditional hard minimum (min) function, this invention employs a differentiable smooth minimum approximation function (Softmin), specifically implemented through the softmax function. This ensures gradient continuity throughout the parameter space, significantly improving the efficiency and stability of the Bayesian MCMC sampling algorithm.
[0041] Net productive energy (NEp) is calculated by deducting from net available energy (NE_net) in the following order: a) energy utilization discount due to dietary neutral detergent fiber (NDF); b) energy consumed in metabolizing excess protein (Excess CP) (energy penalty); and c) energy used for maintenance needs (NEm). The calculation of NEm distinguishes between the nursery and growing / finishing stages and considers activity and stress factors.
[0042] Determining the final protein deposition (PD) and fat deposition (LD): By comparing the energy required for protein deposition (NE_for_PDmax) with the available net production energy (NEp), it is determined whether growth is "energy-limited" or "protein / amino acid-limited," thus determining the final protein deposition amount (PD_g). The remaining energy is used for fat deposition (LD_g), which is constrained by an upper limit of the maximum permissible fat / protein deposition ratio (max_lp_ratio).
[0043] This embodiment also provides examples of specific parameter settings for the core Bayesian mechanism model as shown in Table 1 (based on the PyMC framework): Table 1 In addition, in the calculation of effective protein deposition potential, this embodiment uses the Softmax function to smoothly weight the genetic potential and the restriction potential of each amino acid (smoothing coefficient tau=5.0) to solve the gradient cutoff problem of the traditional Minimum function.
[0044] like Figure 3 As shown, the integrated prediction of nitrogen (N) and phosphorus (P) cycles and excretions: Nitrogen cycle prediction: Based on the calculated protein deposition amount (PD_g), the following calculations are performed using the nitrogen mass balance principle: Nitrogen deposition (N_retained_g_d) = PD_g / 6.25.
[0045] Fecal nitrogen excretion (N_fecal_g_d) = Total nitrogen intake - Digestible nitrogen intake.
[0046] Urinary nitrogen excretion (N_urinary_g_d) = digestible nitrogen intake - nitrogen deposition.
[0047] Phosphorus cycle prediction: This invention constructs a complete phosphorus metabolism submodule: Calculate the total biological requirement of phosphorus (P_required): P_required = maintenance requirement + growth requirement. Maintenance requirement is related to metabolic body weight (BW^0.75); growth requirement is directly linked to the model's endogenously predicted protein deposition (PD_g) and ash deposition (Ash_g).
[0048] Calculating the actual phosphorus deposition (P_retained): Following the "weakest link" principle, the actual phosphorus deposition is determined as the smaller of the total biological requirement (P_required) and the absorbable phosphorus supply (STTD_P_intake). P_retained = minimum(P_required, STTD_P_intake).
[0049] Calculate the phosphorus excretion pathway and amount: Fecal phosphorus excretion (P_fecal_g_d) = Total phosphorus intake - STTD phosphorus intake. Urinary phosphorus excretion (P_urinary_g_d) = STTD phosphorus intake - Phosphorus deposition.
[0050] Generate first-level prediction results: Preliminary daily weight gain prediction: Predicted_ADG = PD_g (1 + water_ratio + ash_ratio) +LD_g.
[0051] The posterior distribution of all model parameters is obtained by sampling through MCMC, and the expected value (mean) of all the above predictor variables is calculated as the output of the first-level model, including the preliminary predicted daily weight gain (Predicted_ADG_mean), nitrogen and phosphorus excretion, and a key intermediate variable—digestible phosphorus balance (P_balance_g_d = STTD_P_intake -P_required).
[0052] Step 3: Construct the second-level machine learning residual correction model; This step aims to leverage the powerful fitting capabilities of machine learning to learn and correct systematic biases in the first-level mechanistic model.
[0053] The residual is obtained based on the difference between the preliminary prediction and the actual observation: the residual value is calculated based on the actual daily weight gain data and the daily weight gain in the preliminary prediction; the residual dataset is constructed based on the residual value and used to train the second-level model.
[0054] Based on the residuals, the generation of residual prediction values in the second-level machine learning residual correction model includes: Based on the residuals, a feature set is constructed, including: obtaining raw material aggregation features based on the functional classification of feed raw materials; obtaining nutrient interaction features based on the nutrient ratio relationship; obtaining mechanism linkage features based on the intermediate metabolic variables in the preliminary prediction results; constructing the feature set based on the raw material aggregation features, the nutrient interaction features, and the mechanism linkage features; and training a gradient boosting decision tree model based on the feature set to obtain the predicted residual values.
[0055] The specific implementation is as follows: Target variable definition: The prediction residual of the first-level model (Residual = actual ADG - Predicted_ADG_mean) is used as the learning target for this step.
[0056] Innovative Feature Engineering: Constructing a feature set containing rich biological information is the key to transforming a "black box" into a "gray box".
[0057] Functional Aggregation Characteristics of Raw Materials: Abandoning the traditional approach of directly using hundreds of raw materials as sparse features, this invention classifies and aggregates feed ingredients according to their main nutritional functions, forming low-dimensional, high-information-content features. For example, corn, wheat, and barley are classified as Energy_Cereal_pct (energy cereals); various soybean meals are classified as Protein_Soy_Std_pct (standard soybean meal) and Protein_Soy_Premium_pct (premium soybean meal), etc.
[0058] Key nutrient interactions and ratio features: Interaction features were constructed to quantify known nutritional effects, such as Ratio_Ca_to_STTD_P (the ratio of calcium to digestible phosphorus, used to capture the growth-inhibiting effect of calcium-phosphorus imbalance) and BCAA_Antagonism_Ratio (the branched-chain amino acid antagonism ratio (Ile+Val) / Leu, used to capture the antagonistic effect that may be caused by leucine excess). Mechanism-Machine Learning Linked Features (Core Innovation of this Invention): The intermediate metabolic variables output by the first-level mechanistic model are used as input features for the second-level machine learning model. Specifically, this invention uses digestible phosphorus balance (P_balance_g_d) as a key input feature. This design builds an information bridge between the two model levels, enabling the machine learning model to learn the nonlinear impact on growth performance when phosphorus supply deviates from the ideal state (whether deficient or excessive), an impact that is difficult to quantify precisely by a pure mechanistic model. Limiting Factor Index: The current growth limiting factors (such as 'energy limitation', 'lysine limitation', or 'genetic potential limitation') calculated by the mechanistic model are numerically encoded (e.g., One-Hot encoding) and input as classification features into the second-level model, allowing the machine learning model to dynamically adjust its prediction strategy based on different physiological bottlenecks.
[0059] Model training: The gradient boosting decision tree algorithm (such as XGBoost) is used to train the above feature set and target variable (residual) to obtain a residual prediction model, residual_model.
[0060] Step 4: Generate the final mixture prediction and perform interpretability analysis; The final mixed prediction result generation includes: calculating the final daily weight gain based on the daily weight gain and residual prediction values in the preliminary prediction results; and constructing the final prediction result based on the final daily weight gain and the nitrogen and phosphorus excretion in the preliminary prediction results.
[0061] Specifically, it can be divided into: Final daily weight gain prediction: Final_Predicted_ADG = Predicted_ADG_mean (from step 2) + Predicted_Residual (from step 3).
[0062] Collaborative output: The final corrected daily weight gain is correlated with the nitrogen and phosphorus excretion predicted in step two to form a comprehensive prediction report that includes growth performance and environmental impact.
[0063] Model interpretability analysis (implementation of the "glass box"): The SHAP (SHapley Additive exPlanations) algorithm is used to analyze the trained second-level residual model.
[0064] SHAP analysis can quantitatively calculate the contribution of each input feature (such as Ratio_Ca_to_STTD_P, P_balance_g_d, Wheat_Bran_pct, etc.) to the final residual prediction for each prediction.
[0065] By visualizing SHAP values globally and locally, it becomes clear which feed or nutritional factors are the main drivers of predictive bias in mechanistic models, and how these factors affect growth performance. For example, it can be found that "when P_balance_g_d is negative, the SHAP value is negative, indicating that phosphorus deficiency leads to additional growth loss."
[0066] Through the above steps, this invention not only significantly improves prediction accuracy, but more importantly, through structured two-level modeling and SHAP analysis, it successfully makes the correction process of machine learning transparent and interpretable, providing unprecedented depth of insight for precision nutrition decision-making.
[0067] Figure 4 shows the SHAP feature influence distribution map (Beeswarm Plot) generated by the embodiment of the present invention, which is used to intuitively demonstrate the interpretability of the second-level machine learning residual correction model.
[0068] The vertical axis (Y-axis) of the graph lists the most important features in the model, arranged from top to bottom according to their global contribution to the prediction results; the horizontal axis (X-axis) represents the SHAP value, indicating the specific impact of the feature on residual prediction (i.e., daily weight gain correction). A SHAP value greater than 0 indicates that the feature has a positive contribution to growth, while a value less than 0 indicates a negative inhibitory effect. Each point in the graph represents a sample, and the color of the point represents the magnitude of the feature value (red indicates high value, blue indicates low value).
[0069] Figure 4 provides the following key biological insights, validating the effectiveness of the "mechanism-machine learning linkage" of this invention: Effectiveness of Mechanism-Linked Features (Taking P_balance_g_d as an example): The figure shows that P_balance_g_d (digestible phosphorus balance) is the top-ranking key feature. Observing its distribution, we can see that low-value samples (blue dots, representing phosphorus deficiency) are mainly distributed on the left side of the X-axis (SHAP value < 0), indicating that insufficient phosphorus supply significantly reduces growth performance; while high-value samples (red dots, representing sufficient phosphorus) are distributed on the right side of the X-axis. This proves that the machine learning model successfully utilizes the latent variable of "phosphorus balance" passed by the mechanistic model to capture the nonlinear penalty effect of phosphorus limitation on growth.
[0070] Biological interpretation of feedstock characteristics (using Wheat_Bran_pct as an example): The high-value samples of Wheat_Bran_pct (wheat bran content) (red dots) in the figure are mainly distributed on the left side of the X-axis, indicating that as the amount of wheat bran (a high-fiber feedstock) added to the diet increases, it mainly has a negative impact on daily weight gain. This is consistent with the nutritional principle that high fiber reduces dietary energy density and digestibility, proving that the model successfully captured the anti-nutritional effects of the feedstock.
[0071] Capturing nutrient interaction features (taking Ratio_Ca_to_STTD_P as an example): The high values of this feature (red) tend to be distributed on the left side of the X-axis, revealing that an excessively high calcium-to-phosphorus ratio will antagonize phosphorus absorption and thus inhibit growth, demonstrating the model's ability to analyze complex nutrient interactions.
[0072] In summary, Figure 4 confirms that the method of the present invention is not only highly accurate, but also has transparent biological interpretability, achieving a leap from a "black box" to a "glass box".
[0073] This embodiment also discloses a synergistic prediction system for pig growth performance and environmental excrement, used to execute the method described.
[0074] The above are merely preferred embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for synergistic prediction of pig growth performance and environmental excrement, characterized in that, include: Acquire multi-source data on live pigs and preprocess the multi-source data to obtain standardized input data; Based on the standardized input data, a first-level Bayesian mechanism model is constructed to generate preliminary prediction results; Based on the difference between the preliminary prediction results and the actual observed values, the residuals are obtained; Based on the residuals, a second-level machine learning residual correction model is constructed to generate residual prediction values; Based on the preliminary prediction results and the residual prediction values, the final prediction results are obtained; Based on the final prediction results, a synergistic prediction report on growth performance and environmental excrement is output.
2. The method according to claim 1, characterized in that, The obtained standardized input data includes: Based on animal performance data and nutritional intake data, obtain the core dataset; Based on the feed ingredient composition data, obtain the formula dataset; Based on the core dataset and the formula dataset, data integration is performed to obtain the standardized input data.
3. The method according to claim 2, characterized in that, The acquisition of the core dataset includes: Based on initial weight, number of test days, and daily weight gain data, obtain a subset of performance data; Based on the intake data of crude protein, net energy, amino acids, total phosphorus, digestible phosphorus, and calcium, a nutrient subset is obtained; The core dataset is constructed based on the performance subset and the nutrient subset.
4. The method according to claim 1, characterized in that, The generation of preliminary prediction results includes: Based on the standardized input data, the prior distribution of the model parameters is set; Based on the prior distribution, the model parameters are inferred using the Markov chain Monte Carlo sampling algorithm, and the intermediate metabolic variables of the nutrient metabolic pathway are calculated. Based on the aforementioned intermediate metabolic variables, protein deposition, lipid deposition, nitrogen excretion, and phosphorus excretion are calculated to generate the preliminary prediction results.
5. The method according to claim 4, characterized in that, The acquisition of intermediate metabolic variables includes: A genetic maximum protein deposition potential curve was constructed, and the decline trend of protein deposition capacity in the later stage of pig growth was simulated using a double logistic difference function. The potential protein deposition amounts restricted by different amino acids are calculated, and a differentiable smooth minimum function is applied to weight and integrate the genetic potential and the amino acid restriction potential to obtain the effective protein deposition potential. The phosphorus growth requirement is decomposed into soft tissue phosphorus requirement related to protein deposition and bone phosphorus requirement related to ash deposition. The total phosphorus growth requirement is obtained by calculating the phosphorus requirement independently based on the amount of protein deposition and the amount of ash deposition, and then summing them.
6. The method according to claim 1, characterized in that, The process of obtaining the residual includes: Calculate the residual value based on the actual daily weight gain data and the daily weight gain in the preliminary prediction results; Based on the residual values, a residual dataset is constructed for training the second-level model.
7. The method according to claim 1, characterized in that, The generated residual prediction values include: Based on the residuals, a feature set is constructed; Based on the feature set, a gradient boosting decision tree model is trained to obtain the residual prediction value.
8. The method according to claim 7, characterized in that, The constructed feature set includes: Based on the functional classification of feed ingredients, obtain the polymerization characteristics of the ingredients; Based on the ratio of nutrients, obtain the characteristics of nutrient interactions; Based on the intermediate metabolic variables in the preliminary prediction results, the mechanism linkage characteristics are obtained, including: Digestible phosphorus balance is used to characterize the nonlinear effect of the deviation of phosphorus supply from biological requirements on growth performance. Net energy share of production is used to characterize the competitive pressure on energy allocation for maintenance needs; The limiting factor index is used to transmit the specific nutrient category that is currently limiting growth to the second-level model, helping the model to identify growth bottlenecks; The feature set is constructed based on the raw material polymerization characteristics, the nutrient interaction characteristics, and the mechanism linkage characteristics.
9. The method according to claim 1, characterized in that, The process of obtaining the final prediction result includes: The final daily weight gain is calculated based on the daily weight gain in the preliminary prediction results and the residual prediction value. Based on the principle of mass balance, calculate the total nitrogen excretion and the total phosphorus excretion separately: Total nitrogen excretion = Total nitrogen intake – Nitrogen deposition predicted by the model; Total phosphorus excretion = Total phosphorus intake – Phosphorus deposition predicted by the model; Phosphorus excretion is further categorized according to its excretion pathway: Fecal phosphorus excretion = Total phosphorus intake – Standard ileal digestible phosphorus intake; Urinary phosphorus excretion = Standard ileal digestible phosphorus intake – Model-predicted phosphorus deposition; The final prediction result is constructed based on the final daily weight gain and the nitrogen and phosphorus excretion in the preliminary prediction results.
10. A synergistic prediction system for pig growth performance and environmental excrement, characterized in that, Used to perform the method as described in any one of claims 1 to 9.