To main content

Data-driven monitoring of subclinical mastitis in Norwegian dairy cattle using machine learning and modeling

Abstract

Subclinical mastitis (SCM) remains a major challenge in dairy herd management due to its subtle presentation and significant impact on milk production, milk quality, and animal health. The increased use of automatic milking systems (AMS) has made it possible to obtain measurements from several milking traits from every milking, offering new opportunities for earlier and more accurate detection of udder infections. However, the complexity of the data and the lack of a uniformly accepted definition of SCM complicate its monitoring and management. This thesis addresses these challenges through three interconnected studies. First, AMS data were investigated together with bacteriological culture from milk samples to characterize how different mastitis pathogens influence milking traits. The results showed that online cell count (OCC) was most strongly associated with positive bacteriological cultures, particularly for Staphylococcus aureus and Streptococcus dysgalactiae. While electrical conductivity (EC) did not show significant associations, increased variability was observed with positive bacteriological cultures. This indicates that the trait may provide additional information about infection and could be of interest for future predictive modeling when used in combination with OCC. Building on these insights, machine learning (ML) was used to predict SCM using AMS data, specifically Bayesian Generalized Nonlinear Models (BGNLMs). The target variable was derived from multiple diagnostic tests, and the models were trained using customized functions that explicitly accounted for the sensitivity and specificity of each test. By modeling infection status as a latent variable and incorporating diagnostic uncertainty, these models produced reliable predictions from data with an imperfect target and demonstrated strong performance in both real and simulated datasets. Finally, ML-based predictions were incorporated into within-herd dynamic susceptible-infectious-susceptible (SIS) models to study the transmission dynamics of infection. The models were compared against models using case definitions of SCM based on traditional OCC thresholds. The results showed that the choice of case definition significantly affected estimated transmission parameters, cure rates, and predicted infection trajectories, with ML-based definitions generally offering a better fit to observed herd data and more dynamic disease representations. Taken together, this thesis demonstrates the potential of leveraging AMS data when combined with ML and dynamic modeling for improved detection and monitoring of SCM. The findings underscore the importance of robust model validation, careful definition of infection status, and continued collaboration among researchers, veterinarians, and producers to fully realize the benefits of data-driven herd management.
Read the publication

Category

Doctoral thesis

Language

English

Author(s)

  • Charlott Kjærre Olofsson
  • Ingrid Toftaker
  • Camilla Kielland
  • Amira Rachah

Affiliation

  • SINTEF Industry / Sustainable Energy Technology
  • Norwegian University of Life Sciences

Year

2026

Publisher

Norges miljø- og biovitenskapelige universitet (NMBU)

Issue

2026:53

ISBN

9788257523725

View this publication at Norwegian Research Information Repository