A machine learning approach reveals that spore levels in organic bulk tank milk are dependent on farm characteristics and meteorological factors
Authors: Qian Chenhao , Lee Renee T. , Weachock Rachel L. , Wiedmann Martin , Martin Nicole H. 
Published: August 2024

Bacterial spores in raw milk can lead to quality issues in milk and milk derived products. Since these spores originate from farm environments, it is important to understand contributions of farm-level factors to spore levels in raw milk. Identifying highly influential factors will guide interventions to control the transmission of spores from farm environments into bulk tank raw milk and therefore minimize spoilage in the finished products. The objective of this study was to investigate the impact of farm management practices and meteorological factors on levels of different spore types in organic raw milk by leveraging machine learning models. In this study, raw milk from certified organic dairy farms (n = 102) located across 11 states was collected 6 times over a year and tested for standard plate count, psychrotolerant spore count, mesophilic spore count, thermophilic spore count, and butyric acid bacteria. At each sampling date, a survey was collected from each farm to obtain structured data about farm management practices. Meteorological factors related to temperature, precipitation, solar radiation, and wind were obtained on the date of sampling as well as 1, 2, and 3 days prior to the date of sampling from an open-source website. The dataset was stratified separately based on the use of a parlor for milking, number of years since organic certification, and whether the lactating herd was exposed to pasture time into sub-datasets to address the potential confounders. Using the entire datasets and 6 sub-datasets respectively, we constructed random forest regression models to predict log10mesophilic spore count, log10thermophilic spore count, and log10butyric acid bacteria most probable number as well as a random forest classification model to classify the presence of psychrotolerant spores in each raw milk sample. The summary statistics showed that spore levels vary considerably between certified organic farms but were only slightly higher than spore levels previously reported from conventional dairy farms. The variable importance plots from the random forest models suggest that herd size, certification year, employee-related variables (e.g., number of people milking cows per week), clipping and flaming udders, stocking density, and principal component representing air temperatures are among the top variables influencing the spore levels in organic raw milk, despite the limitation in the model performance (the highest performance for regression and classification is R2of 0.36 for predicting TSC for farms with a parlor and accuracy of 0.73 for classifying positive PSC for farms without a parlor, respectively). The relatively small effects of top variables as demonstrated by the partial dependence plots suggest that an individualized approach that synergistically considers multiple farm and environmental factors is needed to enable a risk-based approach for managing spore levels. While at the current stage, these models were insufficiently accurate to be used as predictive tools, incorporating novel data streams such as video surveillance and daily farm observations with computer vision and natural language processing, respectively, has the potential to enhance the performance of the model as a real-time monitoring tool for spores as an indicator of milk microbiological quality.