Introduction

Dairy cows do not efficiently utilize dietary nitrogen (N), primarily in the form of protein, and excrete a large proportion of dietary N to environment, causing terrestrial eutrophication, biodiversity loses and soil acidification1,2,3. In addition to the environmental pollution, N-related pollutants (e.g. ammonia) are linked to lung diseases, chronic bronchitis and premature mortality4. In Europe, approximately 75% of ammonia emitted to the atmosphere comes from livestock production5. Furthermore, protein supplements are the most expensive ingredient in dairy cows’ rations, so N excretion represents an economic loss. As a consequence, economic and environmental pressures are focusing attention on reducing manure N (MN) excretion from dairy production systems. Therefore, it is critical for dairy production industry to have capacity to accurately predict/mitigate MN excretion, in order to enhance economic stability and reduce environmental impacts of dairy farming.

Multiple linear regression (MLR) analysis is one of widely used modelling approaches for evaluation of MN excretion from livestock production. So far, a large number of statistical models, principally based on linear regression and MLR, have been established to predict MN excretion from dairy cows6,7. These studies found that equations had higher prediction accuracy for MN when using dietary variables, e.g., N intake (NI), dietary forage proportion (FP) and dietary N content (DNC), and animal factors, e.g., live weight (LW), milk yield (MY) and days in milk, as predictors1,6,7. However, MLR analysis makes four principal assumptions: the linearity of the relationship between dependent and independent variables, statistical independence of the errors, homoscedasticity of the errors and normality of the error distribution8,9. A challenge in implementing MLR technique is that these assumptions may not always be fulfilled, which might lead to biased results and fail to provide satisfactory prediction.

However, machine learning algorithms are quite beneficial when handling non-linear and complex datasets without any prior assumption, even if datasets are noisy and imprecise10, make machine learning algorithms, e.g. artificial neural networks (ANN), random forest regression (RFR), support vector regression (SVR), appropriate candidates to explore deep relationships between resource inputs and product outputs in livestock production. For example, Chen et al.11 found that ANN model had a better performance than MLR model in prediction of dairy cattle manure nutrient concentration, although Craninx et al.10 did not observe a better performance by ANN models when compared to MLR models in evaluation of relationships between rumen fermentation pattern and milk fatty acids in dairy cows. The RFR model made more accurate prediction than MLR model in prediction of individual survival rates to second lactation in Holstein cattle12. Faridi et al.13 evaluated the performance of SVR models and neural network models for predicting bodyweight and carcass weight of broiler chicken and found that the SVR method achieved better accuracy and generalization than the neural network method. These results imply that machine learning algorithms might be a better alternative, rather than MLR, to develop robust models for prediction of MN in cattle production. This is because N excretion rates in cattle are regulated by many animal and dietary factors (e.g., LW, productivity, feed intake and dietary N and fiber concentrations) and the interaction between these factors14,15. Machine learning algorithms may have technical power to explore and identify the deep and complexed relationships of N excretion rates against animal/dietary factors and their interaction effects. However, there is little information available on using machine learning algorithms to explore relationships between dairy cow MN and animal and dietary factors. Therefore, this study was designed to address this knowledge gap by using total diet digestibility data of lactating dairy cows to compare the predictive performance of different machine learning algorithms with MLR approach in predicting manure N excretion, and then develop new machine learning models for accurate prediction of MN for dairy production.

Results and discussion

Comparison of prediction performance of MN between MLR and machine learning models

There is little information available in the literature on the evaluation of prediction performance for MN excretion of dairy cows using MLR models against machine learning algorithms. Therefore, the research framework (the first objective) of the present study started with comparing predictive ability of machine learning approaches (ANN, SVR and RFR) against a typical MLR model published in 2006 (Yan et al.6) for prediction of MN output of dairy cows.

Feature selection

