This repository implements an uncertainty estimation kernel method based on Nadaraya-Watson kernel regression (see NUQ: Nonparametric Uncertainty Quantification for Deterministic Neural Networks by N. Kotelevskii et al.)
Important: we recommend having Jupyter Lab
installed in the base
conda environment. For the best experience, you may also install nb_conda_kernels
and ipywidgets
.
- Create conda environment:
$ conda env create --file environment.yaml
- Activate it:
$ conda activate ray-env
See classification and regression examples for more details.
from nuq import NuqClassifier
nuq = NuqClassifier()
nuq.fit(X_train, y_train)
preds, log_uncs = nuq.predict(X_test, return_uncertainty="epistemic")
from nuq import NuqRegressor
nuq = NuqRegressor()
nuq.fit(X_train, y_train)
preds, log_uncs = nuq.predict(X_test, return_uncertainty="epistemic")
(temporary local only)
Pip doesn't handle .toml files correctly, thus using setup.py
:
python setup.py develop
To uninstall:
pip uninstall nuq
- Install
pre-commit
(config provided in this repo)$ pre-commit install
- (optional) Run against all the files to check the consistency
$ pre-commit run --all-files
- You may also run
black
andisort
to keep the files style-compliant$ isort .; black .
- Proposed linter is
flake8
$ flake8 .
- One can run tests via
pytest
$ pytest