Technical note: Random forests prediction of daily eating time of dairy cows from 3-dimensional accelerometer and radiofrequency identification

Research output: Contribution to journal/Conference contribution in journal/Contribution to newspaperJournal articleResearchpeer-review


Feed intake and time spent eating at the feed bunk are important predictors of dairy cows’ productivity and animal welfare, and deviations from normal eating behavior may indicate sub-clinical or clinical disease. In the current study, we developed a random forests algorithm for the prediction of dairy cows’ daily eating time (of a total mixed ration from a common feed bunk) using data from a 3-dimensional accelerometer and a radio frequency identification (RFID) prototype device (logger) mounted on a neck collar. Models were trained on continuous focal animal observations from a total of 24 video recordings of 18 dairy cows at the Danish Cattle Research Centre. Each session lasted from 21 to 48 hours. The models included both the present time signal and observations a number of seconds back in time (lag-window). These time-lagged signals were included with the purpose of capturing changes over time. Due to the high costs of installing an RFID antenna in the feed bunk, we also investigated a model based solely on the 3-dimensional accelerometer data. Furthermore, in order to address the trade-off between prediction accuracy and reduced model complexity and its implications for battery longevity, we investigated the importance of inclusion of observations back in time using lag-window sizes between 8 and 128 seconds. Performance was evaluated by internal leave-one-cow-out cross-validation. The results indicate that we obtain accurate predictions of daily eating time. For the most complex model (a lag-window size of 128 seconds), the median of the balanced accuracy was 0.95 (interquartile interval: 0.93 to 0.96), and the median daily eating time deviation was 7 minutes and 37 seconds (interquartile interval: -6 to 15 minutes). The median of the average daily eating time during sessions was 3 h 41 min with an interquartile interval of 2 h 56 min to 4 h 16 min. Exclusion of RFID data resulted in a considerable drop in the prediction accuracy, mainly due to a decreased sensitivity of locating the cow at the feed bunk (median balanced accuracy of 0.87 at a lag-window size of 128 seconds). On the other hand, prediction accuracy only slightly decreased with decreasing lag-window size (median balanced accuracy of 0.94 at a lag-window size of 8 seconds). We suggest a lag-window size of 64 seconds for the further development of the prototype logger. The methodology presented in this paper may be relevant for future automatic recordings of eating behavior in commercial dairy herds.

Original languageEnglish
JournalJournal of Dairy Science
Pages (from-to)6271–6275
Publication statusPublished - Jul 2020

    Research areas

  • accelerometer, dairy cow eating time, radiofrequency identification, random forests prediction

See relations at Aarhus University Citationformats


ID: 185888170