To select relevant features for machine learning models (ANN, RFR and SVR), a hybrid knowledge-based and data driven approach was developed and implemented in this study. Based on Pearson correlation matrix and VIF technique, 6 features with the VIF scores lower than 5 and these features were selected as input features to model manure N output from lactating dairy cows using the present training dataset (Fig. 1). The features selected were NI, DNC, MY, FP, LW and DMEC (diet metabolizable energy content). The DMEC had the lowest VIF score (1.1) among those features. Three of those features (NI, LW, MY) were included in the MLR model of Yan et al.6 which was used as benchmark model in the present study. A range of prediction equations for MN output in dairy cow have been developed based on linear and multiple linear regression with stepwise procedure6,7,14,16,17. Among these equations, NI, LW and MY were the most commonly selected predictors (features) for the prediction. The NI has been found to be a better predictor for MN output than LW or MY in dairy cows and beef cattle7,18. Although the relationship between MN and LW or MY was not strong, the model performance was improved significantly when using NI, LW and MY together as predictors6. Furthermore, in the present study, DNC, FP and DMEC were also selected as features using Pearson correlation matrix and VIF technique. This selection is consistent with the domain knowledge, i.e., the higher N concentration in dairy cow diets (DNC), the higher N consumption (NI) and then more N excretion in manure (MN). For grassland-based dairy systems, increasing the proportion of grazed grass or silage in dairy cow diets (FP) would normally reduce NI and consequently total N excretion in manure (MN). These features (DNC, FP and DMEC) have been selected in a number of published MLR models as predictors for MN output in dairy cows1,7,19.

Figure 1
figure 1

The variance inflation factors (VIF) score of features selected based on the training dataset. The features included N intake (NI), diet N content (DNC), milk yield (MY), forage proportion (FP), live weight (LW) and diet metabolizable energy content (DMEC).

Comparison of prediction performance of the four selected models

Prediction performance metrics using the present testing dataset performed by MLR, ANN, RFR and SVR models are showed in Table 1. The root mean square error (RMSE) was selected as the criteria for evaluation of the precision of models. The concordance correlation coefficient (CCC) was used to assess agreement between observed and predicted values. The CCC represents both the accuracy and precision of model performance, because it is calculated from the Pearson correlation coefficient multiplied by a bias-correction factor. For the prediction of MN using features selected by the Stepwise method, ANN model had a significantly the lowest RMSE (P < 0.01) and highest CCC when compared to MLR, RFR and SVR models. No significant differences in both RMSE and CCC were observed among MLR, RFR and SVR models. When using features selected by the VIF method, a similar result was obtained with the lowest RMSE and greatest CCC with the ANN model, which was significantly lower than those with RFR and SVR models. As RFR and SVR models had no improvement on the prediction accuracy of MLR model, a further evaluation was conducted by comparison of MLR versus ANN in relationships of residual plots (predicted–actual MN) against actual MN. The result is presented in Fig. 2. The ANN has a lower mean residual MN (0 vs. 25 kg/d) and a lower SD value (32.8 vs. 36.6) than the MLR. The majority of the plot data with the ANN model was evenly distributed around the y = 0 line (Fig. 2), but most of plot data with the MLR model was above that line. These results indicate that the ANN model could accurately predict MN excretion from dairy cows, while MLR, on average, overestimated MN excretion. This means that the ANN model was constructed successfully with a higher accuracy in the present study, when compared with the MLR model.

Table 1 Predictive performance of different modeling approaches for manure N output using stepwise and variance inflating factors (VIF) as feature selection methods.
Figure 2
figure 2

The relationship between actual and residual (predicted–actual) manure N output of dairy cows with predicted manure N performed by models developed using the multiple linear regression (MLR) and artificial neural network (ANN), respectively.

The ANN, RFR and SVR can be applied to approximate any complex functional relationship. These models have been applied in many studies in animal science to evaluate rumen fermentation pattern10, animal diet formulation20, and milk yield21. However, these models did not always perform better than MLR models. Chen et al.11 reported that ANN models had better performance in prediction of dairy cattle manure nutrient concentration when compared with MLR models, while Craninx et al.10 did not find that ANN models could perform better than MLR models in evaluation of relationships between rumen fermentation pattern and milk fatty acid profile. The RFR models had a higher prediction accuracy than MLR models in prediction of individual survival rates to the second lactation in Holstein dairy cows12. Hence, these results may indicate that the prediction performance of machine learning algorithms and MLR not only relates to their modelling power/capacity, but also depends on the nature of target data and relationships to be explored. Further investigation may need to explore the modelling potential of machine learning algorithms (e.g., ANN) for development of robust prediction models for mitigation of environmental footprint (e.g. MN excretion) in livestock production.

