Yao Ni , Jeremie Houssineau , Yew-Soon Ong , Piotr Koniusz
DAPPr.py provides a drop-in replacement for cross entropy and uncertainty scores for testing.
import torch.nn.functional as F
+from DAPPr import DAPPr_loss, DAPPr_uncertainty
# Training
for x, labels in train_loader:
logits = model(x)
- loss = F.cross_entropy(logits, labels)
+ loss = DAPPr_loss(logits, labels, lamb=2e-4)
# Testing: uncertainty estimation
for x, labels in test_loader:
logits = model(x)
+ uncertainty = DAPPr_uncertainty(logits)
+ AU = uncertainty["AU"] # aleatoric uncertainty
+ EU = uncertainty["EU"] # epistemic uncertaintylamb controls the regularization strength. In our experiments, we use either warm-up or linear scheduling for this value.
The code was tested with Python 3.11.7. Required Python packages are listed in requirements.txt.
Please follow data/README.md to download and prepare the datasets.
# CUB-200-2011
python3 train.py --dataset=CUB
# Stanford Dogs
python3 train.py --dataset=StanfordDogs
# Tiny-ImageNet
python3 train.py --dataset=TinyImageNet --epochs=100 --lr=5e-3 --lamb=5e-3 --lamb_schedule=linearThe code supports both image-folder and HDF5 loading. Image-folder loading is the default.
If your filesystem is slow or has a file-count limit, follow HDF5 conversion instructions to convert image folders to HDF5. Then add --hdf5:
python3 train.py --dataset=CUB \
+ --hdf5Reference running time on one V100 32GB GPU using image folders or HDF5 storage:
| Dataset | Image Folders | HDF5 |
|---|---|---|
| CUB-200-2011 | 1h50m | 1h20m |
| StanfordDogs | 2h40m | 2h10m |
| TinyImageNet | 10h40m | 10h20m |
python3 train.py --dataset=CUB --method=EDL --lamb=1e-5
python3 train.py --dataset=StanfordDogs --method=EDL --lamb=1e-5
python3 train.py --dataset=TinyImageNet --method=EDL --epochs=100 --lr=5e-3 --lamb=2e-4 --lamb_schedule=linearHyperparameter: For new datasets, we recommend tuning --lamb in the range 1e-5 to 1e-2. linear schedules usually require a larger value than warmup.
Entropy for OOD: For OOD detection, entropy is often stronger than epistemic uncertainty in our experiments. The code supports both.
@article{ni2026possibilistic,
title={Possibilistic Predictive Uncertainty for Deep Learning},
author={Ni, Yao and Houssineau, Jeremie and Ong, Yew Soon and Koniusz, Piotr},
journal={arXiv preprint arXiv:2605.00600},
year={2026}
}