Pet feed formula optimization method and system based on pet differentiation analysis
By using a long short-term memory network and random forest model based on pet differential analysis, feed formulation is dynamically optimized, which solves the shortcomings of existing technologies in personalized formulation throughout the entire life cycle. It realizes multi-granular modeling of pet physiological state and precise supply of nutrient elements, ensuring a smooth transition and digestive system adaptability throughout the entire life cycle.
Patent Information
- Application Number
- CN202611394339.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-09
- Publication Date
- 2026-11-24
AI Technical Summary
Existing technologies cannot generate personalized feed formulations that cover the entire life cycle, accurately match individual needs, and allow for smooth transitions between stages. They suffer from problems such as insufficient modeling of physiological state changes, lack of precise quantification of nutrient supply and demand deviations, fixed update frequency with a lack of adaptive adjustment, lack of modeling of the entire life cycle evolution path, and lack of constraints on synergistic and antagonistic relationships of nutrient elements.
By using a pet differentiation analysis approach, we extract the continuously changing characteristics of pets using long short-term memory networks, and combine multi-head self-attention mechanisms and random forest models to dynamically adjust feed formulations, thereby achieving personalized full life cycle formulation optimization, including iterative constraints on the differentiation update frequency and the synergistic and antagonistic relationships of nutrient elements.
It enables multi-granular modeling of the temporal evolution of pets' physiological states, accurately captures individual differences in needs, dynamically adjusts feed formulations, avoids digestive system adaptation burden, and ensures a smooth transition and precise supply of nutrients throughout the entire life cycle.
Smart Images

