Method for quickly and efficiently predicting feed conversion rate
Through machine learning and reinforcement learning algorithms, the problem of inaccurate prediction of feed conversion rates in the existing technology is solved, and fast and efficient feed conversion rate prediction and feed formula optimization are achieved, which significantly improves the chicken breeding industry. economic benefits.
Patent Information
- Application Number
- CN202411032743.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-11-12
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing methods for predicting feed conversion rate cannot accurately distinguish feeding benefits at different growth stages, affecting the accuracy of prediction, and it is difficult to quickly and efficiently reduce feed costs.
Using machine learning technology to build a prediction model, combined with reinforcement learning algorithms and avalanche optimization algorithms, calculate feed conversion rate by obtaining chicken feed intake, feed times, feed time and weight data, and dynamically adjust feed formula and feeding strategy to Maximize economic benefits.
The accuracy of rapid and efficient prediction of feed conversion rates is achieved, and the feeding benefits at different growth stages are distinguished, the feed costs are reduced, and the overall benefits of the chicken breeding industry are improved.
Smart Images

Figure CN118940901A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of predicting feed conversion rate, and in particular to a method for quickly and efficiently predicting feed conversion rate. Background Art
[0002] The main benefits of chicken farming depend on the costs related to feed. Feed costs are an important part of chicken farming costs, usually accounting for 60% to 70% of the total cost. In order to improve the economic benefits of chicken farming, reasonable feed formulas and proportions should be adopted according to factors such as chicken breeds, growth stages and market demand to reduce the use of high-cost feeds. To reduce feed costs, it is necessary to understand the factors that affect the growth and development performance of chickens. Among them, the feed conversion rate (FCR) of chickens is an important economic trait in chicken farming and is directly related to the growth traits of chickens. Feed conversion rate refers to the amount of feed consumed by a chicken to gain one kilogram of weight. It is an important indicator for evaluating feed return. The range of FCR values reflects the health status of chickens.
[0003] The current method of predicting feed conversion rate has problems such as the inability to distinguish the feeding benefits of different growth stages in chicken farming, which affects the accuracy of predicting feed conversion rate. It is urgent to build a method to quickly and efficiently predict feed conversion rate. Summary of the invention
[0004] The object of the present invention is to provide a method for quickly and efficiently predicting feed conversion rate to solve the problems raised in the above background technology.
[0005] To achieve the above object, the present invention provides the following technical solutions:
[0006] A method for quickly and efficiently predicting feed conversion rate comprises the following steps:
[0007] Step 1: Obtain feed conversion rate data. The specific measurement scheme is as follows:
[0008] (1) Select 390 healthy chicks from the same batch;
[0009] (2) The 390 chickens to be tested were pre-fed 8 weeks ago when their body weight was between 600 and 800 g. The formal test began at 56 days of age and ended when their body weight was between 4.1 and 4.3 kg. During this period, the feed intake, feeding frequency, feeding time and body weight of each chicken were recorded.
[0010] (4) According to the physiological stage of chickens, they are divided into the chick stage, with a body weight of 600-800 g; the rearing stage, with a body weight of 0.8-3.0 kg; and the egg-laying stage, with a body weight of 3.1-4.2 kg;
[0011] Step 2: Calculate the ratio of the chicken's weight gain to feed consumption. The method for evaluating feed conversion efficiency is:
[0012] Record the initial weight W1 of the chicken before feeding and the final weight W2 before feeding in a ten-day cycle, and calculate the weight gain G of the chicken: G = W1-W2;
[0013] Record the total amount of feed consumed by the chickens in a ten-day period, F, in kilograms;
[0014] Calculate the feed conversion rate CR: CR = G / F;
[0015] Among them, G is the weight gain of the chicken in a ten-day cycle, F is the total amount of feed consumed by the chicken in ten days, and CR is the feed conversion rate, which means the weight gain of the chicken that can be brought about by each kilogram of feed consumption, unit: kilogram;
[0016] Step 3: Based on the calculated feed conversion rate data, a prediction model is constructed using machine learning technology. The machine learning algorithm is used to automatically acquire knowledge and experience from the training data set. Machine learning can train models with a large amount of data, automatically learn patterns from the data, and predict and analyze new data. The method for constructing a prediction model is as follows:
[0017] (4) Feature selection: Select features that are highly correlated with the target variable, and use correlation analysis, feature importance assessment and other methods to assist feature selection;
[0018] (5) Model selection: Select an appropriate regression algorithm, such as linear regression;
[0019] (6) Model training: Collect a large amount of feed conversion rate data, divide the feed conversion rate data set into a 30% test set and a 70% training set, use the training set to train the regression model, and use optimization algorithms such as gradient descent to minimize the loss function, such as mean square error, to fit the relationship between the features and the target variable;
[0020] (4) Model evaluation: Use the test set to evaluate the trained model and calculate the prediction error or performance indicators, such as root mean square error and R-square value;
[0021] (5) Future prediction: After model training is completed, the model is used to predict future data on feed conversion rate. The prediction model can output the corresponding feed conversion rate prediction value;
[0022] Step 4: Through the variance parameter FC k The accuracy of feed conversion rate prediction will help us more accurately evaluate the effects of different feed formulas on the growth performance of chickens, thereby optimizing feed formulas and improving feed utilization.
[0023] Step 5: Based on the determined feed conversion rate prediction value, record the feed conversion rate prediction value YC of the chicken to be tested z-k, where z represents the predicted value of feed conversion rate at different stages, and k represents different physiological stages;
[0024] Determine the specific variance parameter FC generated at different time stages in this physiological stage k , the specific variance parameters FC generated in different physiological stages k Arrange them in chronological order, and generate a variance parameter change curve based on the arrangement result, wherein the horizontal coordinate of the curve is the time parameter, and the vertical coordinate is the variance parameter. Based on the determined relevant points, the corresponding variance parameter change curve is determined;
[0025] Step 6: Based on the maximum variance parameter and the minimum variance parameter of the variance parameter change curve, lock the middle value, determine the point corresponding to the middle value in the variance parameter change curve, construct a set of standard lines passing through this point and perpendicular to the vertical coordinate axis, and translate the standard line upward by X1 and downward by X1 to determine a set of standard areas, where X1 is a preset value, and its specific value is determined by the operator based on experience, and the variance parameters within this standard area are calibrated as standard parameters.
[0026] Furthermore, in step 5, the mean square error (MSE) is the mean of the squares of the differences between the predicted value and the true value, and is used to measure the prediction performance of the regression model. The calculation formula of the mean square error is: Where n represents the number of samples, yi represents the actual observed value, represents the predicted value, Σ represents the sum;
[0027] According to the analysis results of the mean square error, the parameters of the model are adjusted. This can include changing the complexity of the model, adjusting the learning rate, and modifying the regularization term; by continuously adjusting the parameters, the prediction bias of the model can be reduced and the prediction accuracy can be improved.
[0028] Furthermore, in step 5, the root mean square error (RMSE) is a performance indicator commonly used in regression analysis, which is used to measure the deviation between the model prediction value and the true value. The formula is:
[0029] Where: n is the number of samples, y is i is the true value of the i-th sample, is the model's predicted value for the i-th sample, is the sum of squares of all sample prediction errors;
[0030] R-squared (also known as the coefficient of determination) is a statistic used in regression analysis. It indicates the proportion of the response variable changes explained by the model. The R-squared value measures how well the model fits the data. Its value is between 0 and 1. The calculation formula of the R-squared value is as follows:
[0031] Where: n is the number of samples, y is i is the true value of the i-th sample, is the model's predicted value for the i-th sample, is the mean of the true values (i.e. ), molecular part It is the residual sum of squares between the model prediction value and the true value, measuring the change that the model cannot explain, the denominator It is the total sum of squares between the true value and the mean, which represents all changes in the response variable. The parameters of the model are adjusted according to the evaluation results.
[0032] In step three, a reinforcement learning (RL) algorithm is used to optimize feed formula and feeding strategy, so that the prediction model can not only predict feed conversion rate, but also dynamically adjust feed and feeding strategy at different growth stages to maximize economic benefits. The specific steps are as follows:
[0033] Step 1: Building a reinforcement learning framework
[0034] Build a reinforcement learning-based framework and define a reward function to maximize feed conversion efficiency;
[0035] Define the state, action, and reward functions:
[0036] State (State, S): State S contains all relevant information of each chicken at the current time step;
[0037] Action (A): Action A includes feeding measures and feed formula adjustments that can be taken for chickens;
[0038] Reward (R): Reward R is defined as the improvement in feed conversion rate. The reward function can be designed as:
[0039] R t =FCR t -FCR t-1
[0040] Among them, R t represents the reward state at time step t, FCR t represents the feed conversion ratio at time step t, FCR t-1 represents the feed conversion rate at time step t-1;
[0041] Environmental Modeling:
[0042] A simulation environment is built to model the growth process and feed consumption of each chicken as a reinforcement learning environment. The state of the environment is updated based on the actual data of the chicken, and the actions correspond to the selection of different feed formulas and feeding strategies.
[0043] Step 2: Strategy Optimization
[0044] Use reinforcement learning algorithms such as Proximal Policy Optimization (PPO) to dynamically adjust feed formula and feeding strategy. PPO is a policy gradient-based reinforcement learning algorithm that maximizes cumulative rewards by optimizing the policy network. It limits the step size of policy updates to avoid learning instability caused by excessive policy updates.
[0045] Sampling data: state S; action A; reward R; strategy P;
[0046] Value function V: the value of the state, that is, the expectation of future cumulative rewards starting from this state;
[0047] Advantage Function: describes how much better an action is than the average level;
[0048] Strategy network and value network:
[0049] Policy Network π θ (A|S): The parameter is θ, and the output is the probability of taking action A in state S;
[0050] Value Network V φ (S): parameter φ, output value estimate of state S;
[0051] Policy goal: The PPO algorithm avoids learning instability caused by excessive policy updates by limiting the policy update step size. The core idea is to optimize the following goals:
[0052]
[0053] Among them, L PPO (θ) is the loss function of PPO (representing the strategy optimization objective under parameter θ), is the expected value at time step t, min means minimizing one of the two values, r t (θ) represents the ratio (probability ratio) of the new strategy to the old strategy, is the advantage function, clip represents the cutoff function, ∈ is a hyperparameter, A t represents the action at time step t, S t represents the state at time step t, S t+1 represents the state at time step t+1, π θ represents the probability of the strategy under the parameter θ, Indicates that the old parameter θ old The probability of the next strategy, π θ (A t |S t) means that under the parameter θ, the strategy is in state S t Next select Action A t The probability of It means that the old parameter θ old Under this situation, the strategy is in state S t Next select Action A t The probability, R t represents the reward at time step t, γ is the discount factor, and V φold It refers to the value estimate of the old value network;
[0054] Loss function:
[0055] The loss function of PPO consists of strategy loss and value loss, and the formula is as follows:
[0056]
[0057] Value loss L VF (φ):
[0058] L VF (φ)=(V φ (S t )-R t ) 2
[0059] Strategy entropy S[π θ ](S t ):
[0060]
[0061] Among them, L(θ,φ) is the total loss function, θ is the parameter of the policy network, and φ is the parameter of the value network. is the expected value at time step t, L PPO (θ) is the policy loss, c1 and c2 are hyperparameters, and L VF (φ) is the value loss, V φ refers to the value estimate of the value network under parameter φ, S t represents the state at time step t, R t represents the reward at time step t, S[π θ ](S t ) refers to the policy entropy, π θ represents the probability of the strategy under parameter θ, log is the logarithmic function, a refers to the selected action state, π θ (a|S t ) means that under the parameter θ, the strategy is in state S t The probability of choosing action a;
[0062] Step 3: Avalanche Optimization (SAO) combination
[0063] When using SAO for optimization in PPO, the specific steps are as follows:
[0064] Initialization parameters: network parameters θ and φ;
[0065] Sampling data: interact with the environment and collect a batch of state S, action A, reward R, and next state S′ samples;
[0066] Advantage function
[0067] in, is the advantage function, A t represents the action at time step t, S t represents the state at time step t, S t+1 represents the state at time step t+1, R t represents the reward at time step t, γ is the discount factor, and V φold It refers to the value estimate of the old value network;
[0068] Avalanche trigger: define avalanche trigger conditions (accumulated losses exceed a certain threshold). When the trigger conditions are met, simulate the energy transfer and release during the avalanche process and update the parameters.
[0069] Parameter update:
[0070] According to the energy transfer and release update parameters during the avalanche process, in SAO, the energy transfer and release process can be expressed by the following formula:
[0071]
[0072] Among them, θ old and φ lod is the old network parameter, θ new and φ new are the new network parameters, α is the learning rate, θ is the policy network parameter, φ is the value network parameter, is the gradient of the loss function of the policy network, is the gradient of the loss function of the value network;
[0073] Energy transfer and release during avalanche can be achieved by setting a dynamic learning rate, setting the learning rate as a function that changes over time or loss:
[0074] α t =α0·e -βt
[0075] Among them, α t is the learning rate at time step t, α0 is the initial learning rate, β is the decay coefficient, t is the time step,
[0076] Update policy network:
[0077] Use gradient descent to minimize the PPO loss function L PPO (θ):
[0078]
[0079] Among them, θ new is the updated policy network parameter, θ old is the policy network parameter before update, α t is the learning rate at time step t, is the policy loss function L PPO (θ) Gradient with respect to parameter θ;
[0080] Update value network:
[0081] Minimize the value loss L VF (φ):
[0082]
[0083] Among them, φ new is the updated value network parameter, φ old is the value network parameter before update, α t is the learning rate at time step t, Refers to the gradient symbol (indicating the derivative of parameter φ), L VF (φ) refers to the loss of the value function under parameter φ;
[0084] Update the old policy parameters: copy the current policy parameters θ to the old policy parameters θ old ;
[0085] Training goal: Repeated training until the strategy is stable and the goal of optimizing feed conversion rate is achieved.
[0086] Compared with the prior art, the beneficial effects of the present invention are as follows: by calculating the future data of feed conversion rate through the LASSO model, the prediction model can output the corresponding feed conversion rate prediction value, realize fast and efficient prediction of feed conversion rate, better capture the complex patterns in the data, thereby improving the accuracy of prediction, and when calculating the feed conversion rate, distinguish the feed conversion rates of the chick stage, the rearing stage, and the egg-laying stage, realize the distinction of feeding benefits at different growth stages, and improve the accuracy of predicting feed conversion rate;
[0087] Based on the preset standard line and the determined feed conversion rate prediction value, a set of standard lines of the vertical coordinate axis is constructed, and the standard line is translated upward by X1 and downward by X1 to determine a set of standard areas, and the variance parameters located within the standard area are calibrated as standard parameters. This method of determining the accuracy of the feed conversion rate prediction value is convenient and fast, with high efficiency, and the prediction accuracy can be controlled, which can achieve a better prediction effect of the feed conversion rate;
[0088] By combining the avalanche optimization algorithm (SAO) with the proximal strategy optimization (PPO), the intelligent control capabilities of feed formula and feeding strategy have been significantly improved; through the PPO algorithm, the feed conversion rate (FCR) can be dynamically optimized to adapt to the needs of chickens at different growth stages; the SAO algorithm further enhances the global optimization performance of PPO, and by simulating the avalanche energy transfer mechanism, it effectively avoids local optimality and improves the convergence speed and accuracy of the model; this combined method not only improves the accuracy of feed conversion rate prediction, but also realizes the precise adjustment of feed formula and feeding strategy to maximize economic benefits; this innovative application has broad prospects in the intelligent management of chicken farming, and can significantly reduce feed costs and improve the overall benefits of chicken farming. BRIEF DESCRIPTION OF THE DRAWINGS
[0089] Figure 1 A schematic diagram of a method for rapidly and efficiently predicting feed conversion rate according to the present invention;
[0090] Figure 2 A schematic diagram of a flow chart of obtaining feed conversion rate data in a method for rapidly and efficiently predicting feed conversion rate of the present invention;
[0091] Figure 3 A schematic diagram of a data flow of calculating feed conversion rate in a method for quickly and efficiently predicting feed conversion rate of the present invention;
[0092] Figure 4 A schematic diagram of a process of constructing a prediction model using machine learning technology in a method for quickly and efficiently predicting feed conversion rate of the present invention;
[0093] Figure 5 The present invention is a method for quickly and efficiently predicting feed conversion rate, which uses a reinforcement learning algorithm combined with an intelligent optimization algorithm to optimize feed formula and feeding strategy flow chart. DETAILED DESCRIPTION
[0094] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0095] Example
[0096] See also Figure 1-5 , the present invention provides an embodiment: a method for quickly and efficiently predicting feed conversion rate, comprising the following steps:
[0097] Step 1: Obtain feed conversion rate data. The specific measurement scheme is as follows:
[0098] (1) Select 390 healthy chicks from the same batch, and the chick pedigree information must be complete;
[0099] The pedigree information of the chickens includes the breeds of the parents, date of birth, pedigree number and other information. The pedigree information is obtained by collecting blood samples from 390 chickens and extracting chicken gene samples. High-quality DNA is extracted from each sample. DNA detection technology is used to perform gene sequencing and analysis to accurately determine the genetic background and relationship of the chickens.
[0100] Store the chick pedigree information in the smart leg ring, equip each chicken with a unique leg ring, and obtain relevant data by scanning or querying the system;
[0101] At the same time, the growth of the chickens to be tested is recorded, and a complete pedigree database is constructed over time;
[0102] (2) The 390 chickens to be tested were pre-fed 8 weeks ago when their body weight was between 600 and 800 g. The formal test began at 90 days of age and ended when their body weight was between 4.1 and 4.3 kg. During this period, the feed intake, feeding frequency, feeding time and body weight of each chicken were recorded.
[0103] Feed intake: Use a feed trough with a scale, record the initial weight L1 each time you add feed, and record the remaining weight L2 after a period of time, calculate the feed intake C: C = L1-L2, and add the feed intake in a ten-day cycle as a group;
[0104] Feeding times: With the help of electronic sensing equipment, the chickens are counted when they enter the trough area. The chickens wear smart leg rings that are connected to the weighing system. During the counting process, the electronic sensing equipment will accurately count the number of times the chickens feed. The electronic sensing equipment communicates and exchanges data with the leg rings through wireless signals, associates the number of times the chickens feed with the corresponding chickens, and transmits it to the data management system in real time for storage and analysis.
[0105] Feeding time: Intelligent monitoring equipment can automatically record the time when feeding starts and ends;
[0106] Weight of each chicken: The smart anklet usually has a built-in chip and sensor that can store the individual information of the chicken. The chicken enters the weighing area before the first feeding of the day and after the last feeding. The chicken wears the smart anklet and is associated with the weighing system. During the weighing process, the weighing sensor will accurately measure the weight of the chicken. The weighing system communicates and exchanges data with the anklet through wireless signals, associates the weight data with the corresponding individual chicken, and transmits it to the data management system in real time for storage and analysis;
[0107] (3) According to the physiological stage of chickens, they are divided into the chick stage, with a body weight of 600-800 g; the rearing stage, with a body weight of 0.8-3.0 kg; and the egg-laying stage, with a body weight of 3.1-4.2 kg;
[0108] Step 2: Calculate the ratio of the chicken's weight gain to feed consumption. The method for evaluating feed conversion efficiency is:
[0109] Record the initial weight W1 of the chicken before feeding and the final weight W2 before feeding in a ten-day cycle, and calculate the weight gain G of the chicken: G = W1-W2;
[0110] Record the total amount of feed consumed by the chickens in a ten-day period, F, in kilograms;
[0111] Calculate the feed conversion rate CR: CR = G / F;
[0112] Among them, G is the weight gain of the chicken in a ten-day cycle, F is the total amount of feed consumed by the chicken in ten days, and CR is the feed conversion rate, which means the weight gain of the chicken that can be brought about by each kilogram of feed consumption, unit: kilogram;
[0113] Step 3: Based on the calculated feed conversion rate data, a prediction model is constructed using machine learning technology. The machine learning algorithm is used to automatically acquire knowledge and experience from the training data set. Machine learning can train models with a large amount of data, automatically learn patterns from the data, and predict and analyze new data. The method for constructing a prediction model is as follows:
[0114] (1) Feature selection: Identify and remove irrelevant or redundant features through correlation analysis, principal component analysis (PCA) or other feature selection techniques to reduce the complexity of the model and improve the prediction speed. Select features that are highly correlated with the target variable. Use correlation analysis, feature importance assessment and other methods to assist feature selection. Use univariate analysis to further screen features and standardize or normalize features.
[0115] (2) Model selection: Select a suitable regression algorithm and use the scikit-learn package in Python to build the Lasso linear model. The general form of the linear regression model is:
[0116] [y=\beta_0+\beta_1x_1+\beta_2x_2+\ldots+\beta_nx_n]
[0117] Where: (y) is the dependent variable (target variable), (x_1, x_2, \ldots, x_n) are independent variables (features), (\beta_0, \beta_1, \ldots, \beta_n) are model parameters, also called regression coefficients;
[0118] (3) Model training: Collect historical data sets containing feed conversion rate and related features, perform appropriate preprocessing on the data, including missing value filling, outlier processing, feature encoding, etc., encode categorical features, use label encoding, and divide the feed conversion rate data set into a 30% test set and a 70% training set. The training set is used to train the Lasso model, while the test set is used to evaluate the performance of the model;
[0119] Use the training set to train the Lasso regression model, minimize the loss function such as mean squared error through optimization algorithms such as gradient descent to ensure that the prediction accuracy is maintained while simplifying the model, set the appropriate regularization strength (alpha parameter) to balance the complexity of the model and the prediction performance to control the complexity of the model and avoid overfitting, and select the best alpha value through cross-validation or other methods;
[0120] Among them, the iterative process of gradient descent is:
[0121] 1) α k Given running errors α>0, β>0, and k=0, select the initial point α0;
[0122] Among them, α represents the learning rate, β represents the convergence tolerance, and k represents the initial point position;
[0123] 2) Calculate negative gradient and its unit vector
[0124] Among them, S( k ): point α k Search direction;
[0125] For any point α k , we can define α k The negative gradient search direction unit vector of the point is:
[0126]
[0127] in, represents the vector unit, J(α k ) represents the function value of the learning rate point;
[0128] From α k Start from Take one step in the direction, the step length is ρ k , get the new point α k+1 , expressed as:
[0129]
[0130] Therefore, at the new point α k+1 , the function value of function J(α) is:
[0131]
[0132] Among them, denoted as α k+1 New learning rate point, J(α k+1 ) represents the function value at the new learning rate point, α k Negative gradient search direction of the point;
[0133] All α k Composed of a sequence, the sequence is generated by an iterative algorithm
[0134] α0, α1, α2, ..., α k , α k+1 ,……
[0135] The sequence converges to the solution α that minimizes J(α) under the given running error a>0, β>0, and k=0. *
[0136] Iterative algorithm formula:
[0137] Among them, α k Denoted as learning rate, ρ k It is represented as the step length, Represented as a unit vector;
[0138] 3) Check whether the condition ||S is met k ||≤α, if satisfied, go to 8), otherwise continue;
[0139] 4) Calculate the optimal step size
[0140] 5) Order:
[0141] Among them, α k Denoted as the learning rate, is the optimal step size, Represented as a unit vector;
[0142] 6) Calculate and test another criterion: J(α k+1 )-J(α k )≤β, go to 8), otherwise continue;
[0143] 7) Let k = k + 1, go to 2);
[0144] 8) Output the results;
[0145] Mean Squared Error (MSE): It is the mean of the squares of the differences between the predicted value and the true value. It is used to measure the prediction performance of the regression model. The calculation formula for the mean squared error is: Where n represents the number of samples, yi represents the actual observed value, represents the predicted value, Σ represents the sum;
[0146] According to the analysis results of the mean square error, adjust the parameters of the model. This can include changing the complexity of the model, adjusting the learning rate, modifying the regularization term, etc. By continuously adjusting the parameters, the prediction bias of the model can be reduced and the prediction accuracy can be improved;
[0147] After adjusting the parameters, retrain the model using the new data set. During the training process, techniques such as cross-validation can be used to evaluate the performance of the model to ensure that the model has good predictive ability on different data sets;
[0148] Repeat the above steps and continuously iterate and optimize the model. In each iteration, further adjust the model according to the new mean square error results until satisfactory prediction performance is achieved.
[0149] (4) Model evaluation: Use the test set to evaluate the trained model and calculate the prediction error or performance indicators, such as root mean square error and R-square value. If the performance of the test model is poor, you can try to adjust the model parameters or further optimize the feature selection;
[0150] Among them, the root mean square error (RMSE) is a commonly used performance indicator in regression analysis, which is used to measure the deviation between the model prediction value and the true value. The formula is:
[0151] Where: n is the number of samples, y is i is the true value of the i-th sample, is the model's predicted value for the i-th sample, is the sum of squares of all sample prediction errors;
[0152] R-squared (also known as the coefficient of determination) is a statistic used in regression analysis. It indicates the proportion of the response variable changes explained by the model. The R-squared value measures how well the model fits the data. Its value is between 0 and 1. The calculation formula of the R-squared value is as follows:
[0153] Where: n is the number of samples, y is i is the true value of the i-th sample, is the model's predicted value for the i-th sample, is the mean of the true values (i.e. ), molecular part It is the residual sum of squares between the model prediction value and the true value, measuring the change that the model cannot explain, the denominator It is the total sum of squares between the true value and the mean, which represents all changes in the response variable. The parameters of the model are adjusted according to the evaluation results.
[0154] (5) Future prediction: After model training is completed, new feature data is input into the model, and the LASSO model will output the predicted feed conversion rate;
[0155] Utilize parallel computing resources, such as multi-core CPUs or GPUs, to accelerate the model training and prediction process, so as to achieve fast and efficient prediction of feed conversion rate through the LASSO model, better capture complex patterns in the data, and thus improve the accuracy of predictions;
[0156] Step 4: Through the variance parameter FC k The accuracy of feed conversion rate prediction will help us more accurately evaluate the effects of different feed formulas on the growth performance of chickens, thereby optimizing feed formulas and improving feed utilization.
[0157] Step 5: Based on the determined feed conversion rate prediction value, record the feed conversion rate prediction value YCz-k of the tested chicken, where z represents the feed conversion rate prediction value at different stages, and k represents different physiological stages;
[0158] Determine the specific variance parameter FC generated at different time stages in this physiological stage k , the specific variance parameter Fck is obtained as follows:
[0159] Set k = 1, 2, ..., n, determine the mean of the predicted conversion rate generated by n groups of different physiological stages, and mark it as JZ k ,use
[0160] Among them, YC z-k represents the predicted value of feed conversion rate at stage zk, JZ kRepresents the mean of the predicted conversion rate at k different time stages, FC k Represents the specific variance parameters at k different time stages;
[0161] Determine the corresponding specific variance parameter FC k , the specific variance parameters Fck generated in different physiological stages are arranged in chronological order, and based on the arrangement result, the variance parameter change curve is generated, the horizontal coordinate of the curve is the time parameter, and the vertical coordinate is the variance parameter, and the corresponding variance parameter change curve is determined based on the determined relevant points;
[0162] Step 6: Based on the maximum variance parameter and the minimum variance parameter of the variance parameter change curve, lock the middle value, determine the point corresponding to the middle value in the variance parameter change curve, construct a set of standard lines passing through this point and perpendicular to the vertical coordinate axis, and translate the standard line upward by X1 and downward by X1 to determine a set of standard areas, where X1 is a preset value, and its specific value is determined by the operator based on experience, and the variance parameters within this standard area are calibrated as standard parameters.
[0163] In step 3 above, the reinforcement learning (RL) algorithm is used to optimize the feed formula and feeding strategy, so that the prediction model can not only predict the feed conversion rate, but also dynamically adjust the feed and feeding strategy at different growth stages to maximize economic benefits. The specific steps are as follows:
[0164] Step 1: Building a reinforcement learning framework
[0165] Build a reinforcement learning-based framework and define a reward function to maximize feed conversion efficiency;
[0166] Define the state, action, and reward functions:
[0167] State (State, S): State S contains all relevant information of each chicken at the current time step. The data contained in state S is set as follows: growth stage: weight: 3.0 kg, feed consumption: 0.5 kg, feed conversion rate: 0.6; rearing stage: weight: 3.9 kg, feed consumption: 0.6 kg, feed conversion rate: 0.65;
[0168] Action (A): Action A is feed formula adjustment;
[0169] Reward (R): Reward R is defined as the improvement in feed conversion rate. The reward function can be designed as:
[0170] R t =FCR t -FCR t-1
[0171] Among them, Rt represents the reward state at time step t, FCR t represents the feed conversion ratio at time step t, FCR t-1 represents the feed conversion rate at time step t-1;
[0172] R t =FCR t -FCR t-1 =0.65-0.6=0.05
[0173] Environmental Modeling:
[0174] A simulation environment is built to model the growth process and feed consumption of each chicken as a reinforcement learning environment. The state of the environment is updated based on the actual data of the chicken, and the actions correspond to the selection of different feed formulas and feeding strategies.
[0175] Step 2: Strategy Optimization
[0176] Use reinforcement learning algorithms such as Proximal Policy Optimization (PPO) to dynamically adjust feed formula and feeding strategy. PPO is a policy gradient-based reinforcement learning algorithm that maximizes cumulative rewards by optimizing the policy network. It limits the step size of policy updates to avoid learning instability caused by excessive policy updates.
[0177] Sampling data:
[0178] State (State, S); Action (Action, A); Reward (Reward, R); Policy (Policy, π);
[0179] Value Function (V): The value of a state, i.e. the expected future cumulative rewards from that state;
[0180] Advantage Function (A): describes how much better an action is than the average level;
[0181] Strategy network and value network:
[0182] Policy Network π θ (A|S): The parameter is θ, which outputs the probability of taking action A in state S. The action probability output by the policy network is set to 0.7, and the action probability output by the old policy network is set to 0.6.
[0183] Value Network V φ (S): parameter φ, output value estimate of state S;
[0184] Policy goal: The PPO algorithm avoids learning instability caused by excessive policy updates by limiting the policy update step size. The core idea is to optimize the following goals:
[0185]
[0186] Among them, L PPO (θ) is the loss function of PPO (representing the strategy optimization objective under parameter θ), is the expected value at time step t, min means minimizing one of the two values, r t (θ) represents the ratio of the new strategy to the old strategy, is the advantage function, clip represents the cutoff function, ∈ is the hyperparameter set to 0.2, A t represents the action at time step t, S t represents the state at time step t, S t+1 represents the state at time step t+1, π θ represents the probability of the strategy under the parameter θ, Indicates that the old parameter θ old The probability of the next strategy, π θ (A t |S t ) means that under the parameter θ, the strategy is in state S t Next select Action A t The probability of It means that the old parameter θ old Under this situation, the strategy is in state S t Next select Action A t The probability, R t represents the reward at time step t, γ (referring to the discount factor) is set to 0.99, V φold It refers to the value estimate of the old value network;
[0187]
[0188] Loss function:
[0189] The loss function of PPO consists of strategy loss and value loss, and the formula is as follows:
[0190]
[0191] Value loss L VF (φ):
[0192] L VF (φ)=(V φ (S t )-R t ) 2
[0193] Strategy entropy S[π θ ](S t ):
[0194]
[0195] Among them, L(θ,φ) is the total loss function, θ is the parameter of the policy network, and φ is the parameter of the value network. is the expected value at time step t, L PPO (θ) is the policy loss, c1 and c2 are hyperparameters, and L VF (φ) is the value loss, V φ refers to the value estimate of the value network under parameter φ, S t represents the state at time step t, R t represents the reward at time step t, S[π θ ](S t ) refers to the policy entropy, π θ represents the probability of the strategy under parameter θ, log is the logarithmic function, a refers to the selected action state, π θ (a|S t ) means that under the parameter θ, the strategy is in state S t The probability of choosing action a;
[0196] L VF (φ)=(V φ (S t )-R t ) 2 =(0.7-0.05) 2 =0.4225
[0197] S[π θ ](S t )=-∑π θ (a|S t )logπ θ (a|S t )=-[0.7log0.7+0.3log0.3]≈0.61
[0198] L(θ,φ)=0.167-0.5·0.4225+0.01·0.61=0.167-0.21125+0.0061
[0199] =-0.03815
[0200] Step 3: Avalanche Optimization (SAO) combination
[0201] When using SAO for optimization in PPO, the specific steps are as follows:
[0202] Initialization parameters: network parameters θ and φ;
[0203] Sampling data: interact with the environment and collect a batch of state S, action A, reward R, and next state S′ samples;
[0204] Advantage function
[0205] in, is the advantage function, A t represents the action at time step t, S t represents the state at time step t, S t+1 represents the state at time step t+1, R t represents the reward at time step t, γ is the discount factor, and V φold It refers to the value estimate of the old value network;
[0206] Avalanche trigger: define avalanche trigger conditions (accumulated losses exceed a certain threshold). When the trigger conditions are met, simulate the energy transfer and release during the avalanche process and update the parameters.
[0207] Parameter update:
[0208] According to the energy transfer and release update parameters during the avalanche process, in SAO, the energy transfer and release process can be expressed by the following formula:
[0209]
[0210] Among them, θ old and φ old is the old network parameter, θ new and φ new are the new network parameters, α is the learning rate, θ is the policy network parameter, φ is the value network parameter, is the gradient of the loss function of the policy network, is the gradient of the loss function of the value network;
[0211] Energy transfer and release during avalanche can be achieved by setting a dynamic learning rate, setting the learning rate as a function that changes over time or loss:
[0212] α t =α0·e -βt
[0213] Among them, α t is the learning rate at time step t, α0 is the initial learning rate, β is the decay coefficient, t is the time step,
[0214] Update policy network:
[0215] Use gradient descent to minimize the PPO loss function L PPO (θ):
[0216]
[0217] Among them, θ new is the updated policy network parameter, θ old is the policy network parameter before update, α t is the learning rate at time step t, is the policy loss function L PPO (θ) Gradient with respect to parameter θ;
[0218] Update value network:
[0219] Minimize the value loss L VF (φ):
[0220]
[0221] Among them, φ new is the updated value network parameter, φ old is the value network parameter before update, α t is the learning rate at time step t, Refers to the gradient symbol (indicating the derivative of parameter φ), L VF (φ) refers to the loss of the value function under the parameter φ;
[0222] Update the old policy parameters: copy the current policy parameters θ to the old policy parameters θ old ;
[0223] Training goal: Repeated training until the strategy is stable and the goal of optimizing feed conversion rate is achieved.
[0224] It will be apparent to those skilled in the art that the invention is not limited to the details of the exemplary embodiments described above and that the invention can be implemented in other specific forms without departing from the spirit or essential features of the invention. Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description, and it is intended that all variations falling within the meaning and scope of the equivalent elements of the claims be included in the invention. Any reference numeral in a claim should not be considered as limiting the claim to which it relates.
Claims
1. A method for quickly and efficiently predicting feed conversion rate, characterized in that: The following steps are involved: Step 1: Obtain feed conversion rate data. The specific measurement scheme is as follows: (1) Select 390 healthy chicks from the same batch; (2) The 390 chickens to be tested were pre-fed 8 weeks ago when their body weight was between 600 and 800 g. The formal test began at 56 days of age and ended when their body weight was between 4.1 and 4.3 kg. During this period, the feed intake, feeding frequency, feeding time and body weight of each chicken were recorded. (3) According to the physiological stage of chickens, they are divided into the chick stage, with a body weight of 600-800 g; the rearing stage, with a body weight of 0.8-3.0 kg; During the egg-laying stage, the body weight is 3.1 to 4.2 kg; Step 2: Calculate the ratio of the chicken's weight gain to feed consumption. The method for evaluating feed conversion efficiency is: Record the initial weight W1 of the chicken before feeding and the final weight W2 before feeding in a ten-day cycle, and calculate the weight gain G of the chicken: G = W1-W2; Record the total amount of feed consumed by the chickens in a ten-day period, F, in kilograms; Calculate the feed conversion rate CR: CR = G / F; Among them, G is the weight gain of the chicken in a ten-day cycle, F is the total amount of feed consumed by the chicken in ten days, and CR is the feed conversion rate, which means the weight gain of the chicken that can be brought about by each kilogram of feed consumption, unit: kilogram; Step 3: Based on the calculated feed conversion rate data, a prediction model is constructed using machine learning technology. The machine learning algorithm is used to automatically acquire knowledge and experience from the training data set. Machine learning can train models with a large amount of data, automatically learn patterns from the data, and predict and analyze new data. The method for constructing a prediction model is as follows: (1) Feature selection: Select features that are highly correlated with the target variable and use correlation analysis methods to assist feature selection; (2) Model selection: Select the linear regression algorithm; (3) Model training: Collect a large amount of feed conversion rate data, divide the feed conversion rate data set into a 30% test set and a 70% training set, use the training set to train the regression model, and use optimization algorithms such as gradient descent to minimize the loss function, including the mean square error, to fit the relationship between the features and the target variable; (4) Model evaluation: Use the test set to evaluate the trained model and calculate the prediction error or performance indicators, including root mean square error and R-square value; (5) Future prediction: After model training is completed, the model is used to predict future data on feed conversion rate. The prediction model can output the corresponding feed conversion rate prediction value; Step 4: Through the variance parameter FC k Reflecting the accuracy of feed conversion rate prediction, it helps to more accurately evaluate the effects of different feed formulas on the growth performance of chickens, and use reinforcement learning RL algorithms to optimize feed formulas and improve feed utilization; Step 5: Based on the determined feed conversion rate prediction value, record the feed conversion rate prediction value YC of the chicken to be tested z-k , where z represents the predicted value of feed conversion rate at different stages, and k represents different physiological stages; Determine the specific variance parameter FC generated at different time stages in this physiological stage k , the specific variance parameters FC generated in different physiological stages k Arrange them in chronological order, and generate a variance parameter change curve based on the arrangement result, wherein the horizontal coordinate of the curve is the time parameter, and the vertical coordinate is the variance parameter. Based on the determined relevant points, the corresponding variance parameter change curve is determined; Step 6: Based on the maximum variance parameter and the minimum variance parameter of the variance parameter change curve, lock the middle value, determine the point corresponding to the middle value in the variance parameter change curve, construct a set of standard lines passing through this point and perpendicular to the vertical coordinate axis, and translate the standard line upward by X1 and downward by X1 to determine a set of standard areas, where X1 is a preset value, and its specific value is determined by the operator based on experience, and the variance parameters within this standard area are calibrated as standard parameters.
2. A method for quickly and efficiently predicting feed conversion rate according to claim 1, characterized in that: In step 3, the mean square error (MSE) is the mean of the squares of the differences between the predicted value and the true value, and is used to measure the prediction performance of the regression model. The calculation formula for the mean square error is: Where n represents the number of samples, yi represents the actual observed value, represents the predicted value, and Σ represents the sum.
3. A method for quickly and efficiently predicting feed conversion rate according to claim 1, characterized in that: In step 5, the root mean square error (RMSE) is a performance indicator commonly used in regression analysis, which is used to measure the deviation between the model prediction value and the true value. The formula is: Where: n is the number of samples, y is i is the true value of the i-th sample, is the model's predicted value for the i-th sample, is the sum of squares of all sample prediction errors; The R-square value is a statistic used in regression analysis, which indicates the proportion of the response variable changes explained by the model. The R-square value measures how well the model fits the data. Its value is between 0 and 1. The calculation formula of the R-square value is as follows: Where: n is the number of samples, y is i is the true value of the i-th sample, is the model's predicted value for the i-th sample, is the mean of the true values (i.e. ), molecular part It is the residual sum of squares between the model prediction and the true value, measuring the changes that the model cannot explain, the denominator It is the total sum of squares between the true value and the mean, which represents all changes in the response variable. The parameters of the model are adjusted according to the evaluation results.
4. A method for quickly and efficiently predicting feed conversion rate according to claim 1, characterized in that: In step three, the reinforcement learning RL algorithm is used to optimize the feed formula and feeding strategy, so that the prediction model can not only predict the feed conversion rate, but also dynamically adjust the feed and feeding strategy at different growth stages to maximize economic benefits. The specific steps are as follows: Step 1: Reinforcement learning framework construction Build a reinforcement learning-based framework and define a reward function to maximize feed conversion efficiency; Define the state, action, and reward functions: State S: The state contains all relevant information of each chicken at the current time step; Action A: The action includes feeding measures and feed formula adjustments that can be taken on chickens; Reward R: The reward is defined as the improvement in feed conversion rate. The reward function can be designed as: R t =FCR t -FCR t-1 Among them, R t represents the reward state at time step t, FCR t represents the feed conversion ratio at time step t, FCR t-1 represents the feed conversion rate at time step t-1; Environmental Modeling: A simulation environment is built to model the growth process and feed consumption of each chicken as a reinforcement learning environment. The state of the environment is updated based on the actual data of the chicken, and the actions correspond to the selection of different feed formulas and feeding strategies. Step 2: Strategy Optimization Use the proximal strategy to optimize the PPO reinforcement learning algorithm and dynamically adjust the feed formula and feeding strategy. PPO is a reinforcement learning algorithm based on policy gradients. It maximizes the cumulative reward by optimizing the policy network. It avoids learning instability caused by excessive policy updates by limiting the step size of policy updates. Sampled data: state S; action A; reward R; strategy P; value function V; Advantage Function: describes how much better an action is than the average level; Strategy network and value network: Policy Network π θ (A|S): The parameter is θ, and the output is the probability of taking action A in state S; Value Network V φ (S): parameter φ, output value estimate of state S; Policy goal: The PPO algorithm avoids learning instability caused by excessive policy updates by limiting the policy update step size. The core idea is to optimize the following goals: Among them, L PPO (θ) is the loss function of PPO, which represents the strategy optimization objective under parameter θ. is the expected value at time step t, min means minimizing one of the two values, r t (θ) represents the ratio of the new strategy to the old strategy, is the advantage function, clip represents the cutoff function, ∈ is a hyperparameter, A t represents the action at time step t, S t represents the state at time step t, S t+1 represents the state at time step t+1, π θ represents the probability of the strategy under the parameter θ, Indicates that the old parameter θ old The probability of the next strategy, π θ (A t |S t ) means that under the parameter θ, the strategy is in state S t Next select Action A t The probability of It means that the old parameter θ old Under this situation, the strategy is in state S t Next select Action A t The probability, R t represents the reward at time step t, γ is the discount factor, It refers to the value estimate of the old value network; Loss function: The loss function of PPO consists of strategy loss and value loss, and the formula is as follows: Value loss L VF (φ): L VF (φ)=(V φ (S t )-R t ) 2 Strategy entropy S[π θ ](S t ): Among them, L(θ, φ) is the total loss function, θ is the parameter of the policy network, φ is the parameter of the value network, is the expected value at time step t, L PPO (θ) is the policy loss, c1 and c2 are hyperparameters, and L VF (φ) is the value loss, V φ refers to the value estimate of the value network under parameter φ, S t represents the state at time step t, R t represents the reward at time step t, S[π θ ](S t ) refers to the policy entropy, π θ represents the probability of the strategy under parameter θ, log is the logarithmic function, a refers to the selected action state, π θ (a|S t ) means that under the parameter θ, the strategy is in state S t The probability of choosing action a; Step 3: Avalanche Optimization Algorithm SAO Combination When using SAO for optimization in PPO, the specific steps are as follows: Initialization parameters: network parameters θ and φ; Sampling data: interact with the environment and collect a batch of state S, action A, reward R, and next state S′ samples; Advantage function in, is the advantage function, A t represents the action at time step t, S t represents the state at time step t, S t+1 represents the state at time step t+1, R t represents the reward at time step t, γ is the discount factor, It refers to the value estimate of the old value network; Avalanche trigger: define avalanche trigger conditions. When the trigger conditions are met, simulate the energy transfer and release during the avalanche process and update the parameters. Parameter update: According to the energy transfer and release update parameters during the avalanche process, in SAO, the energy transfer and release process can be expressed by the following formula: Among them, θ old and φ old is the old network parameter, θ new and φ new are the new network parameters, α is the learning rate, θ is the policy network parameter, φ is the value network parameter, is the gradient of the loss function of the policy network, is the gradient of the loss function of the value network; Energy transfer and release during avalanche can be achieved by setting a dynamic learning rate, setting the learning rate as a function that changes over time or loss: α t =α0·e -βt Among them, α t is the learning rate at time step t, α0 is the initial learning rate, β is the decay coefficient, t is the time step, Update policy network: Use gradient descent to minimize the PPO loss function L PPO (θ): Among them, θ new is the updated policy network parameter, θ old is the policy network parameter before update, α t is the learning rate at time step t, is the policy loss function L PPO (θ) Gradient with respect to parameter θ; Update value network: Minimize the value loss L VF (φ): Among them, φ new is the updated value network parameter, φ old is the value network parameter before update, α t is the learning rate at time step t, Refers to the gradient symbol, L VF (φ) refers to the loss of the value function under parameter φ; Update the old policy parameters: copy the current policy parameters θ to the old policy parameters θ old ; Training goal: Repeated training until the strategy is stable and the goal of optimizing feed conversion rate is achieved.
Citation Information
Patent Citations
Method for predicting pig feed conversion rate
CN116434840A
Multi-base station resource scheduling method and system
CN118283831A
Security task offloading method and system for low earth orbit satellites
CN118317368A
Cited By
Method and system for judging bending accuracy of sheet metal part based on three-dimensional model
CN119477919A
Fan component maintenance method and device, program product and storage medium
CN119831563A