Development of ANN models for prediction of MN output of dairy cows

The comparison of prediction performance for MN output in dairy cows in the present study indicated that the ANN model performed significantly better than the MLR model and other machine learning models. Therefore, the second objective of the present study was to establish new ANN models for more accurate prediction of MN output from lactating dairy cows.

Artificial Neural Network model selection and turning

The ANN can provide universal and highly flexible function approximates for all kinds of data22. The ANN models have several factors, such as function adoption, network architecture and learning algorithms, and the application of these factors may affect the performance of ANN models. Once the features of ANN model are decided, architecture of network is determined mainly by artificial neurons numbers in the hidden layer. Therefore, selecting a suitable number of neurons in the hidden layer is important for ANN model development.

In the present study, in order to obtain the optimal architecture and parameters for development of ANN models, ANNs were trained by varying features, numbers of hidden layer(s) and neuron(s), training algorithms, learning rates and the threshold for partial derivatives of the error function as stopping criteria. A total of 39 ANN architectures were trained using the same features and various numbers of hidden layer(s) and numbers of neuron(s) in each hidden layer, with the objective to find the optimal number of hidden layer(s) and the corresponding neurons for each hidden layer (Table 2). As shown in Table 2, a change of numbers of hidden layers and neurons in each hidden layer greatly affected the performance of ANN models. One of the architectures with 2 hidden layers (3 and 6 neurons for the first and second layers, respectively) had the lowest RRMSE value. Therefore, the optimal architecture of the ANN model for prediction of MN in lactating dairy cows was a feed-forward network with 2 hidden layers, the first layer with 3, and the second one with 6 hidden neurons. Because there is no rule for the selection of numbers of hidden layer(s) and numbers of neuron(s) in the hidden layer, no similar results in terms of numbers of neuron(s) and hidden layer(s) were found in the published ANN models. For example, Craninx et al.10 developed an ANN model with one hidden layer and 6 hidden neurons for predicting rumen acetate, propionate and butyrate proportion. Felipe et al.23 used one hidden layer and 3 neurons in an ANN model for prediction of poultry egg production. In addition, Chen et al.11 found that the best ANN models for predicting of manure nutrient concentration were those which had one hidden layer with 7 hidden neurons for ammonium N, 12 for total potassium, 9 for total N and 8 for total phosphorus. Results obtained indicate that the process for selecting and obtaining the optimal configuration (consists of nodes in input layer, number of hidden layers and nodes in hidden layer/layers and nodes in output layer) is essential for the development of ANN models, although currently there is no standard approach for this process.

Table 2 Prediction accuracy of ANN model for predicting manure N output affected by network structure.

To obtain the optimal parameters for ANN models, in the present study, the RRMSE values were tested and compared using same features but different training algorithms, learning rate and threshold for the partial derivatives of the error function as stopping criteria (Table 3). As shown in Table 3, reducing learning rates and thresholds decreased RRMSE when ANN models were trained by both backpropagation and resilient backpropagation with weight backtracking algorithms. In the present study, the resilient backpropagation with weight backtracking algorithm was selected to train the final ANN model because backpropagation algorithm took too much longer time (single-digit minutes vs. more than one hour, data not shown) to train the ANN model than time required for the resilient backpropagation with weight backtracking algorithm. This is consistent with findings reported by Zhao et al.24 found that resilient back propagation algorithms took less time to train ANN model for prediction of soil texture distributions. Moreover, based on cross validation procedures, higher prediction accuracy (RMSE) was obtained by models trained with backpropagation algorithm. The results found that reducing values of multiplication factors for the upper and lower learning rate (defined by function learningrate.factor) decreased the RRMSE of the mean actual MN. However, the lower RRMSE (8.75%) were observed when turning the parameter of learningrate.factor as list (minus = 0.4, plus = 1.2), which was then selected as values of learningrate.factor in the training of models. The results indicate that although selection of training algorithms did not greatly improve the performance of ANN model, the time consumed for training the model was affected greatly, which needs to be considered in the turning operation.

