/density_softmax

Density-Softmax: Efficient Test-time Model for Uncertainty Estimation and Robustness under Distribution Shifts (ICML 2024).

Primary LanguagePythonApache License 2.0Apache-2.0

density_softmax

Quick Demo

Run this Google Colab.

or

notebook in demo/density_softmax.ipynyb

or

python file (full comparision, install prerequisite packages first to import library):

python demo/demo.py

Benchmark Guideline

To prepare:

Install prerequisite packages:

pip install "git+https://github.com/google/uncertainty-baselines.git#egg=uncertainty_baselines"

and

bash setup.sh

To run experiments:

python <method_file> --data_dir=<data_path>  --output_dir=<output_path> --use_gpu="True" --num_cores="1" 

where the parameters are the following:

  • <method_file>: file stored the code of method. E.g., <method_file> = baselines/cifar/density_softmax.py
  • <data_path>: path stored the dataset. E.g., <data_path> = "tmp/tensorflow_datasets"
  • <output_path>: path to store outputs of the model. E.g., <output_path> = "tmp/cifar10/density_softmax"

References

Based on code of: "Uncertainty Baselines: Benchmarks for uncertainty & robustness in deep learning"

Z. Nado, N. Band, M. Collier, J. Djolonga, M. Dusenberry, S. Farquhar, A. Filos, M. Havasi, R. Jenatton, G. Jerfel, J. Liu, Z. Mariet, J. Nixon, S. Padhy, J. Ren, T. Rudner, Y. Wen, F. Wenzel, K. Murphy, D. Sculley, B. Lakshminarayanan, J. Snoek, Y. Gal, and D. Tran. Uncertainty Baselines: Benchmarks for uncertainty & robustness in deep learning, arXiv preprint arXiv:2106.04015, 2021.

License

This source code is released under the Apache-2.0 license, included here.