Conformal Prediction to Classify Animal Behaviours with Uncertainty

Medha Agarwal1, Kasim Rafiq2,3, Ronak Mehta1, Briana Abrahms2,3, Zaid Harchaoui1
1University of Washington (Statistics), 2University of Washington (Biology), 3Botswana Predator Conservation
RAPS

Regularized adaptive prediction sets (RAPS) with a target coverage of 95% ($1-\alpha=0.95$) for a random samples from each class. The numbers associated with each behaviour in the prediction set are the model predicted probability of success of that class.

Highlights

Challenges of Behavior Prediction in Ecology

Accelerometers capture waveform patterns corresponding to specific movements, but translating these into reliable behavioral logs is difficult. Current ML applications in ecology face four main limitations:

Methodology

Feature Extraction & Class Rebalancing

We use a 1D CNNs to extract features from raw accelerometry data. To address the severe class imbalance (e.g., 66% Resting vs 2% Feeding), we employ a flexible class rebalancing approach parametrized by $\theta$. This allows us to interpolate between the original distribution ($\theta=0$) and a perfectly balanced uniform distribution ($\theta=1$), optimizing for the detection of rare events.

CNN Architecture Second Image Description

Left: Our 1D CNN architecture extracts features from raw tri-axial accelerometer data. Right: Confusion matrices showing that our rebalancing approach improves recall on the rare Feeding class from 0.62 to 0.97.

Uncertainty Quantification via Conformal Prediction

Standard neural networks output softmax scores that often do not reflect true probabilities. To address this, we apply Regularized Adaptive Prediction Sets (RAPS). This method calibrates the model using a held-out validation set to generate prediction sets $\mathcal{C}(X)$. These sets are guaranteed to contain the true behavior $y$ with a user-specified probability $1-\alpha$ (e.g., 95%). This allows ecologists to identify ambiguous data segments where the model is uncertain.

Temporal Smoothning

To mitigate noisy, rapid fluctuations in predictions, we implement a temporal smoothing step. We average softmax scores over a sliding window of size $s$, leveraging the temporal context of surrounding behaviors to enforce biological plausibility.

Temporal Smoothing Animation

Temporal Smoothing in Action: Raw model predictions (top) fluctuate rapidly. Our smoothing pipeline (bottom) uses temporal context to output biologically plausible behaviour transitions.

Citation

@article{agarwal2025leveraging,
        title={Leveraging machine learning and accelerometry to classify animal behaviours with uncertainty},
        author={Agarwal, Medha and Rafiq, Kasim and Mehta, Ronak and Abrahms, Briana and Harchaoui, Zaid},
        booktitle={Methods in Ecology and Evolution (MEE)},
        year={2025}
        }