Table 3 Turning of ANN models for manure N output with selected features.

Table 4 shows the predictive performance of ANN models affected by reduction of features with all tunable parameters setting to the same values. The NI was the most important feature among the 6 features as the RRMSE increased considerably from 8.48 to 12.6% when NI was excluded from the features list. It suggests that changes of model performance caused by reduction of features might use as an alternative tool for identifying important features. Although the prediction error of ANN model reduced when FP or DNC was excluded from the features, ANN models fitted with the 6 features selected based on the VIF technique had lower SD value, indicating that the ANN model fitted using the 6 features had lower prediction errors within the whole dataset from low to high range of MN excretion.

Table 4 Influence of features selected on the ANN model performance.

Turning operation can help to find optimal learning parameters for ANN model and achieve its best performance for a considered dataset and selection of learning rate has great influence on model performance25. In this study, however, only small performance gain is achieved by lower learning rate (Table 3). On the other hand, variation in features does not affect performance of model greatly (Table 4) when the most important feature was included in the features list. It implies that in general the ANN model is not critically sensitive to the variation in learning parameters.

New ANN models developed using the combined data

Since the above comparison indicates that the ANN model performed better than the MLR model, new ANN models for MN excretion for dairy cows were developed using the combined data of the present training and testing datasets. Two ANN prediction models were developed with the first one using NI as the primary predictor (Tables 5 and 6) and the second one using LW and MY as primary predictors (Tables 7 and 8) as NI data are not always available especially in commercial farms. The ANN model based on NI had 2 hidden layers with 3 neurons in the first layer, and 6 in the second layer. The input layer consists of NI, DNC, MY, FP, LW and DMEC. The optimized weights and biases are shown in Tables 5 and 6. The ANN model based on LW and MY had 2 hidden layers—the first layer with 4, and the second layer with 2 hidden neurons. The selected features were based on the domain knowledge and included LW, MY, DNC, CDMI and DMEC. The optimized weights and biases are shown in Tables 7 and 8. The prediction performances of these two new ANN models, through the cross validation technique, are given in Table 9. The two ANN models showed good predictive performance, with the R2 values in the relationships between actual and predicted MN being 0.83 and 0.79 for models based on NI and LW/MY, respectively, and the corresponding RRMSE was 10.9% and 12.1%, respectively, and the corresponding CCC was 0.76 and 0.70, respectively.

Table 5 Optimized weights of connections and biases of the input nodes to nodes on hidden layer one of ANN model using NI as the primary predictor based on the combined data of the present training and testing datasets.
Table 6 Optimized weights of connections of the nodes on hidden layer one to two and biases to nodes on hidden layer two and output node of ANN model using NI as the primary predictor based on the combined data of the present training and testing datasets.
Table 7 Optimized weights of connections and biases of the input nodes to nodes on hidden layer one of ANN model using LW and MY as primary predictors based on the combined data of the present training and testing datasets.
Table 8 Optimized weights of connections of the nodes on hidden layer 1 to 2 and biases to nodes on hidden layer 2 and output node of ANN model using LW and MY as primary predictors based on the combined data of the present training and testing datasets.
Table 9 Predictive performance of the ANN models for prediction of manure N output using the whole dataset.

Conclusions

The present study compared the prediction performance for manure N excretion of lactating dairy cows using models developed from the multiple linear regression against those from machine learning algorithms. The results indicate that artificial neural network model has better potential to explore animal and dietary factors which influence manure N excretion in lactating dairy cow when compared with the multiple linear regression approach. A hybrid knowledge-based and data driven approach for artificial neural network model was developed and implemented to selecting features in this study. Results indicate that the resilient backpropagation with weight backtracking algorithm is better than backpropagation algorithm for model training. The optimal network using NI as primary predictors to predict manure N excretion in lactating dairy cows was a feed-forward network with 6 input nodes, 2 hidden layers (the first layer with 3, and the second one with 6 hidden neurons). The alternative network using LW and MY as primary predictors to predict manure N excretion from dairy farm was a feed-forward network with 5 input nodes, 2 hidden layers (the first layer with 4, and the second one with 2 hidden neurons). While currently there is no standard approach to determine optimal set of parameters for those learning parameters in advance, results obtained indicate that the ANN models developed are not critically sensitive to the variation in learning parameters setting. Consequently, two artificial neural network models for prediction of manure N excretion of dairy cows were developed using either N intake or live weight and milk yield as primary explanatory variables. These models provide a novel and useful tool for prediction and mitigation of manure N excretion of dairy cows under typical farming condition managed within grassland-based dairy systems.

