Detecting frequent sequential patterns between weather and cattle behavior using data mining

Ly Ly Trieu, Derek W. Bailey, Huiping Cao, Tran Cao Son, Colin Tobin, Cory OltjenFrontiers in Animal Science 2025 · DOI

TL;DR

Researchers leveraged unsupervised sequential pattern mining (CM-SPAM) to prove that cattle behavior on open rangelands changes predictably during heatwaves. The study found that consecutive hot days—rather than isolated spikes—trigger a consistent, measurable decline in movement rates, offering a path toward remote, automated heat-stress monitoring.

What Problem Does This Paper Address?

Heat stress is a multi-million dollar headache for the livestock industry, negatively impacting cattle health, reproduction, and weight gain. While we know that "hot weather = stressed cows," monitoring animals across thousands of acres of rugged rangeland is nearly impossible for human observers.

Existing research often relies on supervised machine learning, which requires "labeled" data (e.g., a human recording exactly when a cow looks stressed). This is labor-intensive and expensive. Furthermore, most studies look at daily snapshots rather than the cumulative, "compounding" effect of a multi-day heatwave. This paper addresses the need for an unsupervised way to detect behavioral shifts caused by consecutive days of high thermal loads using only remote sensing data.

Methods

The researchers combined GPS tracking with data mining techniques to uncover hidden patterns:

  1. Thermal Indexing: They calculated the Hourly Heat Index (HI) using air temperature and relative humidity, then used k-means clustering to categorize days into three weather levels: hot, medium, and cool.
  2. Behavioral Metrics: Three metrics were derived from GPS data: movement rate (m/min), overall activity (active vs. inactive), and distance to water. These were also clustered into four levels (high, medium, slight, low).
  3. CM-SPAM (Co-occurrence Map Sequential Pattern Mining): This is the core "data mining" engine. Unlike standard classifiers, CM-SPAM looks for sequences. It identifies if "Weather A" on Day 1 followed by "Weather A" on Day 2 frequently leads to "Behavior B" on Day 3.
  4. Validation: To ensure these patterns weren't just coincidences, they applied binomial probability to test the likelihood of these behavioral sequences occurring by chance.

Datasets

The study utilized GPS tracking data from two trials at the Deep Well Ranch in Prescott, Arizona:

  • Trial 1 (2019): Data from 22 Corriente cows over a four-month summer period.
  • Trial 2 (2021): Data from 7 Corriente cows during a shorter summer window.
  • Weather Data: Hourly temperature and humidity sourced from the nearby Prescott Regional Airport.

Key Insights and Ideas

  • The Power of the Sequence: The most significant finding was that cattle behavior is sensitive to the duration of heat. The algorithm successfully identified that movement rates didn't just drop on a hot day; they stayed low or dropped further on the second, third, and fourth consecutive hot days.
  • Movement Rate is the "Golden Metric": While the researchers tested activity levels and distance to water, movement rate was the most reliable indicator of heat stress. Activity metrics were too "noisy," and distance to water didn't show a consistent enough pattern to be used for automated detection in this specific unsupervised setup.
  • Unsupervised is Scalable: Because the CM-SPAM algorithm doesn't need labeled "stress" data, it can be applied to different herds or environments without the need for a human to first spend weeks observing and tagging behavior.

Key Results

  • Pattern Recognition: In Trial 1, 90.91% of the cows exhibited a three-day continuous pattern of reduced movement during heatwaves. Over half (54.55%) showed a four-day pattern.
  • Quantitative Decline: During three-day heat sequences, the average decrease in movement rate was 4.57 m/min compared to the nearest cool day.
  • Statistical Significance: The probability of these patterns occurring by chance was calculated at P < 0.0001, confirming that the relationship between consecutive hot days and reduced movement is robust.
  • Morning/Evening Focus: The reduction in movement was most pronounced during the typical morning and evening "grazing bouts," suggesting cows were prioritizing thermoregulation over foraging.

Limitations and Future Work

  • Sample Size: Trial 2 had a very small sample size (7 cows) due to missing data, which made it harder to generalize those specific results.
  • GPS Limitations: The 10-minute GPS recording interval might be too coarse to catch short, frequent trips to water tanks, which could explain why the "distance to water" metric wasn't as effective.
  • Lack of Physiological Ground Truth: While the behavioral shifts are clear, the study did not include internal sensors (like rumen boluses) to correlate movement drops with actual core body temperature spikes.
  • Future Direction: The authors suggest integrating this logic into real-time "Early Warning Systems" that could alert ranchers to implement interventions (like providing extra shade or water) as soon as a multi-day heat pattern is detected.

Summary updated

Abstract

Climate frequently influences the sustainability of livestock systems. As a result of climate change, heat stress may become a significant challenge for cattle producers. Heat stress occurs during hot weather conditions when animals are unable to maintain homeothermy, which can negatively affect production, reproduction, and animal well-being. In this study, thermal heat index was used to monitor thermal conditions facing cattle on rangelands. Three metrics—movement rate, activity, and distance traveled from water—obtained from GPS tracking were used to represent behavior changes in response to variation in thermal conditions. Each of these behavior metrics was categorized into four behavioral levels (high, medium, slight, and low) using a well-known k-means clustering algorithm. Additionally, daily thermal conditions were categorized into three weather levels (hot, medium, and cool) based on heat index values, also using the k-means clustering. The objective was to identify and detect the relationship between hot weather and cattle behavior, with the hypothesis that consecutive hot days have a clear negative effect on cattle behavior, particularly leading to a reduction in activity and movement. To investigate this, the unsupervised Co-occurrence Map Sequential Pattern Mining (CM-SPAM) algorithm in data mining was applied to analyse tracking data collected in the summers of 2019 and 2021 at Deep Well Ranch, Prescott, Arizona, USA. The CM-SPAM algorithm successfully identified that consecutive hot days (two, three and four days in a row) resulted in a consistent decrease in movement rate on the second, third and fourth days, respectively, suggesting a decrease in cattle activity during the morning and evening grazing bouts. The activity and distance to water metrics were not able to establish a connection between hot weather conditions and behavioral change. The CM-SPAM algorithm successfully identified impacts of consecutive days of hot weather on cattle rather than only daily evaluations. Our study demonstrates the potential to remotely detect changes in cattle behavior during potentially stressful thermal conditions. This type of analysis could enable early interventions to manage heat stress, preventing potential negative effects on the animals’ health and productivity.
BibTeX
@inproceedings{trieu2025detecting,
  author = {Ly Ly Trieu and Derek W. Bailey and Huiping Cao and Tran Cao Son and Colin Tobin and Cory Oltjen},
  title = {{Detecting frequent sequential patterns between weather and cattle behavior using data mining}},
  booktitle = {Frontiers in Animal Science},
  year = {2025},
  doi = {10.3389/fanim.2025.1640550},
}
Figure