ICAR-CIRB, Hisar ICAR-IASRI, New Delhi

Buffalo Total Lactation Milk Yield Estimation System

ICAR
About the ICAR-CIRB buffalo total lactation milk yield estimation System
ICAR-CIRB buffalo total lactation milk yield estimation System is machine learning based web server to short out the estimation problem of buffalo milk yield . Early forecasting provide us utilizing suitable measure to prevent disease occurance and enhance production. Input data with tab separted can be pasted as first column PY representing peak yield; LL representing lactation length and Dry_priod refers to the non-lacting phase in a female buffallo's reproductive cycle that is the time between stoping milking and the birth of her next calf.
1. TLMY — Total Lactation Milk Yield
Definition: The total volume (or weight) of milk produced by an animal throughout its entire lactation cycle—from the day of calving until the dry period.Formula:$$\text{TLMY} = \sum_{t=1}^{\text{LL}} \text{Daily Milk Yield}_t$$
(where LL is the Lactation Length in days)
Significance: Measures the cumulative productivity of an animal over a single lactation.
2. PY — Peak Yield
Definition: The highest daily milk yield recorded for an animal on a single day during a given lactation period. Timing: Typically attained between 30 to 60 days (4–8 weeks) post-calving.Significance: Serves as a primary indicator of genetic potential. In mature dairy cows, every additional 1 kg of peak yield typically translates to an increase of 200–250 kg in total lactation yield.


Buffalo milk yield estimation using regression

Random Forest Regression is a machine learning algorithm that is based on the ensemble learning technique. It is used for solving regression problems, where the goal is to predict a continuous numerical value.

Random Forest Regression combines the power of multiple decision trees to make accurate predictions. Each decision tree in the random forest independently predicts the target value, and the final prediction is obtained by aggregating the predictions of all the trees.

The mathematical expression for Random Forest Regression:

𝑚̂ = ∑i=1N fi(x) / N

Where:

Each decision tree in the random forest is constructed by randomly selecting a subset of the training data and a subset of the input features. The trees are built using a process called recursive partitioning, where the data is split into smaller subsets based on certain conditions.

To make a prediction, each tree in the forest independently predicts a value for the input x. The final prediction is then obtained by averaging the predictions of all the trees.

Random Forest Regression is a powerful algorithm that can handle a large number of input features and capture complex relationships between the features and the target variable. It is widely used in various domains, including finance, healthcare, and engineering, for tasks such as stock market prediction, disease prognosis, and quality control.


Support Vector Regression (SVR) is a regression algorithm that uses support vector machines to perform regression tasks. It aims to find a function that approximates the relationship between the input variables and the continuous target variable. Here's the mathematical expression for SVR:

y = f(x) = ∑i=1n αi K(x, xi) + b

Where:

During the training process, SVR aims to minimize the following objective function:

½ ∑i=1n (λi - yi)2 + ε C ∑i=1n (ξi + ξi*)

Subject to the following constraints:

Where:

Support Vector Regression is a powerful algorithm that can handle non-linear regression tasks by using appropriate kernel functions. It is also widely used in various domains, including finance, engineering, and economics, for tasks such as stock price prediction, demand forecasting, and time series analysis.


LASSO (Least Absolute Shrinkage and Selection Operator) regression is a regularization technique used in linear regression to select relevant features and control model complexity. It adds a penalty term to the least squares objective function, encouraging sparse solutions.

The mathematical expression for LASSO regression:

y = f(x) = β0 + ∑j=1p βj xj

Where:

To incorporate the LASSO penalty, the objective function is modified as follows:

ƒ1/n ∑i=1n (yi - f(xi))2 + λ ∑j=1p |βj|

Where:

LASSO regression encourages feature selection by driving the coefficients of irrelevant or redundant features towards zero, effectively performing automatic feature elimination.

LASSO regression is widely used in various domains, including statistics, machine learning, and economics, for tasks such as feature selection, variable importance determination, and high-dimensional data analysis.

LASSO regression encourages feature selection by driving the coefficients of irrelevant or redundant features towards zero, effectively performing automatic feature elimination. LASSO regression is widely used in various domains, including statistics, machine learning, and economics, for tasks such as feature selection, variable importance determination, and high-dimensional data analysis.


Elastic Net regression is a regularization technique that combines both L1 (LASSO) and L2 (Ridge) regularization penalties to control model complexity and perform feature selection.

The mathematical expression for Elastic Net regression:

y = f(x) = β0 + ∑j=1p βj xj

Where:

To incorporate both L1 and L2 regularization penalties, the objective function is modified as follows:

ƒ1/n ∑i=1n (yi - f(xi))2 + λ1 ∑j=1p |βj| + λ2 ∑j=1p βj2

Where:

Elastic Net regression combines the strengths of both L1 and L2 regularization, making it suitable for handling datasets with high-dimensional features and correlated predictors.

Elastic Net regression is widely used in various domains, including machine learning, statistics, and bioinformatics, for tasks such as feature selection, dimensionality reduction, and predictive modeling.

