Shortcuts

API Reference

Routines

The routine are the main building blocks of the library. They define the framework in which the models are trained and evaluated. They allow for easy computation of different metrics crucial for uncertainty estimation in different contexts, namely classification, regression and segmentation.

Classification

ClassificationRoutine

Routine for efficient training and testing on classification tasks using LightningModule.

Regression

RegressionRoutine

Routine for efficient training and testing on regression tasks using LightningModule.

Segmentation

SegmentationRoutine

Routine for efficient training and testing on segmentation tasks using LightningModule.

Baselines

TorchUncertainty provide lightning-based models that can be easily trained and evaluated. These models inherit from the routines and are specifically designed to benchmark different methods in similar settings, here with constant architectures.

Classification

ResNetBaseline

ResNet backbone baseline for classification providing support for various versions and architectures.

VGGBaseline

VGG backbone baseline for classification providing support for various versions and architectures.

WideResNetBaseline

Wide-ResNet28x10 backbone baseline for classification providing support for various versions.

Regression

MLPBaseline

MLP baseline for regression providing support for various versions.

Segmentation

SegFormerBaseline

SegFormer backbone baseline for segmentation providing support for various versions and architectures.

Layers

Ensemble layers

PackedLinear

Packed-Ensembles-style Linear layer.

PackedConv2d

Packed-Ensembles-style Conv2d layer.

BatchLinear

BatchEnsemble-style Linear layer.

BatchConv2d

BatchEnsemble-style Conv2d layer.

MaskedLinear

Masksembles-style Linear layer.

MaskedConv2d

Masksembles-style Conv2d layer.

Bayesian layers

BayesLinear

Bayesian Linear Layer with Mixture of Normals prior and Normal posterior.

BayesConv1d

Bayesian Conv1d Layer with Mixture of Normals prior and Normal posterior.

BayesConv2d

Bayesian Conv2d Layer with Mixture of Normals prior and Normal posterior.

BayesConv3d

Bayesian Conv3d Layer with Mixture of Normals prior and Normal posterior.

Models

Deep Ensembles

deep_ensembles

Build a Deep Ensembles out of the original models.

Monte Carlo Dropout

mc_dropout

MC Dropout wrapper for a model.

Metrics

AUSE

The Area Under the Sparsification Error curve (AUSE) metric to estimate the quality of the uncertainty estimates, i.e., how much they coincide with the true errors.

BrierScore

The Brier Score Metric.

CategoricalNLL

The Negative Log Likelihood Metric.

CE

Top-label Calibration Error.

Disagreement

The Disagreement Metric to estimate the confidence of an ensemble of estimators.

DistributionNLL

The Negative Log Likelihood Metric.

Entropy

The Shannon Entropy Metric to estimate the confidence of a single model or the mean confidence across estimators.

FPR95

The False Positive Rate at 95% Recall metric.

Log10

The Log10 metric.

MeanGTRelativeAbsoluteError

Compute Mean Absolute Error relative to the Ground Truth (MAErel or ARE).

MeanGTRelativeSquaredError

Compute mean squared error relative to the Ground Truth (MSErel or SRE).

MutualInformation

The Mutual Information Metric to estimate the epistemic uncertainty of an ensemble of estimators.

SILog

The Scale-Invariant Logarithmic Loss metric.

ThresholdAccuracy

The Threshold Accuracy metric, a.k.a.

Losses

DistributionNLLLoss

Negative Log-Likelihood loss using given distributions as inputs.

KLDiv

KL divergence loss for Bayesian Neural Networks.

ELBOLoss

The Evidence Lower Bound (ELBO) loss for Bayesian Neural Networks.

BetaNLL

The Beta Negative Log-likelihood loss.

DECLoss

The deep evidential classification loss.

Post-Processing Methods

TemperatureScaler

Temperature scaling post-processing for calibrated probabilities.

VectorScaler

Vector scaling post-processing for calibrated probabilities.

MatrixScaler

Matrix scaling post-processing for calibrated probabilities.

MCBatchNorm

Monte Carlo Batch Normalization wrapper.

Datamodules

Classification

CIFAR10DataModule

DataModule for CIFAR10.

CIFAR100DataModule

DataModule for CIFAR100.

MNISTDataModule

DataModule for MNIST.

TinyImageNetDataModule

ImageNetDataModule

DataModule for ImageNet.

Regression

UCIDataModule

The UCI regression datasets.

Segmentation

CamVidDataModule

DataModule for the CamVid dataset.

CityscapesDataModule

DataModule for the Cityscapes dataset.

MUADDataModule

Segmentation DataModule for the MUAD dataset.