Materials and methods

All the experiments were conducted at the Agri-Food and Biosciences Institute (AFBI) farm at Hillsborough, County Down, UK. All the experiments and procedures complied with the requirements of the UK Animals (Scientific Procedures) Act 1986 and were approved by the AFBI Hillsborough Ethical Review Group. All the experiments were performed in accordance with relevant guidelines and regulations (following the ARRIVE guidelines26).

Data description

Data used were collated from 43 total diet digestibility studies with 951 lactating dairy cows undertaken at Agri-Food and Biosciences Institute in Northern Ireland over a period of 26 years (1990–2015). The data from studies undertaken between 1990 and 2002 were used as the training dataset (n = 564) and undertaken between 2005 and 2015 as the testing dataset (n = 387). The training data were used to develop prediction models for MN using MLR and the three selected machine learning algorithms (ANN, RFR and SVR). These new models were then tested for their predictive performance using the training dataset by tenfold cross validation. The testing dataset were used for the independent evaluation and comparison of predictive ability of different modeling approaches. The information of the two datasets on numbers of experiments, cow genotypes and forage types offered are presented in Table 10. Data on live weight, milk production, feed intake, N intake and outputs are presented in Table 11. The datasets used in the present study showed a various cow genetic merit and a broad range in LW (379–781 kg), MY (5.1–40.2 kg/d), total dry matter intake (7.54–26.6 kg/d), FP (0.21–1.00%), DNC (19.0–38.0 g/kg DM), diet metabolizable energy concentration (DMEC, 9.68–19.4 MJ/kg DM) and NI (155–874 g/d), which represents typical dairy production conditions managed within grassland-based dairy systems in the West and North Europe.

Table 10 Information on experiment, animal and forage types in the training and testing datasets of dairy cows used in the present study.
Table 11 Descriptive statistics of animal, dietary and nitrogen utilization variables in the present study.

Digestibility measurements

Cows were housed in free-stall cubicle accommodation for at least 20 d before commencing digestibility trials in metabolism units for 8 d with feed intake, milk production and feces and urine collected during the final 6 d. Throughout the whole experiment, cows were offered experimental diets ad libitum and had free access to water. During the final 6 d, the following measurements for each individual cows were carried out to generate total digestibility data used in the present study. Forages and concentrates offered and refused were recorded daily and sampled for analysis of feed dry matter (DM), N concentration and forage proportion. Feces and urine outputs were collected daily and sampled for DM (feces only) and N concentration. Milk yield was recorded daily and sampled for analysis fat, protein and lactose concentrations. Live weight was measured on the first and last days in the metabolism unit. Details in feed intake, feces and urine collection and methods used for analysis of feed, feces, urine and milk samples were described by Yan et al.6.

Data preprocessing

Normalization of input data for ANN model

Because features (variables) in raw data may have different dynamic ranges, which may result in poor model performance, it is recommended to normalize them to make ANN training more efficient by performing normalization process for the raw inputs10. In the present study, all the input data for ANN models were normalized into the interval [0, 1] by performing Min–Max normalization technique27 using Eq. (1):

$$X_{norm} = \frac{{X {-} X_{min} }}{{X_{max} - X_{min} }}$$
(1)

where Xnorm or X is the normalized or original value, Xmin or Xmax is the minimum or maximum values of the input data.

After finding the optimal tuning parameter, all normalized data for MN obtained by ANN models were denormalized into their original scale using Eq. (2) 27:

