4.1. Model Performances
This study investigated the suitability of MIR spectral data for the prediction of bovine clinical mastitis and clinical ketosis with different methods, as well as various milk components, and outlined particularly relevant wavelengths for predictions, respectively.
As was to be expected, the prediction models for various milk components obtained substantially higher accuracies (
Table 2) than the developed models for mastitis and ketosis prediction. This is due to the fact, that prediction models were developed based on values for milk components, which were already determined based on spectral data in the framework of the Austrian milk recording system. Moreover, fat%, protein%, and lactose% exhibit typically high predictability based on MIR spectral data, as substantiated by relevant studies [
60,
61,
62]. The prediction of urea content in milk was not as precise as the remaining three milk components, which is congruent with Melfsen et al. [
62], who reported R
2 values of 0.998 for fat%, 0.94 for protein%, 0.73 for lactose%, and 0.31 for urea in mg/L.
The models for prediction of clinical mastitis were least precise in the present study (
Table 3), with AUC values ranging from 0.612 to 0.641 across different statistical methods. According to the definition from Simundic [
52], this complies to a sufficient diagnostic accuracy. A recent study of Rienesl et al. [
27] outlined better results for all accuracy parameters for the same ±21-day time window and predictions based on MIR spectra; however, they utilized a preselection of days in milk corrected spectral variables and additional fixed effects (parity, breed). Sensitivities and specificities reported from Dale et al. [
26] were considerably better than those presented in this study as well, which is attributable to a days in milk correction, 212 selected MIR variables, and, most importantly, by a definition of the mastitis event deviating substantially from that of the current study.
Evaluation of the four different methods applied for mastitis prediction regarding accuracies in this study indicates that LASSO and SVM are suited best for mastitis prediction with AUCs greater than 0.640. Particularly noticeable is that SVM was best on the calibration dataset, highlighting its capability of a more flexible classification procedure due to using radial kernels [
45]. The LASSO algorithm providing an automatically implemented feature selection approach and achieving best model accuracies highlights the importance of variable selection for model development. All methods obtained considerable higher validation specificities (0.597–0.653) than sensitivities (0.525–0.567). This is reasonable, as mastitis cases in this study were defined based on veterinarian diagnosis solely, which appears to be a limitation in this context. Mastitis cases which were not treated by a veterinarian, and hence, not recorded in the GMON system, are surely present in the data. The developed prediction models potentially labeled these undetected mastitis events as mastitis cases, whereas they were identified as healthy in the dataset, leading to a sensitivity decrease in the prediction models. By defining mastitis and healthy cases based on clinical assessment, such restraints could be prevented to a great extent. In this study, different methods showed significant differences in model performance of mastitis prediction. However, comparing results with pertinent studies reveals that input variables have a greater impact than applied methods, which is consistent with Young et al. [
63].
The prediction models reported for clinical ketosis (
Table 4) in the actual work were noticeably better in model performance than those for mastitis, yet not as precise as milk component prediction models. Considering Simundic’s [
52] definition, all four applied methods attained very good diagnostic accuracy, as AUC values were in the range from 0.856 to 0.877. As far as comparable literature is concerned, nearly no literature exists on the detection of clinical ketosis directly via MIR spectral data. Most studies determined subclinical ketosis risk based indirectly on MIR spectra through consideration of specific components (e.g., ketone bodies) being predicted based on MIR spectral data [
16,
31]. De Roos et al. [
31] outlined higher specificities and lower sensitivities, while sensitivities and specificities reported by van Knegsel et al. [
16] were both greater and lower depending on the definition of subclinical ketosis. To our knowledge, KetoMIR2 is the only reference also predicting clinical ketosis considering MIR spectra directly [
32]. However, it has to be taken into consideration that KetoMIR2 was developed on 212 selected MIR spectral variables, and time windows were divergent to the ±21-day window in the current model (±14 days for ketosis, ±60 days for healthy) and included only cows during 5 to 120 days in milk. Sensitivity from KetoMIR2 was worse (0.72) than in the present ketosis prediction models, which is quite noteworthy. The stricter definition based on the ±14-day time window in that study would suggest possibly more precise predictions. Even though specificity (0.84) was better, balanced accuracy from KetoMIR2 was consistently lower than in all four ketosis prediction methods applied in the actual study. In previously quoted studies, observed sensitivities and specificities were not as balanced in contrast to present results. This may underline advantageous model development in this study, for instance finetuning of parameters or ketosis definition.
When comparing the four methods for ketosis prediction concerning model performance, it can be inferred that all four methods are able to predict clinical ketosis events at a proficient level. RF is the least promising, while the remaining three methods achieve nearly equal balanced accuracies in validation. LASSO obtained the best results for all accuracy indicators, in turn emphasizing the importance of feature selection. More considerable differences across all accuracy parameters were noticed in calibration, demonstrating varying capabilities of respective methods to adapt their calibration procedure to an individual dataset. Based on model accuracies, detection of clinical ketosis via MIR spectral data is very promising.
4.2. Selected MIR Spectral Variables
The evaluation of selected MIR spectral variables across various traits (
Figure 2) highlighted that for each individual trait distinct wavelengths were of special importance. Therefore, MIR spectral regions carry individual information, potentially providing insights concerning certain traits corresponding to dairy cows.
The present study included all 1056 first-derivative MIR spectra as input variables in the prediction models and intentionally renounced variable preselection. This was done to potentially detect information carrying spectral regions also outside the commonly known informative regions. These regions are declared as water diluted, noisy, not ideally reproducible, or lacking relevant information, and therefore, often not included in developed models: 925 to 960 cm
−1 [
33], 1600 to 2800 cm
−1 [
33,
35], and 3000 to 5000 cm
−1 [
1,
33]. In fact, this study detected important regions for various traits in these areas, as visualized in
Figure 2,
Figure 3 and
Figure 4, implying that information is also available in these parts of the spectrum. One reason why other studies did not report information in these areas of the spectra might be that VIP analysis was not applied on the entire MIR variable set [
10,
34,
64]. They precluded certain regions due to water absorption or low reproducibility across spectrometers already in advance, so they did not even search for information in these areas. There is also not much relevant literature having tested variable importance regarding specific characteristics (e.g., mastitis or ketosis) explicitly, but rather determined informative regions from a chemical or technical point of view [
33]. When evaluating different methods, it becomes obvious that PLS-DA was the only method not selecting a wavelength in the part of the spectra above 3922.5 cm
−1. Especially LASSO and SVM assigned importance to several regions in this upper part of the spectra for ketosis and mastitis. This suggests that LASSO and SVM are able to find information in noisy regions, while PLS-DA cannot utilize these areas due to dilution, as also outlined by Andersen et al. [
35]. Nevertheless, the results confirm that the predominant proportion of wavelengths carrying relevant information are located within the commonly recommended areas by Grelet et al. [
33]. Hence, the results of the present study imply that studies aiming to predict certain traits for dairy cows, including mastitis and ketosis, should include spectral regions that go beyond the recommended ones by Grelet et al. [
33], as relevant information is available there as well. In addition, variable selection analysis can be beneficial to identify a subset of selected spectral regions for final prediction models.
For the determination of all four milk components (fat%, protein%, lactose%, urea), the region containing most informative wavelengths was identified from 948.81 to 2992.98 cm
−1 (
Figure 2). This is basically consistent with relevant literature, suggesting uninformative regions above 3000 cm
−1 [
1,
33].
VIP analyses for mastitis in this study demonstrated that important wavelengths are rather spread across the entire spectral range from 925.66 to 4909.88 cm
−1 (
Figure 3). This highlights the presence of information on mastitis outside commonly known spectral areas. However, conformances between 1% and also 10% most important variables of each method were quite low (
Table 5), which could possibly indicate a limited availability of information on mastitis in the MIR spectra. Moreover, it implies that applying just one procedure for VIP analysis would not attain sufficient results, as outlined by Zhang et al. [
34].
In
Table 7, an overview of 23 particularly important wavelengths for mastitis prediction is provided. All these wavelengths were assigned with high relevance by at least three methods. Considering which methods tended to choose which wavelengths, it was noticeable that LASSO diverged most from the other methods. This algorithm tended to choose only one variable out of a cohesive spectral region, while the remaining three methods assigned importance to each of the wavelengths. For instance, four wavelengths from 1068.37 to 1079.94 cm
−1 were all indicated as important by PLS-DA, SVM, and RF, while LASSO only selected 1072.23 cm
−1. This limitation of LASSO has already been confirmed in the literature several times [
57,
65]. Taking this into account, the relevance of the 23 selected variables for mastitis prediction receives further substantiation.
Several studies already reported the connection between certain chemical bonds and corresponding MIR spectral wavelengths [
37,
68,
69]. For instance, certain wavelengths identified as particularly important for mastitis prediction (
Table 7) were already assigned to specific chemical bonds corresponding to lactose, carbohydrates, casein, phospholipids, triglycerides, lipids, water, and melatonin. For more detailed information concerning chemical bonds found at the respective wavelengths, we refer the reader to certain references listed in
Table 7. Particularly interesting are the identified regions potentially being assigned to casein contents of milk (1068.37–1079.94 cm
−1, 1234.22 cm
−1), as a decrease in casein amount in milk is an indicator for mastitis [
73]. A recent study conducted by Huang et al. [
74] highlighted the usefulness of sodium and chloride contents in milk for detection of mastitis cases in dairy cows. The literature already outlined that molecules containing sodium chloride can be assigned to MIR spectra regions between 3150 and 3400 cm
−1 and specifically outlined 3357 cm
−1 and 3341 cm
−1 [
72]. This leads to the assumption that the wavelengths identified as particularly important in this region (3255.25 cm
−1, 3340.1 cm
−1, 3347.82 cm
−1, 3359.39 cm
−1) might represent the elevated sodium chloride content in milk from cows suffering from mastitis.
The evaluation of VIP analyses for ketosis in the present work showed that 10% of relevant wavelengths tended to be distributed in two principal areas: 925.66 to 2055.75 cm
−1 and 2703.71 to 4967.73 cm
−1 (
Figure 4). Hence, it can be deduced that the region in between does not contain information on ketosis, which is reasonable, as this range of the spectra shows water absorption. Yet, it is also evident that information for ketosis is present in the noisy area. When contrasting selected regions concerning methods, it is interesting to see that PLS-DA, RF, and SVM tended to select more similar MIR spectral variables, while LASSO had substantially lower pairwise conformity of the selected wavelengths with the rest of the methods. Previously discussed reasons, such as avoidance of selection of neighboring spectra positions by LASSO, may hold here as well. Moreover, high conformance results (
Table 6) indicate that important regions were not just selected randomly, and thus, information on clinical ketosis exists in the MIR spectrum.
Table 8 lists certain regions of the MIR spectra which were identified as particular important for the prediction of clinical ketosis (concomitantly selected by at least three methods). When comparing these outlined regions with the preselected regions Hansen [
30] used for ketosis prediction, it shows that 56 out of the 61 selected wavelengths were located within the region from Hansen, providing an underpinning of these important variables. The fact that most of them are consecutive wavelengths is particularly considerable and strengthens their importance moreover. Here, again, it becomes obvious that LASSO did not choose every variable out of a correlated subgroup of spectra.
Other studies, as referenced in
Table 8, already outlined which chemical bonds can be connected to which wavelengths. In this case, wavelengths reported as particularly relevant for ketosis prediction were attributed with chemical bonds originating from lactose, phospholipids, carbohydrates, proteins, amide, whey protein, melatonin, triglycerides, water, or casein. Concerning further information on detailed chemical bonds corresponding to detected important wavelengths for ketosis studies referenced in
Table 8 can be insightful. One specific research found wavelength 1284.36 cm
−1 to be of particular importance for the prediction of cows’ body weight [
34]. Wavenumber 1284.36 cm
−1 can be assigned to carbohydrates, which may suggest a potential connection in this context to a cows’ energy metabolism, as both ketosis and body weight are associated with that as well. Van Haelst et al. [
75] discovered elevated concentrations of oleic acid (C:18
cis-9) in dairy cows milk indicate ketosis risk. Oleic acid can be assigned to certain spectra peaks, such as 2850 cm
−1 [
76]. As 2850.27 cm
−1 was identified as particularly important for ketosis prediction in this study, this connection could be highlighted. It is also worth considering that wavelengths reported to contain information on ketone bodies [
30,
31,
77] were not considered as particularly important in this study. This could be due to the fact that this work considered clinical ketosis diagnoses, so that cows suffering from subclinical ketosis were commonly among the cows labeled as healthy, which, thus, led to ketone bodies not assisting in discrimination.