The probly Python package

probly is a Python package for uncertainty representation and quantification for machine learning.

Installation

probly is intended to work with Python 3.10 and above. Installation can be done via pip and or uv:

pip install probly

or

uv add probly

Quickstart

probly makes it very easy to make models uncertainty-aware and perform several downstream tasks:

import probly
import torch.nn.functional as F

net = ... # get neural network
model = probly.representation.Dropout(net) # make neural network a Dropout model
train(model) # train model as usual

data = ... # get data
preds = model.predict_representation(data) # predict an uncertainty representation
eu = probly.quantification.classification.mutual_information(preds) # compute model's epistemic uncertainty

data_ood = ... # get out of distribution data
preds_ood = model.predict_representation(data_ood)
eu_ood = probly.quantification.classification.mutual_information(preds_ood)
auroc = probly.tasks.out_of_distribution_detection(eu, eu_ood) # compute the AUROC score for out of distribution detection