$$Y = Y_{norm} * \, \left( {Y_{max} - \, Y_{min} } \right) \, + \, Y_{min}$$
(2)

where Ynorm or Y is the normalized or demoralized value, Ymin or Ymax is the minimum or maximum values of the output data.

Knowledge-based and data driven feature selection

Feature selection is an essential step during development of models, which can hugely impact the generalization and predictive ability of models10,28. In the present study, a hybrid knowledge-based and data driven approach was developed and implemented to selecting features. Knowledge in animal science and the process of digestibility trial were applied to diagnosing and removing irrelevant features before the implementing of data driven feature selection process. For instance, the features of feces N output (FN) and urine N output (UN) were excluded from the set of features in present study according to prior background and expert knowledge. Because the data of UN and FN were obtained from analyzing urine and feces samples and then they were summed up and treated as new feature MN, both FN and UN are heavily correlated with MN. Their inclusion in the features list might cause poor generalization performance of the models. Furthermore, the optimal features selected from data driven approach may need to be diagnosed based on background knowledge in animal science according to the scenarios of model application. For instance, several variables (e.g. NI and FP) included in datasets used in this study may not be available in commercial farms. Therefore, alternative feature (concentrate dry matte intake, CDMI) was selected and included into the feature list in this study based on the domain knowledge and then new ANN model suits for commercial farms was developed.

The filter method was applied for feature selection using the Pearson correlation matrix and variance inflation factor (VIF) technique. The first step was to use the Pearson correlation matrix to identify features which might correlate each other for prediction of MN excretion, because using correlated features in models could influence performance of these models with a biased outcome. If two features were heavily correlated, the less important one was removed from the set of features to minimize adverse effects on model performance. Afterwards, the VIF analysis was applied to detect multicollinearity, which has been widely used as a measure of the degree of multicollinearity among input features. A VIF score was calculated for each feature and those with high values were removed. The threshold score for the VIF analysis was 5 and features with a VIF score below this threshold were selected. The VIF score was computed by VIF function in R29.

Modelling and analysis using the training dataset

In the present study, four models based on the MLR ANN, RFR and SVR were developed using the training dataset and these new models were tested using the testing dataset for comparison of their prediction performance for MN outputs in lactating dairy cows (presented later). The MLR with the stepwise procedure for selection of independent variables was used as benchmark model since it is a well-known technique and has been applied for modelling in a wide range of applications in animal science research. Alternative modeling approaches proposed in the present study were ANN, RFR and SVR. To compare the performance, models developed with different approaches and ensure that the same resampling sets were used between calls, the same random number seeds were set prior to perform the process of training, fitting and testing models. All statistical analyses were performed with R29.

Multiple linear regression

The MLR model (Eq. 3) selected in the present study for the prediction of MN output was published in 20066 which was developed using the same training dataset listed in Table 2. To improve the estimation of the regression parameters, experiment was included as a random factor during the development of MLR model. The dataset had a large range within each dependent or independent variable, e.g., MN, NI, LW, MY, FP and DNC, which is vital to ensure the development of robust regression model applicable under various farming conditions10.

$${\text{MN }}\left( {{\text{g}}/{\text{d}}} \right) \, = \, 0.{\text{749 NI }} + \, 0.0{\text{65 LW }}{-}{ 1}.{\text{515 MY }}{-}{ 17}.0$$
(3)

where NI, LW and MY are N intake (g/d), live weight (kg) and milk yield (kg/d), respectively.

Artificial neural networks

In the present study, ANN was fitted using R package neuralnet which was built to train neural networks in the context of regression analyses. The details of ANN training and application of neuralnet were described by Günther and Fritsch30. Multilayer perceptron networks trained with backpropagation learning algorithms were used and consist of an input layer, hidden layer(s) and an output layer. The input variables were obtained by using the feature selection algorithm described in the section ‘Knowledge-based and data driven feature selection’, and the neuron in output layer represents MN. The ANN models were trained based on the selection of training algorithms and learning parameters including the number of hidden layer(s), number of neurons in hidden layer(s), error function, threshold for partial derivatives of the error function as stopping criteria, and activation function etc.. The optimized number of hidden layer(s), number of neuron(s) in the hidden layer(s), learning algorithms, learning rate and other learning parameters were obtained on the basis of prediction performance measured as relative root mean square error (RRMSE, Eq. 6) with tenfold cross validation and then the best topology/architecture was finalized.

