Date/Time: | 9/11/2025 |
Author: | Beatriz Granetti Peres |
Clinic: | Michigan State University |
City, State, ZIP: | East Lansing, MI 48823 |
B.G. Peres,
1
;
E. Ridenour, BS
1
;
L. Irion , BS
1
;
D. Stull, BS
2
;
A. Madureira , BS, PhD
2
;
Z. Rodriguez, DVM, PhD
1
;
P. Ruegg , DVM, MPVM
1
;
P.H.E. Trindade, DVM, MS, PhD, MBA
1
;
1Department of Large Animal Clinical Sciences, College of Veterinary Medicine, Michigan State University, East Lansing, US.
2Department of Animal Science, College of Agricultural and Natural Resources, Michigan State University, East Lansing, US.
Hot-iron disbudding is a painful procedure usually performed on dairy farms that impacts calves’ welfare and health by weakening their immune systems and increasing their disease susceptibility. Pain also reduces calves’ growth rates impacting farm productivity. These early life events may influence the long-term success of the farm. However, no automatic tool is currently available to identify pain in calves. We hypothesize that behaviors provided by ear tag sensors will change after disbudding, giving inputs to train an algorithm effective for automatically identifying pain in calves. We aimed (i) to investigate whether a machine learning algorithm can detect pain condition automatically in dairy calves after hot-iron disbudding using behavior pattern by ear tag sensor; and (ii) to determine which of three algorithms performs best for this purpose.
Forty female Holstein Friesian calves were fitted with ear tag sensors at birth. The ear tag sensor has an accelerometer that measures movement and converts it into behavioral data through a proprietary algorithm. The data was extracted as hourly percentages of active, not active, and high activity behaviors. Disbudding was performed at 25±5 days of age with oral administration of meloxicam and local lidocaine protocol. The behavior data were collected for 24 hours: the day before (pain-free condition) and the disbudding day (painful condition). Algorithms were trained to estimate the probability of pain (0.00–1.00%) using behavioral patterns. Random forest, support vector machine, and logistic regression algorithms were trained using 70% of the calves randomly selected, and the remaining were used to test the performance of each algorithm. In both the train and test bases, pain-free or painful conditions were used as the target variable, and the behaviors as feature variables. The Random Forest algorithm was trained using 10-fold cross-validation with five repetitions, employing 1,001 trees per forest and optimized through a grid search to determine the best number of variables (2) at each tree of the forest. The Support Vector Machine algorithm was trained using 10-fold cross-validation, and a grid search was used to optimize the algorithm, determining the best cost (1.0) and gamma (1.1) parameters. The area under the receiver operating characteristic curve (AUC), specificity, sensitivity, and their 95% confidence interval (CI) were calculated to evaluate the algorithms’ performance.
The AUC of the Random Forest algorithm was 91.28% (CI: 88.90–93.67) with a sensitivity of 86.46% (CI: 79.86–93.40) and a specificity of 82.42% (CI: 76.4–90.97). The Support Vector Machine had an AUC of 53.98% (CI: 49.27–58.68) with a sensitivity of 65.97% (CI: 13.89–89.93) and a specificity of 45.14% (CI: 18.06–93.06). The Logistic Regression had an AUC of 53.72% (CI: 49.01–58.43) with a sensitivity of 58.68% (CI: 17.36–80.90) and a specificity of 53.12% (CI: 28.47–90.97). The Random Forest had the highest performance metrics among the tested algorithms, demonstrating good classification ability to distinguish between painful and pain-free conditions based on the AUC >90%. The pain probability threshold from Random Forest was 0.42% (CI: 0.36–0.50%). Calves with probability <0.36 were true negatives, >0.50 true positives, and those between 0.36–0.50 fell into a gray zone of possible false negatives or positives. This classified 42.71% of the calves as true negatives, 46.70% as true positives, and 10.59% as gray zone.
In conclusion, machine learning can detect pain condition in dairy calves after disbudding using behavioral changes based on ear tag sensor data. The random forest algorithm had the highest performance metrics in relation to other algorithms. This approach is a key step toward automated pain detection tools. It might improve calf welfare and productivity while reducing labor on farms. Moreover, this research may enhance public perception of early-life care for dairy calves.