Event Abstract

Can we use k-nearest neighbors classifier to detect patterns in animal behavior associated with changes in metritis status in dairy cattle during postpartum?

  • 1 Center for Animal Disease Modeling and Surveillance, School of Veterinary Medicine, University of California, Davis, United States
  • 2 Department of Statistics, University of California, Davis, United States
  • 3 Department of Animal and Food Sciences, College Of Agriculture, Food And Environment, University of Kentucky, United States
  • 4 Department of Animal Sciences, College of Agricultural Sciences, Colorado State University, United States

In the dairy industry, the use of biosensors has recently been focusing on the quantification of animal behaviors and milk components, and their potential for disease diagnosis (Wathes et al., 2008, Bikker et al., 2014, Borchers et al., 2016). In dairy cows, transition period around parturition is considered the time when most of the diseases occur due to metabolic changes and negative energy balance (Esposito et al., 2014). Whether the combination of different biosensors can better diagnose diseases during the days following parturition, their sensitivity and specificity in order to create valid alarms, or how far in advance they can detect diseases is not known. The objective of the present study is to determine how k-nearest neighbors (k-NN) classification algorithm performs when trying to detect different patterns in animal behavior that are associated with changes in metritis score throughout post-partum. Materials and methods: A total of 33 dairy cows that either did not experienced any disease postpartum or were only affected by metritis were retrospectively selected from a dataset including 138 cows. Information per cow included hourly cow behaviors measured from day 0 to day 21 postpartum with two different devices used in precision farming. Device number 1 measured time spent ruminating, time spent eating, and activity level. Device number 2 measured lying time, number of lying bouts, number of steps, intake time, and number of visits to feed bunk. The collected data also included the individual metritis scores (1 to 3), assigned after inspections of the uterine discharge on days 3, 5, 7, 9, 11, 14, 17, 19, and 21, with metritis being score 2 or higher. For any given cow, a metritis event was assigned when the metritis score increased, changed from 3 to 2, or when the score remained 2 or 3, between two consecutive uterine discharge evaluations. Similarly, for any given cow, a non-metritis event was assigned when the metritis score decreased to 1, or when the score remained as 1, between two consecutive uterine discharge evaluations. A k-NN classification algorithm was used on the behavior variables from the day prior to an event up to 5 days prior to an event. Furthermore, k-NN was also used on the sensor measurements when the hourly measurement were aggregated every 3, 6, 12, and 24 hours. To determine the optimal parameter, a grid search was performed using fivefold cross-validation using values that ranged from 1 to 15. The optimum number of neighbors obtained for device 1 were 8, while the optimum number of neighbors for device 2 where 10. Models were evaluated using the estimates of precision, recall, and F-score obtained by fivefold cross-validation. All statistical analyses were conducted using Python programming language, version 2.7 (Python Software Foundation). Results: A total of 228 valid events were used for the analysis. Out of these, 187 were non-metritis events, while 41 were metritis events. Number of hourly records obtained with device 1 were 11,530. Number of hourly records obtained with device 2 went from 10,874 for the variable intake time to 14,138 for lying time and lying bouts. With separate classification analysis per behavior variable and time aggregation for the sensor measurements, different results were obtained depending of the device used. For device 1, all 5 behavior variables had a maximum F-score that varied between 0.72 and 0.74 when hourly sensor data was aggregated every 3, 6, and 12 hours. These values were obtained when the sensor data taken into account was restricted to the day prior to an event, with the exception of variable active, which was observed when the data from the 2 days prior to an event was considered, and for the variable high activity, which was observed when the data taken into account was from either the 2 days prior to an event, or the 4 days prior to an event (Figure 1). For device 2, for the variables lying, lying bouts, number of steps, and intake, the maximum F-score was between 0.71 and 0.73, while the highest F-score obtained for intake visit was slightly lower (0.69). These values were obtained when hourly sensor data were aggregated every 24 hours and when the 2 days prior to an event were taken into account (Figure 2). Conclusion: k-NN is a valid method to determine different patterns in dairy cow behaviors up to 2 days prior to a change in metritis status. Higher F-scores were obtained in variables measured with device 1 when compared with device 2, being the variables eating, not active, active, and number of steps the ones with the highest values. Classification methods such as k-NN provide real-time measurements compared with traditional methods of disease diagnosis. Therefore, this approach can be considered for data preprocessing prior to more complex prediction models used in syndromic surveillance for early detection of diseases through sensor technologies used in precision farming. Similar analyses will be explored using other behavior variables for their association with other syndromes, such as fatty liver or immunosuppression in dairy cattle.

Figure 1
Figure 2

Acknowledgements

Jeffrey Bewley and Coldstream Dairy, University of Kentucky for data collection.

References

Bikker JP, van Laar H, Rump P, Doorenbos J, van Meurs K, Griffioen GM, Dijkstra J. Technical note: Evaluation of an ear-attached movement sensor to record cow feeding behavior and activity. Journal of Dairy Science (2014) 97:2974-2979. Borchers MR, Chang YM, Tsai IC, Wadsworth BA, Bewley JM. A validation of technologies monitoring dairy cow feeding, ruminating, and lying behaviors. Journal of Dairy Science (2016) 99:7458-7466. Esposito G, Irons PC, Webb EC, Chapwanya A. Interactions between negative energy balance, metabolic diseases, uterine health and immune response in transition dairy cows. Anim Reprod Sci. (2014) Jan 30;144(3-4):60-71. Wathes CM, Kristensen HH, Aerts JM, Berckmans. Is precision livestock farming an engineer’s daydream or nightmare, an animal’s friend or foe, and a farmer’s panacea or pitfall? Computers and Electronics in Agriculture (2008) 64:2-10.

Keywords: Syndromic surveillance, Classification algorithm, machine learning, dairy cattle, Real-time monitoring, Risk-based approach, Precision farming

Conference: GeoVet 2019. Novel spatio-temporal approaches in the era of Big Data, Davis, United States, 8 Oct - 10 Oct, 2019.

Presentation Type: Student Poster-session

Topic: Emerging GIS, data science and sensor technologies adapted to animal, plant and human health, including precision medicine and precision farming

Citation: Vidal G, Sharpnack J, Tsai I, Lee AR, Pinedo P and Martínez-López B (2019). Can we use k-nearest neighbors classifier to detect patterns in animal behavior associated with changes in metritis status in dairy cattle during postpartum?. Front. Vet. Sci. Conference Abstract: GeoVet 2019. Novel spatio-temporal approaches in the era of Big Data. doi: 10.3389/conf.fvets.2019.05.00008

Copyright: The abstracts in this collection have not been subject to any Frontiers peer review or checks, and are not endorsed by Frontiers. They are made available through the Frontiers publishing platform as a service to conference organizers and presenters.

The copyright in the individual abstracts is owned by the author of each abstract or his/her employer unless otherwise stated.

Each abstract, as well as the collection of abstracts, are published under a Creative Commons CC-BY 4.0 (attribution) licence (https://creativecommons.org/licenses/by/4.0/) and may thus be reproduced, translated, adapted and be the subject of derivative works provided the authors and Frontiers are attributed.

For Frontiers’ terms and conditions please see https://www.frontiersin.org/legal/terms-and-conditions.

Received: 28 Aug 2019; Published Online: 27 Sep 2019.

* Correspondence: Mx. Gema Vidal, Center for Animal Disease Modeling and Surveillance, School of Veterinary Medicine, University of California, Davis, Davis, California, CA 95616-5270, United States, gemavidal78@gmail.com