Figure CN123159685A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of feed formulation optimization technology, and in particular to a method and system for feed formulation optimization based on pet differentiation analysis. Background Technology
[0002] Pets' nutritional needs change dynamically throughout their lifespan. Current technologies often use standardized formulas based on breed and rough age group, or manually formulate formulas according to nutritional standards, determining the formula in a static or phased manner. However, this approach has the following shortcomings: First, it fails to model physiological changes as a time-series sequence, making it impossible to capture continuous evolutionary characteristics and resulting in coarse-grained matching of individual needs; second, it lacks precise quantification of supply-demand discrepancies weighted by life stage, making it difficult to identify minor deviations in highly sensitive nutrients and causing delays in formula updates; third, the update frequency is fixed or relies on manual judgment, failing to adaptively adjust based on the severity of changes; fourth, it lacks modeling of the entire life-cycle evolution path and constraints on synergistic and antagonistic relationships of nutrients, resulting in insufficient precision in formula adjustments; and fifth, direct switching of formulas between stages lacks transitional connections, easily increasing the burden on the digestive system. In summary, current technologies struggle to generate personalized feed formulas that cover the entire lifespan, precisely match individual needs, and allow for smooth transitions between stages. Summary of the Invention
[0003] To address the aforementioned technical issues, this application provides a method and system for optimizing feed formulations based on pet differentiation analysis, used to generate personalized feed formulations that cover all stages of a pet's life from infancy to old age with a smooth transition.
[0004] Firstly, this application provides a method for optimizing feed formulation based on pet differentiation analysis, the method comprising: Acquire the initial life stage data of the target pet and the corresponding initial physiological state data collected at the same timestamp; input the initial life stage data and initial physiological state data into a pre-constructed long short-term memory network to extract the continuous change characteristics of the target pet; Based on the continuously changing characteristics, predict the actual needs of the target pet at multiple future time points; compare the current feed supply data with the actual needs to obtain the lag bias; When the hysteresis deviation exceeds a preset deviation threshold, the degree of change is determined based on the first and second derivatives of the continuous change characteristics; the differentiated update frequency is determined based on the degree of change. The differentiated update frequency and the actual demand are input into the random forest model to construct a dynamic evolution path and extract the state transition probability. The initial feed formula is optimized by ratio compensation based on the state transition probability, and the feed formula time sequence of each stage is spliced into the full life cycle target feed formula.
[0005] Secondly, this application provides a feed formulation optimization system based on pet differentiation analysis, the system comprising: The feature extraction module is used to acquire the initial life stage data of the target pet and the corresponding initial physiological state data collected at the same timestamp; the initial life stage data and initial physiological state data are input into a pre-constructed long short-term memory network to extract the continuous change features of the target pet. The demand forecasting module is used to predict the actual demand of the target pet at multiple future time points based on the continuously changing characteristics; and to compare the current feed supply data with the actual demand to obtain the lag bias. The update frequency determination module is used to determine the degree of change based on the first and second derivatives of the continuous change characteristics when the hysteresis deviation exceeds a preset deviation threshold; and to determine a differentiated update frequency based on the degree of change. The formulation optimization module is used to input the differentiated update frequency and the actual demand into the random forest model, construct a dynamic evolution path and extract the state transition probability; optimize the initial feed formulation by ratio compensation based on the state transition probability, and splice the feed formulation time sequence of each stage into the full life cycle target feed formulation.
[0006] Compared with the prior art, the beneficial effects of this application are at least as follows: First, by combining a bidirectional long short-term memory network with a multi-head self-attention mechanism, the continuous changing characteristics of pets are extracted at three scales: short-term, medium-term, and long-term. This models the temporal evolution of physiological states as a multi-granular representation, enabling precise capture of individual differentiated needs and overcoming the coarse-grained shortcomings of traditional static formulations. A hysteresis bias metric carrying directional indicators is introduced. The deviation between supply and demand is quantified using Euclidean distance weighted by life stage sensitivity, amplifying subtle deviations in highly sensitive nutrients and achieving directional localization and level determination of the deviation. Then, based on the first and second derivatives of the continuously changing characteristics, singular value decomposition is used to determine the degree of change. A differentiated update frequency is adaptively configured, and the update cycle is shortened or extended according to the life stage adjustment coefficient, achieving dynamic decision-making on update timing. A dynamic evolution path is constructed using random forests. The absorption conversion rate driven by state transition probability is used to calculate the ratio compensation coefficient. Iterative constraint solving and safety boundary verification of the synergistic and antagonistic relationship map of nutrients are superimposed, ensuring that ratio adjustments both compensate for absorption losses and are subject to safety constraints. Finally, the formulas for each life stage were sequentially spliced together, with transition periods set between adjacent stages and mixed and fed in decreasing and increasing proportions. This achieved a smooth and continuous transition of the formulas throughout the entire life cycle, avoiding the adaptive burden on the digestive system caused by sudden changes. Attached Figure Description
[0007] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0008] Figure 1 This is a flowchart illustrating a feed formulation optimization method based on pet differentiation analysis in an embodiment of this application. Figure 2 This is a schematic diagram of the system structure for extracting continuously changing features using a long short-term memory network in an embodiment of this application; Figure 3 This is a schematic diagram of a feed formulation optimization system based on pet differentiation analysis in an embodiment of this application. Detailed Implementation
[0009] This application provides a method and system for optimizing feed formulation based on pet differentiation analysis. The terms "first," "second," "third," "fourth," etc. (if present) in the specification, claims, and accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein. Furthermore, the terms "comprising" or "having" and any variations thereof are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0010] For ease of understanding, the specific process of the embodiments of this application is described below. Please refer to [link / reference]. Figure 1 One embodiment of a feed formulation optimization method based on pet differentiation analysis in this application includes: Step S1: Obtain the initial life stage data of the target pet and the corresponding initial physiological state data collected at the same timestamp; input the initial life stage data and initial physiological state data into a pre-constructed long short-term memory network to extract the continuous change characteristics of the target pet.
[0011] Furthermore, extract the continuously changing characteristics of the target pet, including: The input, forget, and output gates of the Long Short-Term Memory (LSTM) network are obtained. The LSM network is a bidirectional LSM network, including a forward layer and a backward layer. The input gate of the forward layer takes initial life stage data and initial physiological state data as input features and writes them into the memory state. The forget gate of the forward layer selectively retains historical information in the memory state, obtaining retained state data. The output gate of the forward layer outputs the forward hidden layer sequence based on the retained state data. The backward layer receives the sequence of initial life stage data and initial physiological state data in reverse chronological order and outputs the backward hidden layer sequence using the same gating operation as the forward layer. The forward and backward hidden layer sequences are concatenated along the feature dimension to obtain the bidirectional hidden layer representation. A multi-head self-attention mechanism is applied to the bidirectional hidden layer representation, and the attention score between any two time steps is calculated. The hidden layer vector at each time step is weighted and summed with the attention scores of each time step to obtain an attention-weighted representation. Based on the attention-weighted representation, state fluctuation features are extracted according to short-term, medium-term, and long-term time scales and concatenated along the dimensional direction to form continuously changing features.
[0012] Please see Figure 2 , Figure 2 This is a schematic diagram of the system structure for extracting continuously changing features using a Long Short-Term Memory (LSTM) network. Specifically, the target pet refers to an individual pet for which a customized feeding formula is needed throughout its entire life cycle. A pet's life cycle is typically divided into four stages: infancy, adolescence, adulthood, and old age.
[0013] Initial life stage data refers to the life stage identifier of the target pet when entering the formula optimization process. Its value is derived from a predefined life stage enumeration set, which includes four categories: puppyhood, adolescence, adulthood, and seniority. The life stage is determined by comparing the target pet's current age with a breed-standard age range table. For example, for Golden Retrievers, the puppy stage is 0-6 months, the adolescence stage is 6-18 months, the adulthood stage is 18-96 months, and the senior stage is 96 months and above. In this embodiment, the target pet is a 2-month-old Golden Retriever, and its initial life stage data is puppyhood. The life stage data is first converted into a 4-dimensional vector using one-hot encoding. For example, the puppy stage is encoded as [1, 0, 0, 0], the adolescence stage as [0, 1, 0, 0], the adulthood stage as [0, 0, 1, 0], and the senior stage as [0, 0, 0, 1].
[0014] Initial physiological state data refers to multi-dimensional physiological indicator readings of the target pet collected at the same timestamp as the initial life stage data, i.e., on the same day. The initial physiological state data is collected via a pet health monitoring terminal and stored in alignment with a unified timestamp, covering 8 dimensions in total: body weight (kg), body temperature (°C), heart rate (beats per minute), serum total protein (g / L), serum calcium (mmol / L), albumin (g / L), blood glucose (mmol / L), and activity level (steps per day). Among these, body weight, body temperature, heart rate, and activity level are non-blood indicators, which are automatically collected via wearable devices such as collar-type physiological sensors at a first sampling period of once a week; serum total protein, serum calcium, albumin, and blood glucose are blood biochemical indicators, which require venous blood collection and laboratory testing, and are collected at a low frequency at a second sampling period of no less than 4 weeks. For intermediate time steps between two adjacent blood collections in the same time-series sample, the values of blood biochemical indicators are complemented by linear interpolation: assuming the time steps of two adjacent blood collections are the t1-th week and the t2-th week respectively (t2-t1≥4), and the measured values of a certain blood biochemical indicator are v(t1) and v(t2), then the interpolated value of this indicator at the intermediate k-th week (t1<k<t2) is v(k)=v(t1)+(v(t2)-v(t1))×(k-t1) / (t2-t1).
[0015] Before being input into the long short-term memory network, the 8-dimensional physiological indicators are respectively subjected to z-score standardization processing according to the historical sample mean of their respective dimensions and standard deviation . The historical sample set refers to historical time-series records extracted from the pet nutrition analysis platform archive, covering no less than 2000 pets of different breeds, different months of age, and different body conditions.
[0016] A time-series sample covering the past consecutive 24 time steps of the target pet is constructed, where one time step corresponds to one week. When the archived historical data of the target pet is less than 24 weeks, the missing time steps can be filled with the population mean of the same breed and the same month of age, or the length of the time-series sample can be shortened to the actual number of archived weeks, with a lower limit of 8 weeks after shortening. When the number of archived weeks is less than 8 weeks, an insufficient data prompt is triggered and subsequent processing is suspended. After the above encoding and standardization processing, a 12-dimensional joint feature vector is obtained for each time step, which is the concatenation of the 4-dimensional life stage one-hot encoding and the 8-dimensional standardized physiological state values. The entire time-series sample is represented as a 24-row, 12-column two-dimensional array.
[0017] The pre-construction process of the long short-term memory network is divided into three stages: training data preparation, network structure setting, and loss function and optimization.
[0018] During the training data preparation phase, a training set was constructed based on the historical sample set. Each subset file contained weekly life stage identifiers and weekly 8-dimensional physiological index readings for a pet over 24 consecutive weeks. At the same time, the actual nutritional needs vector for the pet in the next 12 weeks from week 25 to week 36 was labeled as a supervision label. The supervision label was obtained by referencing the AAFCO or NRC standards and combining them with the pet's subsequent health re-examination results.
[0019] During the network architecture design phase, the Long Short-Term Memory (LSTM) network adopts a bidirectional structure, also known as a bidirectional LSM network. A bidirectional LSM network operates one LSM layer as a forward layer along the forward time direction on the same temporal sample, and simultaneously operates another LSM layer as a reverse time layer. The hidden layer dimension of the LSM network unit is set to 64 dimensions, the input dimension is the aforementioned 12-dimensional joint feature vector, and the output layer is a 64-dimensional fully connected layer. The weight parameters are initialized using Xavier uniform initialization, and the bias is initialized to zero.
[0020] In the loss function and optimization phases, a multi-task approach is used to learn the total loss function. ,in The gradient of the mean squared error (MSE) is the prediction loss of demand for the next 12 weeks after the continuously changing characteristics are mapped by the MLP and then backpropagated to the BiLSTM and the projection matrix via the MLP. The mean squared error is the mapping loss (mean squared error) of the projection matrix branch on the time-series nutrient intake vector of the past 24 weeks. The value is set to 0.5. The BiLSTM, projection matrix, and MLP are trained end-to-end, and their weights are fixed and saved after training. The optimizer uses Adam, with an initial learning rate of 0.001, a batch size of 64, and 200 training epochs. Early stopping is triggered when the validation set loss stops decreasing for 20 consecutive epochs. In this embodiment, the values of each hyperparameter can be adjusted according to the target pet breed and sampling period.
[0021] The continuously changing characteristics were gradually obtained from the time series sample of 24 rows and 12 columns: The first step is to read the gating weight matrices of the input, forget, and output gates of the Long Short-Term Memory (LSTM) network from the trained model file. The input, forget, and output gates are three gating structures within a LSM unit, each corresponding to an input weight matrix W, a hidden layer weight matrix U, and a bias vector b. The weight matrices of the forward and backward layers are stored in separate namespaces in the model file and are read separately during loading.
[0022] The second step involves processing the data sequentially from time step 1 to time step 24 along the positive time direction using the forward layer. Taking the current time step t as an example, its input is a 12-dimensional joint feature vector. Compared to the 64-dimensional hidden layer output of the previous time step The processing is divided into three parts: input gate, forget gate, and output gate.
[0023] In input gate processing, After concatenation with h(t-1), the input gate vector is obtained by sigmoid linear transformation. , Each component represents the proportion of new information in the corresponding dimension that is written into the memory state; simultaneously, a candidate memory vector is obtained through a tanh linear transformation. .Will and By multiplying the bits, we obtain the newly added information actually written to the memory state at the current time step.
[0024] In the forget gate processing, and After concatenation, a sigmoid linear transformation is performed to obtain the forgetting gate vector. , Each component represents the memory state of the previous time step. The corresponding dimension is retained as a proportion in the current time step. and Multiplying by bits yields the filtered retained state data. Adding the new information from the input gate to the retained state data from the forget gate, bit by bit, gives the updated memory state at the current time step. Its calculation formula is ,in This indicates digit-by-digit multiplication.
[0025] In output gate processing, and The concatenated vectors are then subjected to a sigmoid linear transformation to obtain the output gate vector. , Each component represents the proportion of the memory state at the current time step that is used as the hidden layer output. The memory state... First, compress to the -1 to 1 range using tanh, then combine with... Multiplying by the bits yields the 64-dimensional hidden layer output for the current time step. The forward layer will process time steps 1 through 24. Sequential collection yields a forward hidden layer sequence with a shape of 24 rows and 64 columns.
[0026] The third step involves the reverse layer processing data sequentially from the 24th time step to the 1st time step in the reverse time direction. The gating operation of the reverse layer is exactly the same as that of the forward layer, the only difference being the reverse direction of time traversal. That is, for the reverse layer, the "previous time step" of the current time step t refers to the (t+1)th time step. The reverse layer also collects the hidden layer outputs of each time step in sequence, resulting in a reverse hidden layer sequence with a shape of 24 rows and 64 columns.
[0027] The fourth step is to concatenate the forward hidden layer sequence and the backward hidden layer sequence along the feature dimension, i.e., the dimension of the 64-dimensional vector at each time step: For each time step, the 64-dimensional hidden layer output of the forward layer is concatenated with the 64-dimensional hidden layer output of the backward layer to form a 128-dimensional vector, thus obtaining a bidirectional hidden layer representation H with a shape of 24 rows and 128 columns.
[0028] The fifth step is to apply a multi-head self-attention mechanism to the bidirectional hidden layer representation H to obtain an attention-weighted representation. In this embodiment, the number of attention heads is set to 8, and the dimension of each head is 128 divided by 8, which equals 16.
[0029] In the linear mapping step, for each attention head, H is mapped to the query matrix Q, key matrix K, and value matrix V of that head through three independent linear transformation matrices, each with a shape of 24 rows and 16 columns.
[0030] In the attention calculation step, the inner product of the transposes of Q and K is first calculated and divided by the square root of the single-head dimension, √16, which equals 4, resulting in a 24x24 attention score matrix. The element in the p-th row and q-th column of this matrix represents the attention level of the p-th time step to the q-th time step, and is not yet normalized. Dividing by √16 is to prevent the inner product from being too large, causing the gradient of the subsequent softmax function to approach zero. Then, softmax normalization is performed on each row of the attention score matrix, making the sum of the elements in each row equal to 1, resulting in a normalized attention weight matrix. Softmax is an operation that converts a vector into a probability distribution, and its formula is: [Formula omitted for brevity]. , This represents the number of all elements; finally, the normalized attention weight matrix is multiplied by V to obtain an output with an attention head shape of 24 rows and 16 columns.
[0031] In the multi-head concatenation step, the outputs of the eight attention heads are concatenated along the feature dimension to obtain a 24-row, 128-column matrix. This matrix is then mapped back to a 24-row, 128-column matrix using a 128-row, 128-column linear transformation matrix, thus obtaining the attention-weighted representation.
[0032] A dimension reduction mapping layer is added between the attention-weighted representation and the state fluctuation feature extraction. Specifically, a 128-row, 64-column linear transformation matrix is used with tanh activation to reduce the attention-weighted representation from 24 rows and 128 columns to an intermediate representation of 24 rows and 64 columns. The subsequent short, medium, and long segments are all statistically analyzed on these 64 columns.
[0033] Step 6: Extract state fluctuation features from the 24x64 attention-weighted representation after dimensionality reduction mapping using a dual-path approach: First, take the sub-matrices of the most recent 4 time steps, the most recent 12 time steps, and all 24 time steps, respectively, and calculate the standard deviation of each feature dimension on the corresponding subset to obtain 64-dimensional abstract fluctuation features for short-term, medium-term, and long-term, concatenating them into 192 dimensions. Second, map the attention-weighted representation to a 24x6 nutrient latent representation using a 64x6 learnable nutrient element projection matrix Wproj, and calculate the standard deviation of each dimension according to the same three time scales as the first approach, obtaining 6-dimensional nutrient element fluctuation features for short-term, medium-term, and long-term, concatenating them into 18 dimensions. The projection matrix is then trained end-to-end in conjunction with BiLSTM and a multi-head self-attention mechanism. The training supervision signal is the 6-dimensional nutrient element time-series demand vector already labeled in historical samples, ensuring that the 6 dimensions of the projection output correspond to protein, fat, carbohydrate, water, calcium and phosphorus, and vitamins, respectively, and possess physical interpretability. By splicing the first 192-dimensional abstract fluctuation feature with the second 18-dimensional nutrient element fluctuation feature, a 210-dimensional continuous change feature is obtained.
[0034] Step S2: Based on the continuously changing characteristics, predict the actual needs of the target pet at multiple future time points; compare the current feed supply data with the actual needs to obtain the lag bias.
[0035] Furthermore, predict the actual needs of the target pet at multiple points in the future, including: Historical demand data of the target pet within a historical time period is obtained. Based on the historical demand data, a demand prediction baseline model is trained using supervised learning. The demand prediction baseline model adopts a multilayer perceptron structure. Continuously changing features are input into the demand prediction baseline model for feature mapping. From the mapping results, the basal metabolic demand features and growth and development demand features of the target pet at multiple future time points are extracted. The basal metabolic demand features and growth and development demand features are adaptively weighted and fused according to the life stage of the target pet to obtain fused demand features, which are then broken down into actual needs corresponding to multiple time points according to the time point dimension.
[0036] Furthermore, the hysteresis bias is obtained, including: The current feed supply data is cleaned to obtain standard feed supply data. Data cleaning includes at least standardizing indicator names, standardizing units of measurement, and removing outliers. Actual demand is normalized in different dimensions to obtain quantified actual demand and extract the first feature vector. Standard feed supply data is normalized in the same dimension to extract the second feature vector. The Euclidean distance between the first and second feature vectors is calculated to obtain a distance metric. The matching degree level is determined based on the distance metric falling into a preset interval. The lag bias is obtained based on the matching degree level and the difference between actual demand and standard feed supply data in each nutrient element dimension. The lag bias carries a directional indicator.
[0037] Furthermore, comparing current feed supply data with actual demand in a differentiated manner also includes constructing a dynamic dimensional weight allocation mechanism: A nutrient element importance matrix is maintained according to the life stage of the target pet. Each element value in the dimensional importance matrix represents the sensitivity weight of each nutrient element dimension at the corresponding life stage. The sensitivity weights are initialized based on the sensitivity knowledge of each nutrient element at each life stage in the pet nutrition knowledge base, and are dynamically updated according to the statistical frequency of health problems caused by deviations in each nutrient element in historical defect data. When calculating the Euclidean distance, the difference of each nutrient element dimension is multiplied by the corresponding sensitivity weight and then the sum of squares is obtained to obtain the weighted Euclidean distance as the distance metric. When generating lag bias, the difference between the actual demand and the standard feed supply data in each nutrient element dimension is also multiplied by the corresponding sensitivity weight for scaling.
[0038] Specifically, the input to the demand forecasting baseline model is continuously changing characteristics, and the output is the predicted nutritional needs of the target pet at multiple future time points.
[0039] Before training the baseline model for demand prediction, historical demand data of the target pet over a historical period is obtained as the training data source. Historical demand data refers to the record of the target pet's actual nutrient intake and expenditure over a past period, containing seven attributes: daily protein intake (g), daily fat intake (g), daily carbohydrate intake (g), daily water intake (ml), daily micronutrient intake (mg), daily energy expenditure (kcal), and weekly weight gain (g). This data is obtained from the pet health management database at weekly record points, forming a historical demand time-series sample aligned temporally with the previously mentioned physiological state data, with a sample length of 24 time steps. Daily energy expenditure and weekly weight gain are used as auxiliary contextual features, added to the first hidden layer of the MLP after independent linear mapping, and are not concatenated with continuously changing features in the input layer, nor are they included in the dimension definition of the supervision label. The pet health management database refers to the relational database in the pet nutrition analysis platform used to store the target pet's historical health monitoring, feeding records, and re-examination results.
[0040] The MLP has been trained in the joint training phase of step S1. When loading the model file saved in step S1 in step S2, the MLP weights are reused directly and no longer trained separately.
[0041] A multilayer perceptron is a feedforward neural network consisting of an input layer, several hidden layers, and an output layer. Adjacent layers are fully connected and nonlinear mapping capabilities are introduced through a nonlinear activation function, specifically the ReLU function. In this embodiment, the input layer dimension is 2^10, consistent with the dimension of continuously changing features. The first 192 dimensions correspond to abstract fluctuation features, and the last 18 dimensions correspond to nutrient element fluctuation features. There are three hidden layers, each with 128 neurons. The output layer dimension is 72, which is the product of the next 12 time points and six nutrient element dimensions for each node. These six nutrient element dimensions are protein, fat, carbohydrates, calcium and phosphorus, vitamins, and water. The output layer dimension is set to the product of the number of time points and the number of dimensions required for each node.
[0042] After inputting the 210-dimensional continuously changing features into the trained demand prediction baseline model, the model receives the data through the input layer, undergoes nonlinear transformation layer by layer through three hidden layers, and outputs a 72-dimensional feature mapping result from the output layer. Structurally, this 72-dimensional result can be divided into 12 6-dimensional sub-vectors according to the aforementioned 12 time nodes, with each 6-dimensional sub-vector corresponding to the demand for 6 nutritional elements at a future time node.
[0043] The feature mapping results are grouped according to preset dimensions, and the basal metabolic requirement characteristics and growth and development requirement characteristics of the target pet at multiple future time points are extracted separately. The basal metabolic requirement characteristics refer to the minimum nutritional supply level required for the target pet to maintain basic life activities at future time points. This is composed of values from the 72-dimensional mapping results belonging to the four nutrient elements: protein, fat, carbohydrates, and water; that is, 4 dimensions per time point, 12 time points, for a total of 48 dimensions. The growth and development requirement characteristics refer to the additional nutritional supply level required for the target pet to support physical growth, organ development, and immune system construction at future time points. This is composed of values from the 72-dimensional mapping results belonging to the two nutrient elements: calcium and phosphorus, and vitamins; that is, 2 dimensions per time point, 12 time points, for a total of 24 dimensions.
[0044] After obtaining the basal metabolic rate (BMR) and growth and development requirements, the two are directly concatenated according to time points. Since the BMR encompasses four dimensions (protein, fat, carbohydrates, and water) and the growth and development requirements encompass two dimensions (calcium, phosphorus, and vitamins), direct concatenation preserves the original physical meaning of each component. The differentiated needs at different life stages are reflected in the MLP's training supervision labels, which are obtained by referencing the recommended intake of each nutrient element at each life stage according to AAFCO or NRC standards.
[0045] The concatenation method is as follows: the 4-dimensional basic metabolism sub-vector and the 2-dimensional growth and development sub-vector at the same time point are directly concatenated to form a 6-dimensional vector, thus obtaining 12 6-dimensional fusion requirement features, for a total of 72 dimensions. Each component always maintains the original predicted value of the MLP output unchanged.
[0046] The fusion of demand features is broken down into 12 six-dimensional sub-vectors based on the time node dimension. Each six-dimensional sub-vector corresponds to the actual demand at a future time node. This actual demand is a nutritional demand vector composed of six components: protein, fat, carbohydrates, water, calcium and phosphorus, and vitamins. For example, the actual demand of the target pet at the third month node in the future might be: 30 grams of protein per day, 12 grams of fat per day, 50 grams of carbohydrates per day, 300 ml of water per day, 1.0 gram of calcium and phosphorus per day, and 50 milligrams of vitamins per day. There are a total of 72 dimensions across the 12 time nodes.
[0047] After obtaining the actual needs at multiple future time points, a differential comparison is performed with the target pet's current feed supply data to determine the lag bias. Current feed supply data refers to the data record of various nutrients actually ingested by the target pet at the current time point, including 10 fields: daily staple food intake (grams), staple food brand, protein content ratio, fat content ratio, carbohydrate content ratio, daily crude fiber intake (grams), daily calcium intake (grams), daily phosphorus intake (grams), daily vitamin intake (mg), and daily water intake (ml). This data is sourced from multiple channels, including automatic recordings by smart feeders. Due to differences in field naming, units of measurement, and collection frequency among the multiple data sources, data cleaning is required first.
[0048] Data cleaning is a standardized preprocessing procedure performed on current feed supply data, including at least three operations: standardization of indicator names, standardization of units of measurement, and outlier removal. Standardization of indicator names refers to mapping different names for the same nutrient element from different sources to a unified field name, such as unifying "protein content" and "protein ratio" to "protein content ratio." Standardization of units of measurement refers to converting different units of the same nutrient element to a preset unit, such as converting grams per kilocalorie to grams per day. Outlier removal refers to using 3D modeling and standardization of data cleaning methods. The criteria exclude values that deviate from the mean by more than three standard deviations. After data cleaning, standard feed supply data is obtained, with field names, units, and dimension definitions consistent with actual needs.
[0049] Both actual demand and standard feed supply data are normalized in the same dimension to map them to the same numerical range. In this embodiment, min-max normalization is used. After normalization, the actual demand is expanded into a one-dimensional first feature vector in dimensional order, and the standard feed supply data is expanded into a one-dimensional second feature vector in the same dimensional order. Both have 6 dimensions, corresponding to the six nutrients: protein, fat, carbohydrates, water, calcium and phosphorus, and vitamins, respectively.
[0050] The distance metric is obtained by calculating the Euclidean distance between the first and second eigenvectors. For example, when the first eigenvector is [0.50, 0.20, 0.83, 0.60, 0.40, 0.50] and the second eigenvector is [0.47, 0.27, 0.83, 0.50, 0.37, 0.50], the difference vector is [0.03, -0.07, 0, 0.10, 0.03, 0], and the sum of squares is 0.0009 + 0.0049 + 0 + 0.01 + 0.0009 + 0 = 0.0167. Taking the square root, the distance metric is d ≈ 0.129.
[0051] The matching degree level is determined according to the preset interval into which the distance metric falls. In this embodiment, the value range of the distance metric is divided into 4 intervals, each corresponding to a matching degree level: d≤0.10 corresponds to high matching; 0.10<d≤0.20 corresponds to moderate matching; 0.20<d≤0.30 corresponds to low matching; d>0.30 corresponds to severe deviation. The boundary values 0.10, 0.20, and 0.30 of the above four intervals are determined based on the 25th percentile, 50th percentile, and 75th percentile of the distance metrics for pets in the same life stage in the historical sample set. For example, the aforementioned d≈0.129 falls into the interval 0.10<d≤0.20, and the matching degree level is determined as moderate matching.
[0052] The lag deviation is obtained according to the matching degree level and the difference between the actual demand and the standard feed supply data in each nutrient element dimension. The lag deviation is a 6-dimensional deviation vector, each component of which corresponds to the difference between supply and demand for one nutrient element and carries a direction indicator. The direction indicator includes a positive indicator representing insufficient supply requiring supplementation and a negative indicator representing excessive supply requiring reduction. The calculation method for each component is as follows: first calculate the normalized value of the actual demand in the nutrient element dimension and the normalized value of the standard feed supply data difference, that is , when >0, this component carries the positive indicator "+"; when <0, it carries the negative indicator "-"; when =0, the direction indicator is empty; at the same time, this component is also attached with the aforementioned determined matching degree level as a comprehensive level label, which takes one of the four values: high matching, moderate matching, low matching, or severe deviation. For example, the lag deviation in the aforementioned example is [(protein, +0.03), (fat, -0.07), (carbohydrate, 0), (water, +0.10), (calcium-phosphorus, +0.03), (vitamin, 0)], and the comprehensive level label is moderate matching.
[0053] A nutrient element importance matrix is maintained according to the target pet's life stage. This matrix is a 4x6 matrix, with the four rows corresponding to the four life stages: puppyhood, adolescence, adulthood, and old age. The six columns correspond to the six nutrient elements: protein, fat, carbohydrates, water, calcium and phosphorus, and vitamins. Each element value represents the sensitivity weight of the corresponding nutrient element at that life stage. The sensitivity weight is a dimensionless value ranging from 0.1 to 2.0; a larger value indicates a more significant impact of deviations in that nutrient element at that life stage on the pet's health. The matrix is initialized by reading the sensitivity information for each nutrient element at each life stage from a pet nutrition knowledge base. For example, the sensitivity weight for calcium and phosphorus is initialized to 1.8 for puppyhood, 1.5 for vitamins, and 1.2 for protein; for adulthood, 1.6 for fat and 0.8 for calcium and phosphorus. The Pet Nutrition Knowledge Base is a structured database built according to AAFCO and NRC standards, indexed by life stage and containing nutrient element sensitivity coefficients.
[0054] The dynamic update method for sensitivity weights is as follows: historical defect data is obtained from the pet health management database. Historical defect data refers to records of pet health problems caused by deviations in various nutritional elements. Each record includes the time of occurrence, the nutritional element involved, a description of the health problem, and the life stage to which it belongs. The frequency of occurrence of such records in the most recent 52 weeks is calculated according to the nutritional element dimension. And update the sensitivity weights of the corresponding dimensions according to the following formula. : ,in The sensitivity weights before the update. To update the step size coefficient to a value of 0.1, This represents the total frequency of health problems caused by all nutritional elements over the past 52 weeks. This indicates the relative proportion of health problems caused by this dimension. (After update...) If the value exceeds the upper limit of 2.0, it will be truncated to 2.0; if the value is below the lower limit of 0.1, it will be truncated to 0.1.
[0055] When calculating Euclidean distance, the differences in each nutrient element dimension are multiplied by their corresponding sensitivity weights, and then the sum of the squares is calculated to obtain the weighted Euclidean distance as the distance metric. The formula is as follows: ,in This represents the total amount of nutrients.
[0056] When generating lag bias, the differences between actual demand and standard feed supply data in each nutrient element dimension are also multiplied by the corresponding sensitivity weights for scaling. That is, each component of the lag bias... The direction indicator is still determined based on the scaled value. The sign of the variable. Sensitivity weights are also applied when generating hysteresis bias, so that small deviations of high-sensitivity elements receive enhanced signal strength when subsequently triggering update frequency determination; fluctuations of low-sensitivity elements are suppressed.
[0057] A field mapping conversion step is added between data cleaning and same-dimensional normalization: According to the preset field mapping table, the daily feed intake of staple food is multiplied by the ratio of the protein content of staple food to obtain the daily protein intake, multiplied by the ratio of the fat content to obtain the daily fat intake, and multiplied by the ratio of the carbohydrate content to obtain the daily carbohydrate intake. The daily calcium intake and daily phosphorus intake are combined into a calcium-phosphorus dimension (the sum of the daily calcium intake and daily phosphorus intake is taken as the total mass of calcium and phosphorus). The daily vitamin intake is directly mapped to the vitamin dimension, the daily water intake is directly mapped to the water dimension, and the daily crude fiber intake is used as an auxiliary reference field for formula formulation. It is used in the compliance verification stage to verify whether the crude fiber content in the recombinant feed formulation falls within the preset crude fiber range [1%, 5%], and does not participate in the construction of the 6-dimensional nutrient element vector.
[0058] Step S3: When the lag deviation exceeds the preset deviation threshold, determine the degree of change based on the first and second derivatives of the continuous change characteristics; determine the differential update frequency based on the degree of change, wherein the actual update cycle of the differential update frequency is not less than the first sampling cycle of the physiological state data.
[0059] Furthermore, the frequency of differentiated updates is determined based on the degree of change, including: The rate of change is determined by obtaining the first derivative of the continuous change feature at the corresponding time point; the acceleration of change is determined by obtaining the second derivative; a state change matrix is constructed using the rate of change and the acceleration of change as matrix elements, with the rows of the state change matrix corresponding to different physiological indicator dimensions and the columns corresponding to the rate of change and acceleration of change dimensions; singular value decomposition is performed on the state change matrix, and the maximum singular value is extracted as the degree of change intensity; the degree of change intensity is compared with a preset intensity threshold, and if it is greater than the preset intensity threshold, it is determined as the first differentiation level and a first update frequency is configured, and if it is not greater than the preset intensity threshold, it is determined as the second differentiation level and a second update frequency is configured, where the first update frequency is a high-frequency update cycle and the second update frequency is a low-frequency update cycle; adaptive adjustment is performed according to the current life stage, and the update cycle is further shortened based on the first or second update frequency when in the rapid development stage, and further extended when in the stable stage.
[0060] Specifically, the preset deviation threshold is an empirical threshold for the distance metric used to distinguish whether the nutrient supply deviation has reached the threshold for triggering a formula update. Its value is 0.3, determined as follows: based on the historical sample set mentioned earlier, the distribution of distance metrics among pets of the same life stage is statistically analyzed. The quantile of the distance metric corresponding to the probability of an actual health problem reaching a preset risk level of 5% is taken from this distribution, resulting in 0.3. This threshold can be adjusted according to breed and risk preference; for example, it can be lowered to 0.25 in a conservative scenario. When the distance metric d corresponding to the lag deviation exceeds 0.3, the subsequent process for determining the severity of change begins; when d does not exceed 0.3, the current feed formula is maintained and no update is triggered.
[0061] Provided that the lag deviation exceeds a preset deviation threshold, the first and second derivatives of the continuously changing characteristics at the corresponding time node are obtained. The corresponding time node refers to the current time step corresponding to the lag deviation, that is, the most recent time step among the 24 time steps.
[0062] The first derivative is approximated using the first-order central difference method, and its formula is as follows: Where f(t) represents the value of the continuously changing characteristic at time node t. The time interval between adjacent time nodes is set to 1 week, and t+1 and t-1 are the next and previous time nodes of time node t, respectively. For the boundary time steps (step 1 and step 24) in the 24 time steps, the first-order forward difference (f(2)-f(1)) / With the first-order backward difference (f(24)-f(23)) / Approximately. The rate of change determined by the first derivative refers to how quickly each dimension of a continuously changing characteristic changes over time. The sign of the value indicates the direction of change, and the absolute value indicates the intensity of change.
[0063] The second derivative is approximated using the second-order central difference method, and its formula is as follows: The meanings of the symbols are the same as above. The acceleration determined by the second derivative refers to the change in the rate of change itself: when the acceleration is positive, it indicates that the rate of change of the physiological state is increasing, that is, it is in an accelerating change; when the acceleration is negative, it indicates that the rate of change is decreasing, that is, it is in a decelerating change; when the acceleration is close to zero, it indicates that the rate of change is relatively stable.
[0064] Since the continuous change characteristics are a 210-dimensional vector (the first 192 dimensions represent abstract fluctuation characteristics, and the last 18 dimensions represent nutrient element fluctuation characteristics), the first and second derivatives obtained above yield a 210-dimensional rate of change vector and a 210-dimensional acceleration vector, respectively. It should be noted that before constructing the state change matrix, only the last 18-dimensional nutrient element fluctuation characteristic part is compressed: the 18-dimensional rate of change vector and the 18-dimensional acceleration vector are respectively divided into three segments of 6 dimensions each (short, medium, and long), and the three segments of 6-dimensional vectors are compressed by taking the element-wise average to obtain a single 6-dimensional rate of change vector and a 6-dimensional acceleration vector. Since this 18-dimensional part has already established a physical correspondence with the six nutrient elements through the projection matrix in stage S1, its derivatives inherit the same physical meaning. After average compression, each dimension still corresponds to the six nutrient elements: protein, fat, carbohydrate, water, calcium and phosphorus, and vitamins. After compression, both the rate of change vector and the acceleration vector are 6-dimensional. Meanwhile, the first 192-dimensional abstract fluctuation features are used for demand prediction in step S2, and the last 18-dimensional nutrient element fluctuation features are used for determining the degree of change in step S3. Each of the two approaches performs its own function.
[0065] A state change matrix is constructed using the rate of change vector and the acceleration vector as matrix elements. The state change matrix is a 6-row, 2-column matrix, with its rows corresponding to the six nutrient elements: protein, fat, carbohydrates, water, calcium and phosphorus, and vitamins. The first column represents the rate of change values for the corresponding dimension, and the second column represents the acceleration values for the corresponding dimension. For example, if the 6-dimensional rate of change vector is [0.08, 0.05, 0.02, 0.01, 0.15, 0.03] and the 6-dimensional acceleration vector is [0.07, 0.04, 0.01, 0, 0.09, 0.02], then the state change matrix M is: .
[0066] Perform singular value decomposition (SVD) on the state change matrix. SVD is a matrix decomposition method that decomposes any m x n real matrix into a product of three matrices of a specific form. Its decomposition form is: Where U is an m x m left singular matrix, A diagonal matrix with m rows and n columns, and non-negative singular values only at the diagonal positions. This is the transpose of an n x n right singular matrix. The state transition matrix is a 6 x 2 non-square matrix. After decomposition, the maximum singular value is extracted from the diagonal matrix Σ, i.e. The largest non-negative value on the diagonal represents the degree of drastic change.
[0067] The preset severity threshold refers to an empirical threshold for singular values used to distinguish whether physiological state changes are severe enough to require frequent updates. In this embodiment, it is determined as follows: based on the aforementioned historical sample set, singular value decomposition is performed on the state change matrix of each pet at each time point, and the maximum singular value is extracted. The distribution of this maximum singular value at actual significant physiological turning events is statistically analyzed, and the singular value quantile corresponding to an 80% recall rate in this distribution is taken as the threshold. In this embodiment, the value is 0.10.
[0068] When the degree of change exceeds a preset threshold of 0.10, the target pet is determined to be in the first differentiation level at the corresponding time point, and a first update frequency is configured. The first update frequency is a high-frequency update cycle, which is once every 7 days to update the feed formula. When the degree of change is not greater than the preset threshold of 0.10, the target pet is determined to be in the second differentiation level at the corresponding time point, and a second update frequency is configured. The second update frequency is a low-frequency update cycle, which is once every 30 days to update the feed formula. It should be noted that when the update frequency is low (≥14 days), it reflects the recalculation and adjustment of the complete feed formula; when the update frequency is high (<14 days), it reflects the fine-tuning and updating of the ratio parameters of each nutrient element in the current stage of the feed formula, in order to avoid the adaptation burden on the digestive system caused by frequent formula switching. To ensure that each formula update is supported by the latest physiological data, a data availability trigger condition is set: the formula update calculation is only triggered when at least one set of new non-blood-related indicator data has been collected since the last formula update; if the preset update time is reached but no new physiological data has been collected, the formula update action is postponed until after the most recent data collection is completed, to avoid invalid duplicate calculations based on the same input data.
[0069] Adaptive adjustment refers to shortening or extending the update cycle based on an adjustment coefficient corresponding to the life stage, using either a first or second update frequency. This embodiment pre-sets a set of life stage adjustment coefficients. Rapid development stage (early childhood) =0.5; Stable stage (adulthood) =1.0; Decline stage (old age) =1.5. The rapid development phase refers to the target pet being in its infancy or early adolescence (less than 12 months old); the stable phase refers to the target pet being in adulthood (18 to 96 months old); and the decline phase refers to the target pet being in old age (greater than 96 months old). Adjusted actual replacement cycle. ,in The basic update cycle is either the first update frequency of 7 days or the second update frequency of 30 days. The actual update cycle is constrained by the lower limit of the first sampling cycle, that is, the actual update cycle is not less than the first sampling cycle of 7 days for non-blood indicators, to ensure that the latest physiological state data is available for calculation each time the formula is updated; when the life stage adjustment coefficient shortens the basic update cycle to less than 7 days, the actual update cycle is taken as 7 days.
[0070] For example, for puppies in a rapid development phase, if the initial renewal frequency is set at 7 days, then the actual renewal cycle... = 7 × 0.5 = 3.5 days. Constrained by the lower limit of 7 days for the first sampling period, the actual update period is 7 days, that is, a formula update is triggered every 7 days after the collection of new non-blood-related indicator data; if the original determination was a second update frequency of 30 days, then the actual update period is... = 30 × 0.5 = 15 days, meaning it updates every 15 days. For adult dogs in a stable phase, the adjustment coefficient is 1.0, and the actual update cycle remains unchanged at either the first update frequency of 7 days or the second update frequency of 30 days. For older dogs in a declining phase, if the original first update frequency was determined to be 7 days, then the actual update cycle... = 7 × 1.5 = 10.5 days, rounded down to an alternating update every 10 or 11 days; if the original update frequency was set at 30 days, then the actual update cycle would be... = 30 × 1.5 = 45 days, that is, it is updated every 45 days.
[0071] Step S4: Input the differentiated update frequency and actual needs into the random forest model, construct the dynamic evolution path and extract the state transition probability; optimize the initial feed formula by ratio compensation based on the state transition probability, and splice the feed formula time sequence of each stage into the full life cycle target feed formula.
[0072] Furthermore, a dynamic evolution path is constructed and state transition probabilities are extracted, including: Multiple decision trees independently trained on different subsets of training samples and random feature subsets are obtained from the random forest model. The differentiated update frequency and actual needs are combined as input samples and input into each decision tree to split nodes, outputting multiple local evolution paths. The confidence score is calculated based on the training sample class purity of the leaf nodes corresponding to each local evolution path, and the multiple local evolution paths are weighted and fused according to the confidence score to obtain the global evolution path. The global evolution path is determined as the dynamic evolution path. The state transition probabilities between adjacent nodes are extracted from the dynamic evolution path in chronological order and concatenated to obtain the state transition probability.
[0073] Furthermore, the initial feed formulation is optimized by proportion compensation based on the state transition probability, including: The dynamic evolution path is segmented into multiple sub-evolution paths based on multiple life stage nodes throughout the entire life cycle. Each parent sub-evolution path is then further segmented into sub-level sub-evolution paths based on the actual update cycle corresponding to the differentiated update frequency. For each sub-level sub-evolution path, stage-specific feed demand characteristics are extracted. An initial feed formula is matched from a preset feed formula database to obtain the initial ratio parameters of each basic nutrient element in the initial feed formula. The absorption and conversion rate of each nutrient element is determined based on the state transition probability of the sub-level sub-evolution path, and a ratio compensation coefficient is calculated based on the absorption and conversion rate. The ratio compensation coefficient is multiplied by the initial ratio parameters to obtain the updated ratio parameters, which are then recombined to obtain the reconstituted feed formula. The recombinant feed formulation corresponds to a single actual update cycle. The recombinant feed formulation undergoes compliance verification, which includes at least nutritional balance verification, safety upper limit verification, and prohibited combination verification. If it passes, it is determined to be a stage feed formulation; otherwise, the ratio compensation coefficient is readjusted and verification is repeated until it passes. All sub-stage feed formulations that pass verification within the same life stage constitute the stage feed formulation sequence for that life stage in chronological order. The sub-stage feed formulations are sequentially spliced together, with sub-transition periods set between adjacent sub-stage feed formulations within the same life stage and main transition periods set between different life stages. They are then mixed and fed in decreasing and increasing proportions to obtain the target feed formulation for the entire life cycle.
[0074] Furthermore, the updated proportioning parameters are obtained by multiplying the proportioning compensation coefficient by the initial proportioning parameters, including: Synergistic and antagonistic relationships between various nutrients are extracted from a pet nutrition knowledge base to construct a nutrient element relationship graph. The graph uses each nutrient element as a node, and the strength of synergy or antagonism between nodes as signed edge weights. Once a ratio compensation coefficient is determined for the target nutrient element, all associated nutrient elements in the nutrient element relationship graph are traversed, and the chain effect of the ratio compensation on the effective supply of associated nutrient elements is calculated based on the edge weights. If the chain effect is negative, a chain compensation process is triggered to calculate the corresponding chain ratio compensation coefficient for the associated nutrient element. The initial ratio compensation vector and the ratio compensation coefficient generated by the chain compensation are input into an iterative constraint solving algorithm. After multiple iterations, the adjustment amount of each nutrient element converges to a stable state. In each iteration, a safety boundary constraint not exceeding the upper limit of the corresponding nutrient element's tolerance is applied to the adjustment amount, and the updated ratio parameters optimized by synergy and antagonism constraints are output.
[0075] Specifically, the input to the random forest model is the input sample composed of the aforementioned differentiated update frequency and actual needs, and the output is the global evolution path.
[0076] The pre-construction process of the random forest model is as follows: using the differentiated update frequency and actual demand of each pet at a certain time point in the historical sample set as input features, and the actual state evolution sequence of the pet after that time point as supervision labels, a training sample subset is extracted from the historical sample set with replacement, and each decision tree is trained independently. In this embodiment, the random forest contains 100 decision trees, each with a maximum depth of 8 layers. The size of the feature subset randomly extracted at each node split is the square root of the total number of features, rounded down to 7, which is 2 features.
[0077] The specific method for combining differentiated update frequencies with actual needs into input samples is as follows: Using a time node as a unit, the actual update cycle (number of days) of that node is concatenated with the 6-dimensional actual need vector of that node to form a 7-dimensional input sample. The first dimension represents the actual update cycle, and dimensions 2 through 7 represent the actual needs of six nutritional elements: protein, fat, carbohydrates, water, calcium, phosphorus, and vitamins. In the training samples of the random forest model, the actual update cycle of each historical sample is also constrained by the aforementioned lower limit of the first sampling cycle; that is, the actual update cycle of historical samples is no less than 7 days, ensuring that the value distribution of the training samples and inference samples is consistent in the first dimension.
[0078] The 7-dimensional input sample is fed into 100 decision trees in a random forest. Each decision tree starts from the root node and splits the input sample layer by layer according to the splitting rules determined during the tree's training, until a leaf node is reached. Node splitting refers to the decision tree determining whether the input sample should enter the left or right child node at each internal node based on a preset attribute threshold. For example, the splitting rule for a certain internal node is: if the actual update cycle is less than 14 days, the input sample enters the left child node; otherwise, it enters the right child node. Each leaf node reached by the decision tree after layer-by-layer splitting outputs a local evolution path. This local evolution path is the decision tree's independent judgment on the future state evolution of the target pet across the 6 nutrient elements. A total of 100 local evolution paths are output from the 100 decision trees.
[0079] Class purity refers to the proportion of training samples belonging to the same evolutionary class at a leaf node. It is measured using the Gini purity metric, and its formula is: ,in Let K be the proportion of training samples belonging to class k at a leaf node out of the total number of training samples at that leaf node, where K is the total number of classes. The value ranges from 0 to 1. A smaller value indicates higher purity. The confidence score is calculated using the following formula: The value ranges from 0 to 1. For example, if a leaf node contains 100 training samples, of which 90 belong to the same evolutionary category and 10 are scattered across other categories, then... = 1 - (0.9 2 + 0.1 2 ) = 0.18, confidence score = 1 - 0.18 = 0.82.
[0080] Weighted fusion is a method of summing the local evolution paths output by each of the 100 decision trees according to their confidence scores. The formula is: Each component of the global evolution path... ,in, To determine the total amount of the decision tree, Score the confidence level of the j-th decision tree. This is the output value of the j-th decision tree on this component. This global evolution path is the dynamic evolution path, which covers the evolution of the target pet's state from its current state to future time points across the six nutrient element dimensions.
[0081] State transition probability describes the likelihood of a target pet transitioning from one state to another between two adjacent time points. It is extracted by calculating the magnitude of state change in each nutrient element dimension between adjacent time points and normalizing it to a probability value between 0 and 1. Normalization is achieved by dividing the magnitude of state change by the maximum magnitude of state change in that dimension across the historical sample set. For example, if the magnitude of state change in the protein dimension from the current state to the first month in the future is 0.42, and the maximum magnitude of state change in the protein dimension across the historical sample set is 0.50, then the state transition probability for that dimension during that time period is 0.42 / 0.50 = 0.84. Concatenating the state transition probabilities of each adjacent time point and each nutrient element dimension in chronological order yields a state transition probability sequence covering all time periods.
[0082] Life stage nodes refer to the transition points between the four life stages of a target pet: puppyhood, adolescence, adulthood, and seniority. Each transition point corresponds to a segment on the dynamic evolution path. For example, the transition point from puppyhood to adolescence for a Golden Retriever is 6 months of age, corresponding to time node t=24 on the dynamic evolution path (based on the above conversion of 1 time step = 1 week, 6 months ≈ 24 weeks). This results in 4 sub-evolutionary paths, each corresponding to one life stage. Based on this, each parent-level child evolutionary path is further subdivided according to the actual update cycle determined in step S3: taking puppyhood as an example, if the actual update cycle is 7 days (1 week), the puppyhood parent-level child evolutionary path (covering 24 weeks) is further subdivided into 24 sub-level child evolutionary paths, each covering 1 week; taking adulthood as an example, if the actual update cycle is 30 days (approximately 4 weeks), the adulthood parent-level child evolutionary path is subdivided into segments of 4 weeks each. Each sub-level child evolutionary path corresponds to a segment of demand evolution within an update cycle.
[0083] The stage-specific feed demand characteristics refer to the average demand vector across the six nutrient element dimensions of the sub-evolutionary path. This is calculated by taking the element-wise average of the actual demand across the six dimensions at each time point covered within the sub-evolutionary path, i.e., a single actual update cycle. The preset feed formulation database is a relational database of feed formulations indexed by life stage, breed, and the six-dimensional nutrient demand vector. Each record corresponds to a commercially available or customized feed formulation and its initial proportioning parameters across the six nutrient element dimensions. The matching method involves calculating the Euclidean distance between the stage-specific feed demand characteristics and each formulation record in the database on the six-dimensional demand vector, and selecting the record with the smallest distance that does not exceed the preset matching threshold of 0.15 as the initial feed formulation. The initial proportioning parameters refer to the mass percentages of the six basic nutrients—protein, fat, carbohydrates, moisture, calcium, phosphorus, and vitamins—in the initial feed formulation, denoted as a six-dimensional vector. Each sub-evolutionary path, after the above matching, ratio compensation, and compliance verification, yields a corresponding sub-stage feed formula; all sub-stage feed formulas within the same life stage constitute the stage feed formula sequence for that life stage in chronological order.
[0084] Absorption conversion rate refers to the proportion of the actual amount of a nutrient absorbed and utilized by the target pet relative to its intake. The value ranges from 0 to 1. It is determined by combining the average state transition probability of each nutrient dimension within the time period covered by the sub-evolution path with the baseline absorption rate of the corresponding nutrient. Specifically, the absorption conversion rate equals the product of the baseline absorption rate and 1 plus the sum of the average state transition probabilities, divided by 2. Furthermore, the absorption conversion rate has a lower limit protection value of not less than 0.05, denoted as... , where i is the nutrient element dimension index.
[0085] The ratio compensation factor refers to the amplification factor applied to the initial ratio parameter of a certain nutrient to compensate for insufficient absorption and utilization of that nutrient by the target pet. Its calculation formula is as follows: That is, the lower the absorption and conversion rate, the larger the ratio compensation coefficient. Wherein, the absorption and conversion rate... , For the baseline absorption rate, is the average state transition probability, and 0.05 is the lower limit protection value for absorption conversion rate. This is the upper limit of the compensation coefficient.
[0086] For example, if the average state transition probability of the calcium-phosphorus dimension along a certain sub-evolution path is the absorption conversion rate... = 0.70, then the absorption conversion rate = 0.70 × (1 + 0.70) / 2 = 0.595, then the ratio compensation coefficient = 1 / 0.70 ≈1.43.
[0087] It should be noted that a truncation sub-step for setting an upper limit for the compensation coefficient is added between the calculation and multiplication of the ratio compensation coefficient: a preset upper limit for the compensation coefficient is set for each nutrient element. Specifically: protein 1.2, fat 1.3, carbohydrates 1.2, water 1.2, calcium and phosphorus 1.5, vitamins 1.5. The calculated compensation coefficient exceeds Time cutoff The truncated value is then multiplied by the initial ratio parameters. The above upper limit is set based on the safety margin of each nutrient element in the AAFCO and NRC standards to ensure that the compensated ratio does not exceed the nutritional balance range.
[0088] The updated proportions of the six nutrient elements were recombined to obtain a reconstituted feed formula. Taking a 2-month-old Golden Retriever as an example, the baseline absorption rates of each nutrient element during puppyhood were retrieved from a pet nutrition knowledge base. Protein 0.80, Fat 0.70, Carbohydrates 0.85, Water 0.90, Calcium and Phosphorus 0.70, Vitamins 0.60; Average state transition probability of each nutrient element along this sub-evolutionary path. The components are: protein 0.84, fat 0.75, carbohydrates 0.80, water 0.85, calcium and phosphorus 0.70, and vitamins 0.65. According to the formula... The calculated absorption and conversion rates are: protein 0.736, fat 0.613, carbohydrates 0.765, water 0.833, calcium and phosphorus 0.595, and vitamins 0.495. According to the formula... The calculated proportioning compensation coefficient k = [1.36, 1.63, 1.31, 1.20, 1.68, 2.02], after upper limit truncation, k = [1.20, 1.30, 1.20, 1.20, 1.50, 1.50]. If the initial proportioning parameters... =[24%, 14%, 42%, 10%, 2.5%, 0.8%] (the sum of the 6 items is 93.3%), then the compensation coefficient multiplied by the initial ratio parameter yields the initial updated ratio parameter. =[28.8%, 18.2%, 50.4%, 12.0%, 3.75%, 1.2%] (the sum of the 6 items is 114.35%), for Normalized to 100% based on the sum of all six nutrient elements, i.e. = / 1.1435, obtained the updated ratio parameters. ≈[25.2%, 15.9%, 44.1%, 10.5%, 3.3%, 1.0%] (The sum of the 6 items is 100.0%).
[0089] Synergistic relationships refer to a positive correlation where an increase in one nutrient promotes the absorption and utilization of another; antagonistic relationships refer to a negative correlation where an increase in one nutrient inhibits the absorption and utilization of another. The nutrient relationship graph is a directed graph with six nutrients as nodes and signed edge weights representing the strength of synergy or antagonism between nodes. Edge weights range from -1.0 to +1.0, with positive values indicating strong synergy and negative values indicating strong antagonism. Edge weights are retrieved from a pet nutrition knowledge base. For example, there is a synergistic relationship between calcium and phosphorus and vitamin D, with an edge weight of +0.6; and an antagonistic relationship between protein and carbohydrates (high protein intake leads to decreased carbohydrate utilization), with an edge weight of -0.3.
[0090] When it is determined that a ratio compensation coefficient should be applied to a specific target nutrient element Then, the formula for calculating the cascading effect is: ,in Let j be the edge weight from the target element to the associated element j. The increment of the matching compensation coefficient relative to 1, The initial proportioning parameters for the target element. When When the value is positive, it indicates that the effective supply of related elements increases due to the collaborative relationship; when... When the value is negative, it indicates that the effective supply of related elements has decreased relatively due to antagonistic relationships.
[0091] The formula for calculating the chain ratio compensation coefficient is as follows: ,in is the initial allocation parameter for associated element j, and this coefficient is used to compensate for the decrease in the effective supply of associated elements caused by antagonistic relationships.
[0092] The iterative constraint-solving algorithm is a method that applies safety boundary constraints to the adjustment amounts of each nutrient element in each iteration and iterates until the adjustment amounts converge to a stable state. Its working process is as follows: In each iteration, the current adjustment amount of each element is calculated according to the aforementioned formula. Then, a safety boundary constraint is applied to the adjustment amount of each element, not exceeding the upper limit of the element's tolerance. That is, if the updated ratio parameter of the element in the current iteration... Exceeding its tolerance limit Then cut off as The tolerable upper limit (UL) refers to the upper limit of safe intake of a nutrient element per unit feeding amount, which is read from the pet nutrition knowledge base. For example, the UL for vitamins is 2.0%. The iterative convergence condition is: when the maximum absolute value of the change in the updated ratio parameters of all elements between two consecutive iterations is less than the preset convergence threshold of 0.001, it is considered convergent, and the updated ratio parameters optimized by synergistic and antagonistic constraints are output.
[0093] Compliance verification includes at least three categories: nutritional balance verification, safety limit verification, and prohibited combination verification. Nutritional balance verification refers to verifying whether the sum of the updated proportions of the three macronutrients (protein, fat, and carbohydrates) in the reconstituted feed formulation falls within the preset balanced range [85%, 95%]. Safety limit verification refers to verifying whether the updated proportions of each nutrient element do not exceed the tolerable upper limit. The prohibited combination verification refers to checking whether there are preset prohibited nutrient element combinations in the recombinant feed formulation, such as the simultaneous presence of high calcium (>2.0%) and high phosphorus (>1.5%). If all three verifications pass, the recombinant feed formulation is determined to be a stage feed formulation for the corresponding life stage; if any one fails, the ratio compensation coefficient of the corresponding nutrient element is readjusted (for example, the coefficient of the element exceeding the upper limit is reduced by 10%) and verification is performed again until all pass. For example, updating the ratio parameters. ≈[25.2%, 15.9%, 44.1%, 10.5%, 3.3%, 1.0%], the sum of the three macroelements (protein, fat, carbohydrate) is 85.2% within [85%, 95%], all three checks passed, confirming that this recombinant feed formula is a sub-stage feed formula for a certain sub-stage of the juvenile period.
[0094] The temporal splicing includes two levels: sub-transition periods between feed formulations of adjacent sub-stages within the same life stage and main transition periods between feed formulations of adjacent formulations of different life stages. Sub-transition periods are set between feed formulations of two adjacent sub-stages within the same life stage. The length of a sub-transition period is a certain proportion of a single actual update cycle. Within the sub-transition period, the formulations of the preceding and following sub-stages are mixed and fed in decreasing and increasing proportions, corresponding to the fine-tuning update in step S3 when the update frequency is high. Main transition periods are set between feed formulations of two adjacent life stages. The length of a main transition period is half the sum of the actual update cycles of the two adjacent stages. For example, in the transition from juvenile to adolescent stage, if the actual update cycle for juvenile stage is 7 days and the actual update cycle for adolescent stage is 7 days, then the length of the main transition period is (7+7) / 2≈7 days. During the main transition period, the formula from the last sub-stage of the previous phase and the formula from the first sub-stage of the next phase are mixed and fed in a decreasing and increasing ratio: On the first day of the main transition period, the formula from the previous phase accounts for 80% of the feeding amount, and the formula from the next phase accounts for 20%; thereafter, the proportion of the previous phase decreases linearly and the proportion of the next phase increases linearly each day, until the last day of the main transition period when the proportion of the previous phase drops to 20% and the proportion of the next phase rises to 80%; after the main transition period ends, the next phase formula is completely switched to. The decreasing and increasing mixing method is the same for the sub-transition periods and the main transition period. After the above two-level time sequence splicing, the target feed formula covering the entire life cycle of the target pet is obtained, that is, the full life cycle target feed formula.
[0095] The above describes a feed formulation optimization method based on pet differentiation analysis in the embodiments of this application. The following describes a feed formulation optimization system based on pet differentiation analysis in the embodiments of this application. Please refer to [link / reference]. Figure 3 One embodiment of a feed formulation optimization system based on pet differentiation analysis in this application includes: The feature extraction module is used to acquire the initial life stage data of the target pet and the corresponding initial physiological state data collected at the same timestamp; the initial life stage data and initial physiological state data are input into a pre-constructed long short-term memory network to extract the continuous change features of the target pet.
[0096] The demand forecasting module is used to predict the actual demand of the target pet at multiple future time points based on continuously changing characteristics; it compares the current feed supply data with the actual demand to obtain the lag bias.
[0097] The update frequency determination module is used to determine the degree of change based on the first and second derivatives of the continuous change characteristics when the lag deviation exceeds the preset deviation threshold; and to determine the differentiated update frequency based on the degree of change.
[0098] The formulation optimization module is used to input the differentiated update frequency and actual needs into the random forest model, construct a dynamic evolution path and extract the state transition probability; optimize the initial feed formulation by ratio compensation based on the state transition probability, and splice the feed formulation time sequence of each stage into the full life cycle target feed formulation.
[0099] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0100] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0101] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A pet feed formulation optimization method based on pet differentiation analysis, characterized by, The method includes: Acquire the initial life stage data of the target pet and the corresponding initial physiological state data collected at the same timestamp; input the initial life stage data and initial physiological state data into a pre-constructed long short-term memory network to extract the continuous change characteristics of the target pet; Based on the continuously changing characteristics, predict the actual needs of the target pet at multiple future time points; compare the current feed supply data with the actual needs to obtain the lag bias; When the hysteresis deviation exceeds a preset deviation threshold, the degree of change is determined based on the first and second derivatives of the continuous change characteristics; the differentiated update frequency is determined based on the degree of change. The differentiated update frequency and the actual demand are input into the random forest model to construct a dynamic evolution path and extract the state transition probability. The initial feed formula is optimized by ratio compensation based on the state transition probability, and the feed formula time sequence of each stage is spliced into the full life cycle target feed formula.
2. The method of claim 1, wherein, Extract the continuously changing characteristics of the target pet, including: Obtain the input gate, forget gate, and output gate of the Long Short-Term Memory (LSTM) network, wherein the LSM network is a bidirectional LSM network, including a forward layer and a reverse layer; The initial life stage data and initial physiological state data are written into the memory state as input features of the current moment by the input gate of the forward layer. The forget gate of the forward layer selectively retains the historical information in the memory state to obtain the retained state data. The output gate of the forward layer outputs the forward hidden layer sequence based on the retained state data. The reverse layer receives the sequence of initial life stage data and initial physiological state data in reverse chronological order, and outputs the reverse hidden layer sequence using the same gating operation method as the forward layer; The forward hidden layer sequence and the reverse hidden layer sequence are concatenated along the feature dimension to obtain a bidirectional hidden layer representation; A multi-head self-attention mechanism is applied to the bidirectional hidden layer representation, the attention score between any two time steps is calculated, and the hidden layer vector of each time step is weighted and summed with the attention score of each time step to obtain the attention-weighted representation. Based on the attention-weighted representation, state fluctuation features are extracted according to short-term, medium-term and long-term time scales and spliced along the dimensional direction to form the continuous change features.
3. The method of claim 1, wherein, Predict the actual needs of the target pet at multiple points in the future, including: Obtain historical demand data of the target pet within a historical time period, and train a demand prediction baseline model based on the historical demand data using supervised learning. The continuously changing characteristics are input into the demand prediction benchmark model for feature mapping; the basal metabolic demand characteristics and growth and development demand characteristics of the target pet at multiple future time points are extracted from the mapping results. Based on the target pet's life stage, the basal metabolic requirement characteristics and the growth and development requirement characteristics are adaptively weighted and fused to obtain fused requirement characteristics, which are then broken down into actual requirements corresponding to multiple time nodes according to the time node dimension.
4. The method of claim 1, wherein, The hysteresis bias is obtained, including: The current feed supply data is cleaned to obtain standard feed supply data; The actual demand is normalized in different dimensions to obtain a quantified actual demand and a first feature vector is extracted. The standard feed supply data is normalized in the same dimension to extract a second feature vector. The distance metric is obtained by calculating the Euclidean distance between the first feature vector and the second feature vector. The matching degree level is determined according to the preset interval into which the distance metric falls. The hysteresis deviation is obtained according to the matching degree level and the difference between the actual demand and the standard feed supply data in each nutrient element dimension. The hysteresis deviation carries a direction identifier.
5. The method of claim 4, wherein, The comparison between current feed supply data and actual demand also includes constructing a dynamic dimension weight allocation mechanism: A dimension importance matrix of nutritional elements is constructed according to the life stage of the target pet. The value of each element in the dimension importance matrix represents the sensitivity weight of each nutritional element dimension under the corresponding life stage, and the sensitivity weights are initialized and dynamically updated. When calculating the Euclidean distance, the difference of each nutrient element dimension is multiplied by the corresponding sensitivity weight and then the sum of squares is obtained to get the weighted Euclidean distance as the distance metric. When generating the hysteresis bias, the difference between the actual demand and the standard feed supply data in each nutrient element dimension is also multiplied by the corresponding sensitivity weight for scaling.
6. The method of claim 1, wherein, Determining the differential update frequency based on the degree of change includes: The rate of change is determined by obtaining the first derivative of the continuously changing feature at the corresponding time node; the acceleration of change is determined by obtaining the second derivative. A state change matrix is constructed using the rate of change and acceleration of change as matrix elements; singular value decomposition is performed on the state change matrix, and the maximum singular value is extracted as the degree of change. The degree of change is compared with a preset degree of change threshold. If it is greater than the preset degree of change threshold, it is determined as a first differentiation level and a first update frequency is configured. If it is not greater than the preset degree of change threshold, it is determined as a second differentiation level and a second update frequency is configured. Adaptive adjustment is performed according to the current life stage.
7. The method of claim 1, wherein, Constructing a dynamic evolution path and extracting state transition probabilities includes: Obtain multiple decision trees in the random forest model that are independently trained based on different subsets of training samples and random feature subsets; The differential update frequency and the actual demand are combined into input samples, which are then input into each decision tree to split the nodes and output multiple local evolution paths. The confidence score is calculated based on the training sample class purity of the leaf nodes corresponding to each local evolution path, and the global evolution path is obtained by weighted fusion of multiple local evolution paths according to the confidence score, and determined as the dynamic evolution path. The state transition probabilities are obtained by extracting the state transition probabilities between adjacent nodes in chronological order from the dynamic evolution path and concatenating them.
8. The method of claim 1, wherein, The initial feed formulation is optimized based on the state transition probability, including: The dynamic evolution path is divided into multiple sub-evolution paths according to multiple life stage nodes throughout the entire life cycle; then, each parent sub-evolution path is further divided into sub-level sub-evolution paths according to the actual update cycle corresponding to the differentiated update frequency. For each sub-evolutionary path segment, the feed demand characteristics are extracted, and the initial feed formula is matched from the preset feed formula database to obtain the initial ratio parameters of each basic nutrient element in the initial feed formula. The absorption and conversion rate of each nutrient element is determined based on the state transition probability of the sub-evolution path, and the ratio compensation coefficient is calculated based on the absorption and conversion rate. The ratio compensation coefficient is multiplied by the initial ratio parameter and normalized to obtain the updated ratio parameter, which is then recombined to obtain the recombinant feed formula, wherein the recombinant feed formula corresponds to a single actual update cycle; The recombinant feed formula is subject to compliance verification. If the verification is passed, it is determined to be a stage feed formula; otherwise, the ratio compensation coefficient is readjusted and the verification is repeated until it passes. All the verified sub-stage feed formulations within the same life stage constitute the stage feed formulation sequence for that life stage in chronological order. The feed formulations for each sub-stage are sequentially spliced together according to time sequence. Sub-transition periods are set between feed formulations of adjacent sub-stages within the same life stage, and main transition periods are set between different life stages. The feed formulations are then mixed and fed in decreasing and increasing proportions to obtain the target feed formulation for the entire life cycle.
9. The method of claim 8, wherein, The updated proportioning parameters are obtained by multiplying the proportioning compensation coefficient by the initial proportioning parameters, including: The synergistic and antagonistic relationships between various nutrients are extracted from the pet nutrition knowledge base, and a nutrient element relationship graph is constructed. Each nutrient element is a node, and the synergistic or antagonistic strength between nodes is a signed edge weight. Once the ratio compensation coefficient is determined to be applied to the target nutrient element, all related nutrient elements in the nutrient element relationship graph that are associated with the target nutrient element are traversed, and the chain effect of the ratio compensation on the effective supply of the related nutrient element is calculated according to the edge weight. If the chain effect is negative, the chain compensation process is triggered to calculate the corresponding chain ratio compensation coefficient for the related nutrient element. The initial ratio compensation vector and the chain ratio compensation coefficient are input into the iterative constraint solution algorithm. After multiple iterations, the adjustment amount of each nutrient element converges to a stable state. In each iteration, a safety boundary constraint not exceeding the upper limit of the tolerance of the corresponding nutrient element is applied to the adjustment amount, and the updated ratio parameters are output.
10. A pet-differentiated analysis based feed formulation optimization system for implementing a pet-differentiated analysis based feed formulation optimization method as claimed in any one of claims 1-9, characterized by, The system includes: The feature extraction module is used to acquire the initial life stage data of the target pet and the corresponding initial physiological state data collected at the same timestamp; the initial life stage data and initial physiological state data are input into a pre-constructed long short-term memory network to extract the continuous change features of the target pet. The demand forecasting module is used to predict the actual demand of the target pet at multiple future time points based on the continuously changing characteristics; and to compare the current feed supply data with the actual demand to obtain the lag bias. The update frequency determination module is used to determine the degree of change based on the first and second derivatives of the continuous change characteristics when the hysteresis deviation exceeds a preset deviation threshold; and to determine a differentiated update frequency based on the degree of change. The formulation optimization module is used to input the differentiated update frequency and the actual demand into the random forest model, construct a dynamic evolution path and extract the state transition probability; optimize the initial feed formulation by ratio compensation based on the state transition probability, and splice the feed formulation time sequence of each stage into the full life cycle target feed formulation.