Random forest regression

The RFR is an ensemble machine learning method and a nonparametric technique derived from classification and regression trees which are constructed using a bootstrap aggregating (bagging) method from the training data31. In RFR, prediction is conducted by averaging the individual tree predictions. A detailed description of RFR theory can be found in the report by Breiman32. The RFR was implemented by the randomForest function in the R package (version 3.6.1). To select the optimal hyperparameters for learning algorithm, tuning process was performed based on the R package ranger. The hyperparameters include number of trees to grow (ntree), number of randomly drawn candidate variables (mtry), sample size and node size. Grid search strategy was used to choose the candidate hyperparameter values and the performances of the trained algorithm with different values of the hyperparameters were evaluated as RRMSE (Eq. 6) by using tenfold cross validation.

Support vector regression

The SVR uses similar principles as support vector machine, a supervised non-parametrical statistical learning technique that uses the kernel functions and the maximum margin algorithm to solve the nonlinear problem33. The detailed theoretical background and description of SVR can be found in the report by Cristianini and Shawe-Taylor34. The SVR model performs the regression estimation by risk minimization where the risk is measured by a loss function. In this study, R package e1071 was used and the svm function was implemented to fit SVR model. The radial basis kernels function, the most commonly used kernels types, was employed in training and predicting process. Parameter tuning was performed by using grid search over supplied parameter ranges and the best combination of parameters (lowest RMSE) were selected. The performance of SVR model was measured as RRMSE (Eq. 6) with tenfold cross validation.

Criteria selected to access model prediction performance

The MLR model and the three new models (ANN, RFR and SVR) was developed and compared in terms of their prediction performance for MN outputs in lactating dairy cows based on the datasets listed in Table 2. The predictive performance of models were evaluated using coefficient of determination (R2), root mean square error (RMSE), relative root mean square error (RRMSE) and concordance correlation coefficient (CCC), based on the actual and predicted values. The R2 was calculated using Eq. (4). The RMSE and RRMSE were produced in a tenfold cross validation process (10 RMSE data generated) using Eq. (5)35 and Eq. (6)36, respectively. The concordance correlation coefficient (CCC), a further measure of the agreement between observed and predicted values, was given by Eq. (7)37. The tenfold cross validation was used to evaluate prediction performance of these models (MLR, ANN, RFR and SVR)The obtained RMSE, RRMSE and CCC values (n = 10) through the tenfold cross validation were compared among the 4 models using one-way analysis of variance and then followed by Tukey’s honest significant difference (HSD) test (α = 0.05). The same cross validation folds were used for all modeling scenarios to compare cross all of the models performance.

$$R^{2} = 1 - \frac{{\sum \left( {y_{i} - \hat{y}} \right)^{2} }}{{\sum \left( {y_{i} - \overline{y}} \right)^{2} }}$$
(4)
$$RMSE = \sqrt { \frac{1}{n}\mathop \sum \limits_{i = 1}^{n} \left( {y_{i} - \hat{y}} \right)^{2} }$$
(5)
$$RRMSE = (RMSE/\overline{y}) \times \, 100$$
(6)
$$CCC = \frac{{2 \cdot \,r \cdot \,S_{{\widehat{y}}} \cdot\,S_{y} }}{{S_{{\widehat{y}}}^{2} + S_{y}^{2} + \left( {\mathop \sum \nolimits_{i = 1}^{n} \frac{{\left( {y_{i} - \widehat{y}} \right)}}{n}} \right)^{2} }}$$
(7)

where \(y_{i}\) is actual MN, \(\widehat{{y_{i} }}\) is predicted MN, \(\overline{y}\) is the mean of actual MN and n is the number of observations, r is the Pearson correlation coefficient between \(\widehat{{y_{i} }}\) and \(\overline{y}\), \(S_{{\hat{y}}}\) and \(S_{y}\) are the respective standard divisions.