Elastic Net regression combines the strengths of both L1 and L2 regularization, making it suitable for handling datasets with high-dimensional features and correlated predictors. Elastic Net regression is widely used in various domains, including machine learning, statistics, and bioinformatics, for tasks such as feature selection, dimensionality reduction, and predictive modeling.


The XGBoost regression model was used to build predictive model. XGBoost stands for extreme gradient boosting. For a given dataset with n samples and m features, $$D=\left\{\left(X_{i},y_{i}\right)\right\}\left(|D|=n,X_{i}\varepsilon R^{m},y_{i}\varepsilon R\right)$$ a tree ensemble model uses K additive function to predict the output $$ estimate\left(y_{i}\right)=Φ\left(X_{i}\right)= \sum_{k=1}^{K}f_{k}\left(X_{i}\right),f_{k}\varepsilon F...............(1) $$ where $$F=f_{k}=w_{q\left(x\right)}\left(R_{m}→T,W\varepsilon R^{T}\right)$$ is the space of regression trees. Here ‘q ‘represents the structure of each tree that maps an example to the corresponding leaf index. T is the number of leaves in a tree. Each $ f_{k} $ corresponds to an independent tree structure q and leaf weight w. Unlike decision trees, each regression tree contains a continuous score on each of leaf, we use $w_{i}$ to represent score on i-th leaf. To learn the set of functions used in the model, we minimize the following regularized objective $$ L\left(Φ\right)= \sum_{i}l\left(estimate\left(y_{i}\right),y_{i}\right)+\sum_{k}\Omega \left(f_{k}\right)...............(2) $$ where, $$ \Omega \left(f_{k}\right)= \gamma^{T}+\frac{1}{2}\lambda ||w||^{2}$$ Here ‘ι’ is a differentiable convex loss function that measure the difference between the prediction $estimate(y_{i}$ and target $y_{i})$ . The second term, Ω, penalizes the complexity of the regression tree function. The additional regulizer term helps to smoothen the final learned weight to avoid over-fitting. Intuitively, the regularized objective will tend to select a model employing simple and predictive functions.

The predictive models were validated considering the following statistical measures: $$ RMSE= { \sqrt{\sum_{i=1}^{n}{\left(Predicted\left(y_{i}\right) - observed\left(y_{i}\right)\right)^{2} \over n}}}..............(3) $$ To check the predictive accuracy of each model Relative mean absolute percentage error (RMAPE) was used. The RMAPE is widely used to validate forecast accuracy, which provides an indication of the average size of prediction error expressed as a percentage of the relevant observed value irrespective of whether that prediction error is positive or negative. $$ RMAPE= \frac{1}{n}{ \sum_{i=1}^{n}|\left(observed\left(y_{i}\right) - Predicted\left(y_{i}\right)\right)| \over observed\left(y_{i}\right)}\times100 .....(4)$$ $$ Model\space Accuracy = 100 - RMAPE ..............................(5) $$ Once the model has been trained. We can't assume, it can work well on data that it hasn't seen before. In other words, it can not be certain that the model will have the desired accuracy and variance in the environment of production. It needs some form of confirmation that the predictions our model is sending out are accurate. For that, our model needs to be validated. The process of determining whether the numerical results which quantify hypothesized relationships between variables are appropriate as data descriptions is known as validation. To evaluate the performance of any machine learning model we need to test it on some unseen data. Based on the models performance on unseen data we can say weather our model is Under-fitting/Over-fitting/Well generalized. Cross-validation (CV) is one of the authentication technique used to test the effectiveness of the build model, and is also a re-sampling procedure used to evaluate that model. We need to hold a sample / portion of the data that is not used to train the model to perform a CV. A 10-fold cross-validation method was applied to verify the accuracy of the models, and accuracy was tested based on the RMSE value.

Model benchmarking and comparison with actual data

To test how close server predicts to the actual value, this module has been provided. The user needs to provide actual miRNAs expression data of same experimental condition. After submission of the data we get results from the webserver which provides accuracy(%), Root Mean Square Error (RMSE), Mean Absolute Percentage Error (MAPE) and line plot of expression value between actual vs predicted miRNAs using plotly.js.

Figure-1: This snapshot shows the process of benchmarking the model using actual data fron the same experimental condition.

References
  1. Scikit-learn: Machine Learning in Python.
    Pedregosa et al.
    JMLR, 2011, 12, 2825-2830.  Get access article here
  2. Random Decision Forest.
    Ho, T.K.
    Proceedings of the 3rd International Conference on Document Analysis and Recognition, Montreal, 14-16 August , 1995, 278–282.  Get access article here
  3. Support Vector Regression.
    Awad, M., Khanna, R.
    In: Efficient Learning Machines. Apress, Berkeley, CA., 2015, 67–80.  Get access article here
  4. Regression Shrinkage and Selection Via the Lasso.
    Tibshirani, R.
    Journal of the Royal Statistical Society: Series B (Methodological), 1996, 267-288.  Get access article here
  5. Regularization and variable selection via the Elastic Net.
    Zou, H., Hastie, T.
    Journal of the Royal Statistical Society, Series B, 2005, 67, 301-320.  Get access article here